The sigaction structure

The sigaction(2) system call takes three parameters, of which the second and third are of the same data type.

The first parameter int signum is the signal to trap. This straight away reveals an important point: signals are meant to be trapped one at a time—you can only trap one signal with a single call to sigaction. Do not attempt to be overly clever and do things such as pass a bitmask of signals (bitwise-ORed) together; that's a bug. Of course, you can always call sigaction multiple times or in a loop.

The data type of the second and third parameters is a pointer to a structure called, again, sigaction. The sigaction structure definition is as follows (from the header /usr/include/bits/sigaction.h):

/* Structure ...

Get Hands-On System Programming with Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.