mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:37:43 +00:00
Kernel: Add FIOCLEX and FIONCLEX ioctls
These allow you to turn the close-on-exec flag on/off via ioctl().
This commit is contained in:
parent
20d21fad7b
commit
b85c8a0b80
2 changed files with 14 additions and 0 deletions
|
@ -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);
|
description->set_blocking(TRY(copy_typed_from_user(Userspace<int const*>(arg))) == 0);
|
||||||
return 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));
|
TRY(description->file().ioctl(*description, request, arg));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,6 +119,8 @@ enum IOCtlNumber {
|
||||||
FIBMAP,
|
FIBMAP,
|
||||||
FIONBIO,
|
FIONBIO,
|
||||||
FIONREAD,
|
FIONREAD,
|
||||||
|
FIOCLEX,
|
||||||
|
FIONCLEX,
|
||||||
KCOV_SETBUFSIZE,
|
KCOV_SETBUFSIZE,
|
||||||
KCOV_ENABLE,
|
KCOV_ENABLE,
|
||||||
KCOV_DISABLE,
|
KCOV_DISABLE,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue