1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

Kernel: Add support for MSG_NOSIGNAL and properly send SIGPIPE

Previously we didn't send the SIGPIPE signal to processes when
sendto()/sendmsg()/etc. returned EPIPE. And now we do.

This also adds support for MSG_NOSIGNAL to suppress the signal.
This commit is contained in:
Gunnar Beutner 2022-10-23 10:30:12 +02:00 committed by Linus Groh
parent e5e7ea90b1
commit ce4b66e908
4 changed files with 16 additions and 5 deletions

View file

@ -78,6 +78,8 @@ ErrorOr<FlatPtr> Process::do_write(OpenFileDescription& description, UserOrKerne
return total_nwritten;
if (nwritten_or_error.error().code() == EAGAIN)
continue;
if (nwritten_or_error.error().code() == EPIPE)
Thread::current()->send_signal(SIGPIPE, &Process::current());
return nwritten_or_error.release_error();
}
VERIFY(nwritten_or_error.value() > 0);