Sample Header Ad - 728x90

Why have SIGPIPE when EPIPE exists?

17 votes
3 answers
2012 views
According to [pipe(7)](https://linux.die.net/man/7/pipe) : > If all file descriptors referring to the read end of a pipe have been closed, then a write(2) will cause a SIGPIPE signal to be generated for the calling process. If the calling process is ignoring this signal, then write(2) fails with the error EPIPE. Why does Unix need to have the SIGPIPE signal when write() can simply return EPIPE directly? My understanding is that signals are intended for things that are inherently asynchronous (e.g. termination of a child, terminal interrupt). But SIGPIPE is only ever generated as the immediate result of a call to write(), in which case it could always just return EPIPE to to caller to signify the error to the caller. Why was it deemed necessary to have SIGPIPE in addition to EPIPE?
Asked by CarmenCarmen (195 rep)
Aug 2, 2024, 01:49 AM
Last activity: Feb 3, 2025, 12:37 PM