In a practical application, one application needs to handle multiple signals, and in order to be convenient, the Linux system introduces the concept of the signal set. A data type sigset_t with multiple signals. The following system calls can be used to set the data contained in the signal set.
1, the common signal and definition as shown:
2, sigset_t in the linux2.6.39/include/asm-generic/signal.h definition
typedef struct {
unsignedlong sig[_nsig_words];
} sigset_t;
3, the corresponding system call function:
#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 represents a signal set pointer, Setnumber represents a signal.
Sigemptyset is used to set the set of signals that the set points to null, that is, to not contain any signals.
Sigfillset is used to set the set of signals that the set points to full, that is, to contain all the signals.
Sigaddset is used to add a signal to a signal set.
Sigdelset is used to remove signals from the signal set.
The above function successfully returns 0, failure returns-1
4, in addition, the int sigismember (const sigset_t set,int signumber) is used to detect whether the signumber is in set, if it belongs to return 1, not return 0.
View a full set of articles: Http://www.bianceng.cn/Programming/C/201212/34807.htm