Implement SIGPIPE signal delivery #607
Draft
+325
−23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implement proper SIGPIPE signal delivery when writing to closed pipes or sockets, replacing the previous
unimplemented!()panics that would crash the process.This was a P0 critical issue identified in the syscall implementation plan.
Changes
syscalls/signal/mod.rssend_sigpipe()method to Tasksyscalls/file.rssyscalls/net.rsdo_sendto()anddo_sendmsg()for INET socketssyscalls/unix.rstests/sigpipe_test.cSignal Behavior
Following POSIX semantics:
Architecture Decision
SIGPIPE handling is done at the
Tasklevel (indo_sendto/do_sendmsg) rather than insideGlobalState::sendto()orUnixSocket::sendto(), since those lower-level functions don't have access to the Task's signal infrastructure.Test Coverage
Rust Unit Tests
test_pipe_epipe- Verifies write to closed pipe returns EPIPEtest_sigpipe_signal_queued- Verifiessend_sigpipe()queues the signalC Integration Tests (
sigpipe_test.c)test_pipe_sigpipe- SIGPIPE delivery on pipe writetest_pipe_sigpipe_ignored- SIG_IGN handlingtest_pipe_sigpipe_blocked- Blocked signal pendingtest_unix_socket_nosignal- MSG_NOSIGNAL flagtest_unix_socket_sigpipe- Unix socket SIGPIPE deliveryTest plan
cargo clippycleancargo fmtclean🤖 Generated with Claude Code