$RodHat_/search
signal reference

SIGPIPE

Write to a pipe or socket with no reader.

Linux number
13
FreeBSD number
13
Default action
Terminate the process
Catch, block or ignore
Allowed
Standard
POSIX.1-1990

The reason `yes | head -1` exits quietly: the writer is killed when the reader closes. A daemon writing to a client socket that has gone away should not die from it. Ignore SIGPIPE (or pass MSG_NOSIGNAL to send(2)) and handle EPIPE from the write instead.

Related syscalls

  • splice(2)Linux · I/O

    Move data between a pipe and another fd without copying through userspace.

Sources

  1. signal(7), Linux man-pages
  2. signal(3), FreeBSD manual

Numbers are Linux on x86 and arm64; alpha, mips, sparc and parisc number some signals differently. Spot one that's wrong? Tell Rod.