From 1d957dab035cd9e5ebb26e61ece74e05c586295c Mon Sep 17 00:00:00 2001 From: Matheus Date: Sat, 4 Oct 2025 21:48:23 -0300 Subject: [PATCH] fcntl: handle F_DUPFD_CLOEXEC --- kernel-src/sys/syscalls/fcntl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel-src/sys/syscalls/fcntl.c b/kernel-src/sys/syscalls/fcntl.c index fd7faab4..d955a4a9 100644 --- a/kernel-src/sys/syscalls/fcntl.c +++ b/kernel-src/sys/syscalls/fcntl.c @@ -11,6 +11,7 @@ #define F_SETFL 4 #define F_SETLK64 6 #define F_SETLKW64 7 +#define F_DUPFD_CLOEXEC 1030 #define FD_CLOEXEC 1 @@ -26,10 +27,11 @@ syscallret_t syscall_fcntl(context_t *, int fd, int cmd, uint64_t arg) { } switch (cmd) { + case F_DUPFD_CLOEXEC: case F_DUPFD: { int f; - ret.errno = fd_dup(fd, arg, false, 0, &f); + ret.errno = fd_dup(fd, arg, false, (cmd == F_DUPFD_CLOEXEC) ? O_CLOEXEC : 0, &f); ret.ret = f; } break;