mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
Kernel+LibC: Implement FIONREAD ioctl
FIONREAD gets the number of bytes availible to read from a file descriptor without blocking. I only implemented it for regular files and sockets
This commit is contained in:
parent
db92e66902
commit
39a77559f1
7 changed files with 38 additions and 4 deletions
|
@ -770,6 +770,14 @@ KResult IPv4Socket::ioctl(FileDescription&, unsigned request, Userspace<void*> a
|
|||
case SIOCSARP:
|
||||
case SIOCDARP:
|
||||
return ioctl_arp();
|
||||
|
||||
case FIONREAD: {
|
||||
int readable = m_receive_buffer->immediately_readable();
|
||||
if (!copy_to_user(Userspace<int*>(arg), &readable))
|
||||
return EFAULT;
|
||||
|
||||
return KSuccess;
|
||||
}
|
||||
}
|
||||
|
||||
return EINVAL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue