1

In the book Unix Network Programming there is the following statement:

We should establish the signal handler before setting the owner of the socket. Under Berkeley-derived implementations, the order of the two function calls does not matter because the default action is to ignore SIGIO. Therefore, if we were to reverse the order of the two function calls, there is a small chance that a signal could be generated after the call to fcntl but before the call to signal; if that happens, the signal is just discarded. Under SVR4, however, SIGIO is defined to be SIGPOLL in the header and the default action of SIGPOLL is to terminate the process. Therefore, under SVR4, we want to be certain the signal handler is installed before setting the owner of the socket.

In the file signal.h in the Linux kernel, the POSIX behavior, which follows System V is quoted as a comment:

*   +--------------------+------------------+
 *  |  POSIX signal      |  default action  |
 *  +--------------------+------------------+
 *  |  SIGHUP            |  terminate   |
 *  |  SIGINT            |  terminate   |
   ....
 *  |  SIGPROF           |  terminate   |
 *  |  SIGPOLL/SIGIO     |  terminate   |
 *  |  SIGSYS/SIGUNUSED  |  coredump    |
 *  |  SIGSTKFLT         |  terminate   |
   .... etc.

However, I could not find any place in the source where this policy was actually implemented. There did not appear to be any equation setting SIGIO equal to SIGPOLL. So, does Linux follow the Berkeley behavior or the System V behavior?

1 Answer 1

2
#define SIGIO       29
#define SIGPOLL SIGIO

https://github.com/torvalds/linux/blob/v4.12/include/uapi/asm-generic/signal.h#L39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.