1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 14:05:09 +00:00

Before sys$write returns, check for pending unmasked signals.

If there is one, put the process into a new BlockedSignal state which makes
the next scheduler iteration dispatch the signal.
This commit is contained in:
Andreas Kling 2018-11-10 02:43:33 +01:00
parent 8605711f4b
commit cba05ce75e
2 changed files with 9 additions and 1 deletions

View file

@ -978,6 +978,12 @@ ssize_t Process::sys$write(int fd, const void* data, size_t size)
if (!descriptor)
return -EBADF;
auto nwritten = descriptor->write((const byte*)data, size);
if (has_unmasked_pending_signals()) {
block(BlockedSignal);
Scheduler::yield();
if (nwritten == 0)
return -EINTR;
}
#ifdef DEBUG_IO
kprintf("Process::sys$write: nwritten=%u\n", nwritten);
#endif