gtpc2m6nC/C++ Language Support User's Guide

sigaddset-Add a Signal to a Signal Set

This macro adds a specific signal to a signal set. It is one of several macros that manage or query signal sets.

Format

#include <signal.h>
int sigaddset(sigset_t  *set,
                   int   signo);

set
A pointer to a signal set of the sigset_t type.

signo
One of the signals defined in the signal.h header file that corresponds to a specific signal to be added. See Table 13 for a list of supported signals.

Normal Return

If successful, the sigaddset macro returns a value of 0.

Error Return

If an error occurs, the sigaddset macro returns a value of -1 and sets errno to the following:

EINVAL
The value specified by the signo parameter is not a valid signal number.

Programming Considerations

Before using the sigaddset macro to add a signal to a signal set, the signal set must be initialized by either the sigemptyset or the sigfillset macro. If it is not initialized, the contents of the signal set are not guaranteed.

Examples

See sigsuspend-Set Signal Mask and Wait for a Signal for an example of the sigaddset macro.

Related Information