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
commit cba05ce75e
Notes: sideshowbarker 2024-07-19 16:11:39 +09:00
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