1sigprocmask(2) System Calls sigprocmask(2)
2
3
4
6 sigprocmask - change or examine caller's signal mask
7
9 #include <signal.h>
10
11 int sigprocmask(int how, const sigset_t *restrict set,
12 sigset_t *restrict oset);
13
14
16 The sigprocmask() function is used to examine and/or change the call‐
17 er's signal mask. If the value is SIG_BLOCK, the set pointed to by the
18 set argument is added to the current signal mask. If the value is
19 SIG_UNBLOCK, the set pointed by the set argument is removed from the
20 current signal mask. If the value is SIG_SETMASK, the current signal
21 mask is replaced by the set pointed to by the set argument. If the
22 oset argument is not NULL, the previous mask is stored in the space
23 pointed to by oset. If the value of the set argument is NULL, the
24 value how is not significant and the caller's signal mask is
25 unchanged; thus, the call can be used to inquire about currently
26 blocked signals. If the set or oset argument points to an invalid
27 address, the behavior is undefined and errno may be set to EFAULT.
28
29
30 If there are any pending unblocked signals after the call to sigproc‐
31 mask(), at least one of those signals will be delivered before the call
32 to sigprocmask() returns.
33
34
35 It is not possible to block signals that cannot be caught or ignored
36 (see sigaction(2)). It is also not possible to block or unblock SIGCAN‐
37 CEL, as SIGCANCEL is reserved for the implementation of POSIX thread
38 cancellation (see pthread_cancel(3C) and cancellation(5)). This
39 restriction is silently enforced by the standard C library.
40
41
42 If sigprocmask() fails, the caller's signal mask is not changed.
43
45 Upon successful completion, 0 is returned. Otherwise, −1 is returned
46 and errno is set to indicate the error.
47
49 The sigprocmask() function will fail if:
50
51 EINVAL The value of the how argument is not equal to one of the
52 defined values.
53
54
55
56 The sigprocmask() function may fail if:
57
58 EFAULT The set or oset argument points to an illegal address.
59
60
62 See attributes(5) for descriptions of the following attributes:
63
64
65
66
67 ┌─────────────────────────────┬─────────────────────────────┐
68 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
69 ├─────────────────────────────┼─────────────────────────────┤
70 │Interface Stability │Standard │
71 ├─────────────────────────────┼─────────────────────────────┤
72 │MT-Level │Async-Signal-Safe │
73 └─────────────────────────────┴─────────────────────────────┘
74
76 sigaction(2), pthread_cancel(3C), pthread_sigmask(3C), signal(3C), sig‐
77 nal.h(3HEAD), sigsetops(3C), attributes(5), cancellation(5)
78
80 The call to sigprocmask() affects only the calling thread's signal
81 mask. It is identical to a call to pthread_sigmask(3C).
82
83
84 Signals that are generated synchronously should not be masked. If such
85 a signal is blocked and delivered, the receiving process is killed.
86
87
88
89SunOS 5.11 23 Mar 2005 sigprocmask(2)