mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-25 04:02:28 +03: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
Notes:
sideshowbarker
2024-07-18 21:00:00 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/5f71bf0cc7d
@ -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);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,8 @@ enum IOCtlNumber {
|
||||
SIOCSIFNETMASK,
|
||||
SIOCADDRT,
|
||||
SIOCDELRT,
|
||||
FIBMAP
|
||||
FIBMAP,
|
||||
FIONBIO,
|
||||
};
|
||||
|
||||
#define TIOCGPGRP TIOCGPGRP
|
||||
@ -94,3 +95,4 @@ enum IOCtlNumber {
|
||||
#define SIOCADDRT SIOCADDRT
|
||||
#define SIOCDELRT SIOCDELRT
|
||||
#define FIBMAP FIBMAP
|
||||
#define FIONBIO FIONBIO
|
||||
|
Loading…
Reference in New Issue
Block a user