mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
Kernel+LibC: Implement sys$ioctl() FIONBIO
This is another (older) way of making a file descriptor non-blocking.
This commit is contained in:
parent
526b4bbfdb
commit
5f71bf0cc7
2 changed files with 8 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue