mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:22:45 +00:00 
			
		
		
		
	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
This commit is contained in:
		
							parent
							
								
									0ddde627b1
								
							
						
					
					
						commit
						16b9b3f228
					
				
					 1 changed files with 2 additions and 21 deletions
				
			
		|  | @ -1072,13 +1072,6 @@ ssize_t Process::sys$writev(int fd, const struct iovec* iov, int iov_count) | ||||||
|         nwritten += rc; |         nwritten += rc; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (current->has_unmasked_pending_signals()) { |  | ||||||
|         if (current->block<Thread::SemiPermanentBlocker>(Thread::SemiPermanentBlocker::Reason::Signal) == Thread::BlockResult::InterruptedBySignal) { |  | ||||||
|             if (nwritten == 0) |  | ||||||
|                 return -EINTR; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     return nwritten; |     return nwritten; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1121,12 +1114,6 @@ ssize_t Process::do_write(FileDescription& description, const u8* data, int data | ||||||
|         } |         } | ||||||
|         if (rc == 0) |         if (rc == 0) | ||||||
|             break; |             break; | ||||||
|         if (current->has_unmasked_pending_signals()) { |  | ||||||
|             if (current->block<Thread::SemiPermanentBlocker>(Thread::SemiPermanentBlocker::Reason::Signal) == Thread::BlockResult::InterruptedBySignal) { |  | ||||||
|                 if (nwritten == 0) |  | ||||||
|                     return -EINTR; |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         nwritten += rc; |         nwritten += rc; | ||||||
|     } |     } | ||||||
|     return nwritten; |     return nwritten; | ||||||
|  | @ -1146,14 +1133,8 @@ ssize_t Process::sys$write(int fd, const u8* data, ssize_t size) | ||||||
|     auto* description = file_description(fd); |     auto* description = file_description(fd); | ||||||
|     if (!description) |     if (!description) | ||||||
|         return -EBADF; |         return -EBADF; | ||||||
|     auto nwritten = do_write(*description, data, size); | 
 | ||||||
|     if (current->has_unmasked_pending_signals()) { |     return do_write(*description, data, size); | ||||||
|         if (current->block<Thread::SemiPermanentBlocker>(Thread::SemiPermanentBlocker::Reason::Signal) == Thread::BlockResult::InterruptedBySignal) { |  | ||||||
|             if (nwritten == 0) |  | ||||||
|                 return -EINTR; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|     return nwritten; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ssize_t Process::sys$read(int fd, u8* buffer, ssize_t size) | ssize_t Process::sys$read(int fd, u8* buffer, ssize_t size) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Sergey Bugaev
						Sergey Bugaev