Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_fixcpp/sys/src/ape/lib/ap/posix/sigset.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <signal.h>
2
#include <errno.h>
3
 
4
/*
5
 * sigsets are 32-bit longs.  if the 2<<(i-1) bit is on,
6
 * the signal #define'd as i in signal.h is inluded.
7
 */
8
 
9
static sigset_t stdsigs = SIGHUP|SIGINT|SIGQUIT|SIGILL|SIGABRT|SIGFPE|SIGKILL|
10
		SIGSEGV|SIGPIPE|SIGALRM|SIGTERM|SIGUSR1|SIGUSR2;
11
 
12
#define BITSIG(s) (2<<(s))
13
 
14
int
15
sigemptyset(sigset_t *set)
16
{
17
	*set = 0;
18
	return 0;
19
}
20
 
21
int
22
sigfillset(sigset_t *set)
23
{
24
	*set = stdsigs;
25
	return 0;
26
}
27
 
28
int
29
sigaddset(sigset_t *set, int signo)
30
{
31
	int b;
32
 
33
	b = BITSIG(signo);
34
	if(!(b&stdsigs)){
35
		errno = EINVAL;
36
		return -1;
37
	}
38
	*set |= b;
39
	return 0;
40
}
41
 
42
int
43
sigdelset(sigset_t *set, int signo)
44
{
45
	int b;
46
 
47
	b = BITSIG(signo);
48
	if(!(b&stdsigs)){
49
		errno = EINVAL;
50
		return -1;
51
	}
52
	*set &= ~b;
53
	return 0;
54
}
55
 
56
int
57
sigismember(sigset_t *set, int signo)
58
{
59
	int b;
60
 
61
	b = BITSIG(signo);
62
	if(!(b&stdsigs)){
63
		errno = EINVAL;
64
		return -1;
65
	}
66
	return (b&*set)? 1 : 0;
67
}