Keywords: lpg

Next: 10.2.2 Linux signal options Up: 10.2 Signal handling Previous: 10.2 Signal handling

## 10.2.1 Signals under SVR4, BSD, and POSIX.1

The SVR4 implementation of signals incorporates the functions signal, sigset, sighold, sigrelse, sigignore, and sigpause. The signal function under SVR4 is identical to the classic UNIX V7 signals, providing only unreliable signals. The other functions do provide signals with automatic reinstallation of the signal handler, but no system call restarting is supported.

Under BSD, the functions signal, sigvec, sigblock, sigsetmask, and sigpause are supported. All of the functions provide reliable signals with system call restarting by default, but that behavior can be disabled if the programmer wishes.

Under POSIX.1, sigaction, sigprocmask, sigpending, and sigsuspend are provided. Note that there is no signal function, and according to POSIX.1 it is depreciated. These functions provide reliable signals, but system call restart behavior is not defined by POSIX. If sigaction is used under SVR4 and BSD, system call restarting is disabled by default, but it can be turned on if the signal flag `SA_RESTART` is specified.

Therefore, the ``best'' way to use signals in a program is to use sigaction, which allows you to explicitly specify the behavior of signal handlers. However, signal is still used in many applications, and as we can see above signal provides different semantics under SVR4 and BSD.