This series of articles written by muge0913, reproduced please note the Source: http://blog.csdn.net/muge0913/article/details/7332372
In practical applications, an application needs to process multiple signals. For convenience, the concept of signal set is introduced in Linux. The signal set uses the sigset_t data type composed of multiple signals. The following system calls can be used to set the data contained in the signal set.
1. Common signals and definitions
2. sigset_t is defined in linux2.6.39/include/ASM-generic/signal. h.
typedef struct { unsignedlong sig[_NSIG_WORDS];} sigset_t;
3. Corresponding System Call functions:
#include<signal.h>int sigemptyset(sigset_t *set);int sigfillset(sigset_t *set);int sigadd(sigset_t *set,int setnumber);int sigdelset(sigset_t *set,int setnumber);
Set indicates the signal set pointer, and setnumber indicates the signal.
Sigemptyset is used to set the signal set pointed to by the set to null, that is, it does not contain any signal.
Sigfillset is used to set the signal set to full to contain all signals.
Sigaddset is used to add signals to the signal set.
Sigdelset is used to delete signals from the signal set.
If the preceding functions are successful, 0 is returned. If the function fails,-1 is returned.
4. In addition, int sigismember (const sigset_t set, int signumber) is used to check whether signumber is in set. If it belongs to return 1, it does not return 0.