diff options
-rw-r--r-- | Kernel/Syscalls/ioctl.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibC/sys/ioctl_numbers.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/Kernel/Syscalls/ioctl.cpp b/Kernel/Syscalls/ioctl.cpp index 9b333c61d9..ccbe9d7681 100644 --- a/Kernel/Syscalls/ioctl.cpp +++ b/Kernel/Syscalls/ioctl.cpp @@ -19,6 +19,18 @@ ErrorOr<FlatPtr> Process::sys$ioctl(int fd, unsigned request, FlatPtr arg) description->set_blocking(TRY(copy_typed_from_user(Userspace<int const*>(arg))) == 0); return 0; } + if (request == FIOCLEX) { + m_fds.with_exclusive([&](auto& fds) { + fds[fd].set_flags(fds[fd].flags() | FD_CLOEXEC); + }); + return 0; + } + if (request == FIONCLEX) { + m_fds.with_exclusive([&](auto& fds) { + fds[fd].set_flags(fds[fd].flags() & ~FD_CLOEXEC); + }); + return 0; + } TRY(description->file().ioctl(*description, request, arg)); return 0; } diff --git a/Userland/Libraries/LibC/sys/ioctl_numbers.h b/Userland/Libraries/LibC/sys/ioctl_numbers.h index 02920b37df..2a97ea41ab 100644 --- a/Userland/Libraries/LibC/sys/ioctl_numbers.h +++ b/Userland/Libraries/LibC/sys/ioctl_numbers.h @@ -119,6 +119,8 @@ enum IOCtlNumber { FIBMAP, FIONBIO, FIONREAD, + FIOCLEX, + FIONCLEX, KCOV_SETBUFSIZE, KCOV_ENABLE, KCOV_DISABLE, |