Tuesday, October 18, 2011

sigismember example

#include <signal.h>
#include <errno.h>

/* 
 * <signal.h> usually defines NSIG to include signal number 0 
 */
#define SIGBAD(signo) ((signo) <= 0 || (signo) >= NSIG)
int sigismember(const sigset_t *set, int signo) {
    if (SIGBAD(signo)) {
        errno = EINVAL; return(-1);
    }
    return((*set & (1 << (signo - 1))) != 0);
}

See Also
  1. sigdelset
  2. sigaddset

No comments:

Post a Comment