From 196698c0595e061582dba61c47b2cb814b30f1d8 Mon Sep 17 00:00:00 2001 From: Matheus Date: Tue, 7 Jul 2026 14:38:58 -0300 Subject: [PATCH] file: call shutdown on socket close --- kernel-src/fs/file.c | 6 ++++++ recipes/astral | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel-src/fs/file.c b/kernel-src/fs/file.c index d847d2ff..c3e02fd4 100644 --- a/kernel-src/fs/file.c +++ b/kernel-src/fs/file.c @@ -4,6 +4,7 @@ #include #include #include +#include static scache_t *filecache; #define FILE_HOLD(f) __atomic_add_fetch(&(f)->refcount, 1, __ATOMIC_SEQ_CST) @@ -179,6 +180,11 @@ int fd_close(int fd) { MUTEX_RELEASE(&proc->fdmutex); if (file) { + if (file->vnode && file->vnode->type == V_TYPE_SOCKET) { + socket_t *socket = SOCKFS_SOCKET_FROM_NODE(file->vnode); + socket->ops->shutdown(socket, SOCKET_SHUTDOWN_RW); + } + FILE_RELEASE(file); } else { diff --git a/recipes/astral b/recipes/astral index feae42ce..e50b66dc 100644 --- a/recipes/astral +++ b/recipes/astral @@ -1,5 +1,5 @@ name=astral -revision=21 +revision=22 from_source=astral imagedeps="build-essential nasm" hostdeps="xgcc xbinutils limine"