| 1 |
'\" t |
| 2 |
.\" Copyright 2005, Michael Kerrisk <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH sigset 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
sigset, sighold, sigrelse, sigignore \- System V signal API |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <signal.h> |
| 16 |
.P |
| 17 |
.B "typedef typeof(void (int)) *sighandler_t;" |
| 18 |
.P |
| 19 |
.BI "[[deprecated]] sighandler_t sigset(int " sig ", sighandler_t " disp ); |
| 20 |
.P |
| 21 |
.BI "[[deprecated]] int sighold(int " sig ); |
| 22 |
.BI "[[deprecated]] int sigrelse(int " sig ); |
| 23 |
.BI "[[deprecated]] int sigignore(int " sig ); |
| 24 |
.fi |
| 25 |
.P |
| 26 |
.RS -4 |
| 27 |
Feature Test Macro Requirements for glibc (see |
| 28 |
.BR feature_test_macros (7)): |
| 29 |
.RE |
| 30 |
.P |
| 31 |
.BR sigset (), |
| 32 |
.BR sighold (), |
| 33 |
.BR sigrelse (), |
| 34 |
.BR sigignore (): |
| 35 |
.nf |
| 36 |
_XOPEN_SOURCE >= 500 |
| 37 |
.\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED |
| 38 |
.fi |
| 39 |
.SH DESCRIPTION |
| 40 |
These functions are provided in glibc as a compatibility interface |
| 41 |
for programs that make use of the historical System V signal API. |
| 42 |
This API is obsolete: new applications should use the POSIX signal API |
| 43 |
.RB ( sigaction (2), |
| 44 |
.BR sigprocmask (2), |
| 45 |
etc.) |
| 46 |
.P |
| 47 |
The |
| 48 |
.BR sigset () |
| 49 |
function modifies the disposition of the signal |
| 50 |
.IR sig . |
| 51 |
The |
| 52 |
.I disp |
| 53 |
argument can be the address of a signal handler function, |
| 54 |
or one of the following constants: |
| 55 |
.TP |
| 56 |
.B SIG_DFL |
| 57 |
Reset the disposition of |
| 58 |
.I sig |
| 59 |
to the default. |
| 60 |
.TP |
| 61 |
.B SIG_IGN |
| 62 |
Ignore |
| 63 |
.IR sig . |
| 64 |
.TP |
| 65 |
.B SIG_HOLD |
| 66 |
Add |
| 67 |
.I sig |
| 68 |
to the process's signal mask, but leave the disposition of |
| 69 |
.I sig |
| 70 |
unchanged. |
| 71 |
.P |
| 72 |
If |
| 73 |
.I disp |
| 74 |
specifies the address of a signal handler, then |
| 75 |
.I sig |
| 76 |
is added to the process's signal mask during execution of the handler. |
| 77 |
.P |
| 78 |
If |
| 79 |
.I disp |
| 80 |
was specified as a value other than |
| 81 |
.BR SIG_HOLD , |
| 82 |
then |
| 83 |
.I sig |
| 84 |
is removed from the process's signal mask. |
| 85 |
.P |
| 86 |
The dispositions for |
| 87 |
.B SIGKILL |
| 88 |
and |
| 89 |
.B SIGSTOP |
| 90 |
cannot be changed. |
| 91 |
.P |
| 92 |
The |
| 93 |
.BR sighold () |
| 94 |
function adds |
| 95 |
.I sig |
| 96 |
to the calling process's signal mask. |
| 97 |
.P |
| 98 |
The |
| 99 |
.BR sigrelse () |
| 100 |
function removes |
| 101 |
.I sig |
| 102 |
from the calling process's signal mask. |
| 103 |
.P |
| 104 |
The |
| 105 |
.BR sigignore () |
| 106 |
function sets the disposition of |
| 107 |
.I sig |
| 108 |
to |
| 109 |
.BR SIG_IGN . |
| 110 |
.SH RETURN VALUE |
| 111 |
On success, |
| 112 |
.BR sigset () |
| 113 |
returns |
| 114 |
.B SIG_HOLD |
| 115 |
if |
| 116 |
.I sig |
| 117 |
was blocked before the call, |
| 118 |
or the signal's previous disposition |
| 119 |
if it was not blocked before the call. |
| 120 |
On error, |
| 121 |
.BR sigset () |
| 122 |
returns \-1, with |
| 123 |
.I errno |
| 124 |
set to indicate the error. |
| 125 |
(But see BUGS below.) |
| 126 |
.P |
| 127 |
The |
| 128 |
.BR sighold (), |
| 129 |
.BR sigrelse (), |
| 130 |
and |
| 131 |
.BR sigignore () |
| 132 |
functions return 0 on success; on error, these functions return \-1 and set |
| 133 |
.I errno |
| 134 |
to indicate the error. |
| 135 |
.SH ERRORS |
| 136 |
For |
| 137 |
.BR sigset () |
| 138 |
see the ERRORS under |
| 139 |
.BR sigaction (2) |
| 140 |
and |
| 141 |
.BR sigprocmask (2). |
| 142 |
.P |
| 143 |
For |
| 144 |
.BR sighold () |
| 145 |
and |
| 146 |
.BR sigrelse () |
| 147 |
see the ERRORS under |
| 148 |
.BR sigprocmask (2). |
| 149 |
.P |
| 150 |
For |
| 151 |
.BR sigignore (), |
| 152 |
see the errors under |
| 153 |
.BR sigaction (2). |
| 154 |
.SH ATTRIBUTES |
| 155 |
For an explanation of the terms used in this section, see |
| 156 |
.BR attributes (7). |
| 157 |
.TS |
| 158 |
allbox; |
| 159 |
lbx lb lb |
| 160 |
l l l. |
| 161 |
Interface Attribute Value |
| 162 |
T{ |
| 163 |
.na |
| 164 |
.nh |
| 165 |
.BR sigset (), |
| 166 |
.BR sighold (), |
| 167 |
.BR sigrelse (), |
| 168 |
.BR sigignore () |
| 169 |
T} Thread safety MT-Safe |
| 170 |
.TE |
| 171 |
.SH STANDARDS |
| 172 |
POSIX.1-2008. |
| 173 |
.TP |
| 174 |
.I sighandler_t |
| 175 |
GNU. |
| 176 |
POSIX.1 uses the same type but without a |
| 177 |
.IR typedef . |
| 178 |
.SH HISTORY |
| 179 |
glibc 2.1. |
| 180 |
SVr4, POSIX.1-2001. |
| 181 |
POSIX.1-2008 marks these functions |
| 182 |
as obsolete, recommending the use of |
| 183 |
.BR sigaction (2), |
| 184 |
.BR sigprocmask (2), |
| 185 |
.BR pthread_sigmask (3), |
| 186 |
and |
| 187 |
.BR sigsuspend (2) |
| 188 |
instead. |
| 189 |
.SH NOTES |
| 190 |
The |
| 191 |
.BR sigset () |
| 192 |
function provides reliable signal handling semantics (as when calling |
| 193 |
.BR sigaction (2) |
| 194 |
with |
| 195 |
.I sa_mask |
| 196 |
equal to 0). |
| 197 |
.P |
| 198 |
On System V, the |
| 199 |
.BR signal () |
| 200 |
function provides unreliable semantics (as when calling |
| 201 |
.BR sigaction (2) |
| 202 |
with |
| 203 |
.I sa_mask |
| 204 |
equal to |
| 205 |
.IR "SA_RESETHAND | SA_NODEFER" ). |
| 206 |
On BSD, |
| 207 |
.BR signal () |
| 208 |
provides reliable semantics. |
| 209 |
POSIX.1-2001 leaves these aspects of |
| 210 |
.BR signal () |
| 211 |
unspecified. |
| 212 |
See |
| 213 |
.BR signal (2) |
| 214 |
for further details. |
| 215 |
.P |
| 216 |
In order to wait for a signal, |
| 217 |
BSD and System V both provided a function named |
| 218 |
.BR sigpause (3), |
| 219 |
but this function has a different argument on the two systems. |
| 220 |
See |
| 221 |
.BR sigpause (3) |
| 222 |
for details. |
| 223 |
.SH BUGS |
| 224 |
Before glibc 2.2, |
| 225 |
.BR sigset () |
| 226 |
did not unblock |
| 227 |
.I sig |
| 228 |
if |
| 229 |
.I disp |
| 230 |
was specified as a value other than |
| 231 |
.BR SIG_HOLD . |
| 232 |
.P |
| 233 |
Before glibc 2.5, |
| 234 |
.BR sigset () |
| 235 |
does not correctly return the previous disposition of the signal |
| 236 |
in two cases. |
| 237 |
First, if |
| 238 |
.I disp |
| 239 |
is specified as |
| 240 |
.BR SIG_HOLD , |
| 241 |
then a successful |
| 242 |
.BR sigset () |
| 243 |
always returns |
| 244 |
.BR SIG_HOLD . |
| 245 |
Instead, it should return the previous disposition of the signal |
| 246 |
(unless the signal was blocked, in which case |
| 247 |
.B SIG_HOLD |
| 248 |
should be returned). |
| 249 |
Second, if the signal is currently blocked, then |
| 250 |
the return value of a successful |
| 251 |
.BR sigset () |
| 252 |
should be |
| 253 |
.BR SIG_HOLD . |
| 254 |
Instead, the previous disposition of the signal is returned. |
| 255 |
These problems have been fixed since glibc 2.5. |
| 256 |
.\" See http://sourceware.org/bugzilla/show_bug.cgi?id=1951 |
| 257 |
.SH SEE ALSO |
| 258 |
.BR kill (2), |
| 259 |
.BR pause (2), |
| 260 |
.BR sigaction (2), |
| 261 |
.BR signal (2), |
| 262 |
.BR sigprocmask (2), |
| 263 |
.BR raise (3), |
| 264 |
.BR sigpause (3), |
| 265 |
.BR sigvec (3), |
| 266 |
.BR signal (7) |