vfs,libc: support write fds in select

By adding a 'write_ready' interface following the lines of the existing
'read_ready', VFS plugins become able to propagate the (de-)saturation
of I/O buffers to the VFS user. This information is important when using
a non-blocking file descriptor for writing into a TCP socket. Once the
application observes EAGAIN, it expects a subsequent 'select' call to
return as soon as new I/O buffer space becomes available.

Before this patch, the select call would always return under this
condition, causing an unnecessarily busy write loop.

Issue #4697
This commit is contained in:
Norman Feske
2022-12-06 19:11:44 +01:00
committed by Christian Helmuth
parent 5ad98f2b7c
commit ff2176a586
41 changed files with 326 additions and 60 deletions

View File

@ -973,6 +973,14 @@ class Vfs::Dir_file_system : public File_system
return handle->fs().read_ready(handle);
}
bool write_ready(Vfs_handle const &handle) const override
{
if (&handle.fs() == this)
return false;
return handle.fs().write_ready(handle);
}
bool notify_read_ready(Vfs_handle *handle) override
{
if (&handle->fs() == this)