Adds the specified individual signal. Format #include <signal.h> int sigaddset (sigset_t *set, int sig_number);
1 – Arguments
set The signal set. sig_number The individual signal.
2 – Description
The sigaddset function manipulates sets of signals. This function operates on data objects that you can address by the application, not on any set of signals known to the system. For example, this function does not operate on the set blocked from delivery to a process or the set pending for a process. The sigaddset function adds the individual signal specified by sig_number from the signal set specified by set.
3 – Example
The following example shows how to generate and use a signal mask that blocks only the SIGINT signal from delivery: #include <signal.h> int return_value; sigset_t newset; . . . sigemptyset(&newset); sigaddset(&newset, SIGINT); return_value = sigprocmask (SIG_SETMASK, &newset, NULL);
4 – Return Values
0 Indicates success. -1 Indicates an error; errno is set to the following value: o EINVAL - The value of sig_number is not a valid signal number.