1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-01 03:32:12 +00:00

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
parent 635eb20289
commit d8b74c8c86

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