#include <signal.h> int sigismember( const sigset_t *set, int signo );
The sigismember() function is part of a family of functions that manipulate signal sets. Signal sets are data objects that let a thread keep track of groups of signals. For example, a thread might create a signal set to record which signals it is blocking, and another signal set to record which signals are pending. Signal sets are used to manipulate groups of signals used by other functions (such as sigprocmask()) or to examine signal sets returned by other functions (such as sigpending()).
sigismember() tests whether a signal number specified by signo is a member of a signal set specified by set.
None.
1 | The specified signal is in the specified signal set. |
0 | The specified signal is not in the specified signal set. |
-1 | An error occurred. The errno variable is set to indicate the error. |
If sigismember() is not successful, errno usually indicates the following error. Under some conditions, errno could indicate an error other than that listed here.
The value specified for the argument is not correct.
A function was passed incorrect argument values, or an operation was attempted on an object and the operation specified is not supported for that type of object.
An argument value is not valid, out of range, or NULL.
The value of signo is not within the range of valid signals or specifies a signal that is not supported.
See Code disclaimer information for information pertaining to code examples.
The following example uses the sigismember() function to test for the presence of signals in a signal set:
#include <stdio.h> #include <signal.h> void check( sigset_t set, int signo, char *signame ) { printf( "%s is ", signame ); if( !sigismember( &set, signo ) ) printf( "not "); printf( "in the set" ); } int main( int argc, char *argv[] ) { sigset_t sigset; sigemptyset( &sigset ); sigaddset( &sigset, SIGUSR1 ); sigaddset( &sigset, SIGKILL ); sigaddset( &sigset, SIGCHLD ); check( sigset, SIGUSR1, "SIGUSR1" ); check( sigset, SIGUSR2, "SIGUSR2" ); check( sigset, SIGCHLD, "SIGCHLD" ); check( sigset, SIGFPE, "SIGFPE" ); check( sigset, SIGKILL, "SIGKILL" ); return( 0 ); }
SIGUSR1 is in the set SIGUSR2 is not in the set SIGCHLD is in the set SIGFPE is not in the set SIGKILL is in the set
Top | UNIX-Type APIs | APIs by category |