Kernel: Check can_write for blocking write

This way the socket write buffer sizes are respected, and things that
exceed them get sent EAGAIN.
This commit is contained in:
Robin Burchell 2019-05-19 10:25:05 +02:00 committed by Andreas Kling
commit d8b74c8c86
Notes: sideshowbarker 2024-07-19 14:01:19 +09:00

View file

@ -853,8 +853,10 @@ ssize_t Process::sys$writev(int fd, const struct iovec* iov, int iov_count)
ssize_t Process::do_write(FileDescriptor& descriptor, const byte* data, int data_size)
{
ssize_t nwritten = 0;
if (!descriptor.is_blocking())
return descriptor.write(data, data_size);
if (!descriptor.is_blocking()) {
if (!descriptor.can_write())
return -EAGAIN;
}
while (nwritten < data_size) {
#ifdef IO_DEBUG