summaryrefslogtreecommitdiff
path: root/src/signal/sigismember.c
blob: 1a22108b549538d9f3ccdc7a4730c5d51d23bf1a (plain)
1
2
3
4
5
6
7
8
9
#include <signal.h>
#include <errno.h>

int sigismember(const sigset_t *set, int sig)
{
	unsigned s = sig-1;
	if (s >= 8*sizeof(sigset_t)) return 0;
	return !!(set->__bits[s/8/sizeof *set->__bits] & 1UL<<(s&8*sizeof *set->__bits-1));
}