From 16b9b3f228b17a8c2ca3a8ac72b59427f165915a Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Tue, 19 Nov 2019 15:33:08 +0300 Subject: [PATCH] Kernel: Don't interrupt short writes Remove explicit checking for pending signals from writing code paths, since this is handled automatically when blocking, and should not happen if the write() call is "short", i.e. doesn't block. All the other syscalls already work like this. Fixes https://github.com/SerenityOS/serenity/issues/797 --- Kernel/Process.cpp | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 2fe517437a..802aa6c8b4 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -1072,13 +1072,6 @@ ssize_t Process::sys$writev(int fd, const struct iovec* iov, int iov_count) nwritten += rc; } - if (current->has_unmasked_pending_signals()) { - if (current->block(Thread::SemiPermanentBlocker::Reason::Signal) == Thread::BlockResult::InterruptedBySignal) { - if (nwritten == 0) - return -EINTR; - } - } - return nwritten; } @@ -1121,12 +1114,6 @@ ssize_t Process::do_write(FileDescription& description, const u8* data, int data } if (rc == 0) break; - if (current->has_unmasked_pending_signals()) { - if (current->block(Thread::SemiPermanentBlocker::Reason::Signal) == Thread::BlockResult::InterruptedBySignal) { - if (nwritten == 0) - return -EINTR; - } - } nwritten += rc; } return nwritten; @@ -1146,14 +1133,8 @@ ssize_t Process::sys$write(int fd, const u8* data, ssize_t size) auto* description = file_description(fd); if (!description) return -EBADF; - auto nwritten = do_write(*description, data, size); - if (current->has_unmasked_pending_signals()) { - if (current->block(Thread::SemiPermanentBlocker::Reason::Signal) == Thread::BlockResult::InterruptedBySignal) { - if (nwritten == 0) - return -EINTR; - } - } - return nwritten; + + return do_write(*description, data, size); } ssize_t Process::sys$read(int fd, u8* buffer, ssize_t size)