8815 mega_sas: variable set but not used
[unleashed.git] / usr / src / man / man2 / sigprocmask.2
blobc6d25af2bfed3044400363f32182cb13c520482a
1 '\" te
2 .\" Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
3 .\" Copyright 1989 AT&T.  Copyright (c) 2005, Sun Microsystems, Inc.  All Rights Reserved.
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH SIGPROCMASK 2 "Nov 24, 2014"
8 .SH NAME
9 sigprocmask \- change or examine caller's signal mask
10 .SH SYNOPSIS
11 .LP
12 .nf
13 #include <signal.h>
15 \fBint\fR \fBsigprocmask\fR(\fBint\fR \fIhow\fR, \fBconst sigset_t *restrict\fR \fIset\fR,
16      \fBsigset_t *restrict\fR \fIoset\fR);
17 .fi
19 .SH DESCRIPTION
20 .LP
21 The \fBsigprocmask()\fR function is used to examine and/or change the caller's
22 signal mask. If the value of the \fIhow\fR argument is \fBSIG_BLOCK\fR, the set
23 pointed to by the \fIset\fR argument is added to the current signal mask. If
24 the value of the \fIhow\fR argument is \fBSIG_UNBLOCK\fR, the set pointed by
25 the \fIset\fR argument is removed from the current signal mask. If the value of
26 the \fIhow\fR argument is \fBSIG_SETMASK\fR, the current signal mask is
27 replaced by the set pointed to by the \fIset\fR argument. If the \fIoset\fR
28 argument is not \fINULL\fR, the previous mask is stored in the space pointed to
29 by \fIoset\fR. If the value of the  \fIset\fR argument is \fINULL\fR, the value
30 \fIhow\fR is not significant and the caller's signal mask is unchanged; thus,
31 the call can be used to inquire about currently blocked signals. If the
32 \fIset\fR or \fIoset\fR argument points to an invalid address, the behavior is
33 undefined and \fBerrno\fR may be set to \fBEFAULT\fR.
34 .sp
35 .LP
36 If there are any pending unblocked signals after the call to
37 \fBsigprocmask()\fR, at least one of those signals will be delivered before the
38 call to \fBsigprocmask()\fR returns.
39 .sp
40 .LP
41 It is not possible to block signals that cannot be caught or ignored (see
42 \fBsigaction\fR(2)). It is also not possible to block or unblock SIGCANCEL, as
43 SIGCANCEL is reserved for the implementation of POSIX thread cancellation (see
44 \fBpthread_cancel\fR(3C) and \fBcancellation\fR(5)). This restriction is
45 silently enforced by the standard C library.
46 .sp
47 .LP
48 If \fBsigprocmask()\fR fails, the caller's signal mask is not changed.
49 .SH RETURN VALUES
50 .LP
51 Upon successful completion, \fB0\fR is returned. Otherwise, \fB\(mi1\fR is
52 returned and \fBerrno\fR is set to indicate the error.
53 .SH ERRORS
54 .LP
55 The \fBsigprocmask()\fR function will fail if:
56 .sp
57 .ne 2
58 .na
59 \fB\fBEINVAL\fR\fR
60 .ad
61 .RS 10n
62 The value of the \fIhow\fR argument is not equal to one of the defined values.
63 .RE
65 .sp
66 .LP
67 The \fBsigprocmask()\fR function may fail if:
68 .sp
69 .ne 2
70 .na
71 \fB\fBEFAULT\fR\fR
72 .ad
73 .RS 10n
74 The \fIset\fR or \fIoset\fR argument points to an illegal address.
75 .RE
77 .SH ATTRIBUTES
78 .LP
79 See \fBattributes\fR(5) for descriptions of the following attributes:
80 .sp
82 .sp
83 .TS
84 box;
85 c | c
86 l | l .
87 ATTRIBUTE TYPE  ATTRIBUTE VALUE
89 Interface Stability     Standard
91 MT-Level        Async-Signal-Safe
92 .TE
94 .SH SEE ALSO
95 .LP
96 \fBsigaction\fR(2), \fBpthread_cancel\fR(3C), \fBpthread_sigmask\fR(3C),
97 \fBsignal\fR(3C), \fBsignal.h\fR(3HEAD), \fBsigsetops\fR(3C),
98 \fBattributes\fR(5), \fBcancellation\fR(5)
99 .SH NOTES
101 The call to \fBsigprocmask()\fR affects only the calling thread's signal mask.
102 It is identical to a call to \fBpthread_sigmask\fR(3C).
105 Signals that are generated synchronously should not be masked. If such a signal
106 is blocked and delivered, the receiving process is killed.