OSDN Git Service

(split) LDP: Update original to LDP v3.40.
[linuxjm/LDP_man-pages.git] / original / man2 / sigprocmask.2
1 .\" Copyright (c) 2005 Michael Kerrisk
2 .\" based on earlier work by faith@cs.unc.edu and
3 .\" Mike Battersby <mib@deakin.edu.au>
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" 2005-09-15, mtk, Created new page by splitting off from sigaction.2
26 .\"
27 .TH SIGPROCMASK 2 2012-04-15 "Linux" "Linux Programmer's Manual"
28 .SH NAME
29 sigprocmask \- examine and change blocked signals
30 .SH SYNOPSIS
31 .B #include <signal.h>
32 .sp
33 .BI "int sigprocmask(int " how ", const sigset_t *" set ,
34 .BI "sigset_t *" oldset );
35 .sp
36 .in -4n
37 Feature Test Macro Requirements for glibc (see
38 .BR feature_test_macros (7)):
39 .in
40 .sp
41 .ad l
42 .BR sigprocmask ():
43 _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE
44 .ad b
45 .SH DESCRIPTION
46 .BR sigprocmask ()
47 is used to fetch and/or change the signal mask of the calling thread.
48 The signal mask is the set of signals whose delivery is currently
49 blocked for the caller
50 (see also
51 .BR signal (7)
52 for more details).
53
54 The behavior of the call is dependent on the value of
55 .IR how ,
56 as follows.
57 .TP
58 .B SIG_BLOCK
59 The set of blocked signals is the union of the current set and the
60 .I set
61 argument.
62 .TP
63 .B SIG_UNBLOCK
64 The signals in
65 .I set
66 are removed from the current set of blocked signals.
67 It is permissible to attempt to unblock a signal which is not blocked.
68 .TP
69 .B SIG_SETMASK
70 The set of blocked signals is set to the argument
71 .IR set .
72 .PP
73 If
74 .I oldset
75 is non-NULL, the previous value of the signal mask is stored in
76 .IR oldset .
77
78 If
79 .I set
80 is NULL, then the signal mask is unchanged (i.e.,
81 .I how
82 is ignored),
83 but the current value of the signal mask is nevertheless returned in
84 .I oldset
85 (if it is not NULL).
86
87 The use of
88 .BR sigprocmask ()
89 is unspecified in a multithreaded process; see
90 .BR pthread_sigmask (3).
91 .SH "RETURN VALUE"
92 .BR sigprocmask ()
93 returns 0 on success and \-1 on error.
94 .SH ERRORS
95 .TP
96 .B EFAULT
97 the
98 .I set
99 or
100 .I oldset
101 argument points outside the process's allocated address space.
102 .TP
103 .B EINVAL
104 The value specified in
105 .I how
106 was invalid.
107 .SH "CONFORMING TO"
108 POSIX.1-2001.
109 .SH NOTES
110 It is not possible to block
111 .BR SIGKILL " or " SIGSTOP .
112 Attempts to do so are silently ignored.
113
114 Each of the threads in a process has its own signal mask.
115
116 A child created via
117 .BR fork (2)
118 inherits a copy of its parent's signal mask;
119 the signal mask is preserved across
120 .BR execve (2).
121
122 If
123 .BR SIGBUS ,
124 .BR SIGFPE ,
125 .BR SIGILL ,
126 or
127 .B SIGSEGV
128 are generated
129 while they are blocked, the result is undefined,
130 unless the signal was generated by
131 .BR kill (2),
132 .BR sigqueue (3),
133 or
134 .BR raise (3).
135 .PP
136 See
137 .BR sigsetops (3)
138 for details on manipulating signal sets.
139 .SH "SEE ALSO"
140 .BR kill (2),
141 .BR pause (2),
142 .BR sigaction (2),
143 .BR signal (2),
144 .BR sigpending (2),
145 .BR sigsuspend (2),
146 .BR pthread_sigmask (3),
147 .BR sigqueue (3),
148 .BR sigsetops (3),
149 .BR signal (7)