1 .\" Copyright (c) 1983, 1991 The Regents of the University of California.
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" $OpenBSD: sigsetmask.3,v 1.13 2007/05/31 19:19:27 jmc Exp $
30 .Dd $Mdocdate: May 31 2007 $
35 .Nd set current signal mask
37 .Fd #include <signal.h>
39 .Fn sigsetmask "int mask"
40 .Fn sigmask "int signum"
43 This interface is made obsoleted by:
48 sets the current signal mask.
49 Signals are blocked from delivery if the
54 is provided to construct the mask for a given
64 The previous set of masked signals is returned.
66 The following example utilizing
68 .Bd -literal -offset indent
71 omask = sigblock(sigmask(SIGINT) | sigmask(SIGHUP));
75 sigsetmask(omask & ~(sigmask(SIGINT) | sigmask(SIGHUP)));
78 Could be converted literally to:
79 .Bd -literal -offset indent
83 sigaddset(&set, SIGINT);
84 sigaddset(&set, SIGHUP);
85 sigprocmask(SIG_BLOCK, &set, &oset);
89 sigdelset(&oset, SIGINT);
90 sigdelset(&oset, SIGHUP);
91 sigprocmask(SIG_SETMASK, &oset, NULL);
94 Another, clearer, alternative is:
95 .Bd -literal -offset indent
99 sigaddset(&set, SIGINT);
100 sigaddset(&set, SIGHUP);
101 sigprocmask(SIG_BLOCK, &set, NULL);
105 sigprocmask(SIG_UNBLOCK, &set, NULL);
108 To completely clear the signal mask using
111 .Bd -literal -offset indent
112 (void) sigsetmask(0);
115 Which can be expressed via
118 .Bd -literal -offset indent
122 (void) sigprocmask(SIG_SETMASK, &eset, NULL);
135 function call appeared in
137 and has been deprecated.