summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/ioctl.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-03-28 17:50:08 +0200
committerAndreas Kling <kling@serenityos.org>2021-03-28 17:50:08 +0200
commit5f71bf0cc7de17d0aa2703aabf4e0cad5f000ae8 (patch)
tree5e01cd67c7c17791de758381883f5934ba4fd5e1 /Kernel/Syscalls/ioctl.cpp
parent526b4bbfdb1a60fbfec3fe64e3fc3ab9b49a221c (diff)
downloadserenity-5f71bf0cc7de17d0aa2703aabf4e0cad5f000ae8.zip
Kernel+LibC: Implement sys$ioctl() FIONBIO
This is another (older) way of making a file descriptor non-blocking.
Diffstat (limited to 'Kernel/Syscalls/ioctl.cpp')
-rw-r--r--Kernel/Syscalls/ioctl.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Kernel/Syscalls/ioctl.cpp b/Kernel/Syscalls/ioctl.cpp
index 2d06bffa34..acff91dfd1 100644
--- a/Kernel/Syscalls/ioctl.cpp
+++ b/Kernel/Syscalls/ioctl.cpp
@@ -26,6 +26,7 @@
#include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/Process.h>
+#include <LibC/sys/ioctl_numbers.h>
namespace Kernel {
@@ -34,6 +35,10 @@ KResultOr<int> Process::sys$ioctl(int fd, unsigned request, FlatPtr arg)
auto description = file_description(fd);
if (!description)
return EBADF;
+ if (request == FIONBIO && arg != 0) {
+ description->set_blocking(false);
+ return KSuccess;
+ }
return description->file().ioctl(*description, request, arg);
}