| 1 |
'\" t |
| 2 |
.\" Copyright 1994, Mike Battersby <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH SIGSETOPS 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
sigemptyset, sigfillset, sigaddset, sigdelset, sigismember \- POSIX |
| 10 |
signal set operations |
| 11 |
.SH LIBRARY |
| 12 |
Standard C library |
| 13 |
.RI ( libc ,\~ \-lc ) |
| 14 |
.SH SYNOPSIS |
| 15 |
.nf |
| 16 |
.B #include <signal.h> |
| 17 |
.P |
| 18 |
.BI "int sigemptyset(sigset_t *" set ); |
| 19 |
.BI "int sigfillset(sigset_t *" set ); |
| 20 |
.P |
| 21 |
.BI "int sigaddset(sigset_t *" set ", int " signum ); |
| 22 |
.BI "int sigdelset(sigset_t *" set ", int " signum ); |
| 23 |
.P |
| 24 |
.BI "int sigismember(const sigset_t *" set ", int " signum ); |
| 25 |
.fi |
| 26 |
.P |
| 27 |
.RS -4 |
| 28 |
Feature Test Macro Requirements for glibc (see |
| 29 |
.BR feature_test_macros (7)): |
| 30 |
.RE |
| 31 |
.P |
| 32 |
.BR sigemptyset (), |
| 33 |
.BR sigfillset (), |
| 34 |
.BR sigaddset (), |
| 35 |
.BR sigdelset (), |
| 36 |
.BR sigismember (): |
| 37 |
.nf |
| 38 |
_POSIX_C_SOURCE |
| 39 |
.fi |
| 40 |
.SH DESCRIPTION |
| 41 |
These functions allow the manipulation of POSIX signal sets. |
| 42 |
.P |
| 43 |
.BR sigemptyset () |
| 44 |
initializes the signal set given by |
| 45 |
.I set |
| 46 |
to empty, with all signals excluded from the set. |
| 47 |
.P |
| 48 |
.BR sigfillset () |
| 49 |
initializes |
| 50 |
.I set |
| 51 |
to full, including all signals. |
| 52 |
.P |
| 53 |
.BR sigaddset () |
| 54 |
and |
| 55 |
.BR sigdelset () |
| 56 |
add and delete respectively signal |
| 57 |
.I signum |
| 58 |
from |
| 59 |
.IR set . |
| 60 |
.P |
| 61 |
.BR sigismember () |
| 62 |
tests whether |
| 63 |
.I signum |
| 64 |
is a member of |
| 65 |
.IR set . |
| 66 |
.P |
| 67 |
Objects of type |
| 68 |
.I sigset_t |
| 69 |
must be initialized by a call to either |
| 70 |
.BR sigemptyset () |
| 71 |
or |
| 72 |
.BR sigfillset () |
| 73 |
before being passed to the functions |
| 74 |
.BR sigaddset (), |
| 75 |
.BR sigdelset (), |
| 76 |
and |
| 77 |
.BR sigismember () |
| 78 |
or the additional glibc functions described below |
| 79 |
.RB ( sigisemptyset (), |
| 80 |
.BR sigandset (), |
| 81 |
and |
| 82 |
.BR sigorset ()). |
| 83 |
The results are undefined if this is not done. |
| 84 |
.SH RETURN VALUE |
| 85 |
.BR sigemptyset (), |
| 86 |
.BR sigfillset (), |
| 87 |
.BR sigaddset (), |
| 88 |
and |
| 89 |
.BR sigdelset () |
| 90 |
return 0 on success and \-1 on error. |
| 91 |
.P |
| 92 |
.BR sigismember () |
| 93 |
returns 1 if |
| 94 |
.I signum |
| 95 |
is a member of |
| 96 |
.IR set , |
| 97 |
0 if |
| 98 |
.I signum |
| 99 |
is not a member, and \-1 on error. |
| 100 |
.P |
| 101 |
On error, these functions set |
| 102 |
.I errno |
| 103 |
to indicate the error. |
| 104 |
.SH ERRORS |
| 105 |
.TP |
| 106 |
.B EINVAL |
| 107 |
.I signum |
| 108 |
is not a valid signal. |
| 109 |
.SH ATTRIBUTES |
| 110 |
For an explanation of the terms used in this section, see |
| 111 |
.BR attributes (7). |
| 112 |
.TS |
| 113 |
allbox; |
| 114 |
lbx lb lb |
| 115 |
l l l. |
| 116 |
Interface Attribute Value |
| 117 |
T{ |
| 118 |
.na |
| 119 |
.nh |
| 120 |
.BR sigemptyset (), |
| 121 |
.BR sigfillset (), |
| 122 |
.BR sigaddset (), |
| 123 |
.BR sigdelset (), |
| 124 |
.BR sigismember (), |
| 125 |
.BR sigisemptyset (), |
| 126 |
.BR sigorset (), |
| 127 |
.BR sigandset () |
| 128 |
T} Thread safety MT-Safe |
| 129 |
.TE |
| 130 |
.SH VERSIONS |
| 131 |
.SS GNU |
| 132 |
If the |
| 133 |
.B _GNU_SOURCE |
| 134 |
feature test macro is defined, then |
| 135 |
.I <signal.h> |
| 136 |
exposes three other functions for manipulating signal |
| 137 |
sets: |
| 138 |
.P |
| 139 |
.nf |
| 140 |
.BI "int sigisemptyset(const sigset_t *" set ); |
| 141 |
.BI "int sigorset(sigset_t *" dest ", const sigset_t *" left , |
| 142 |
.BI " const sigset_t *" right ); |
| 143 |
.BI "int sigandset(sigset_t *" dest ", const sigset_t *" left , |
| 144 |
.BI " const sigset_t *" right ); |
| 145 |
.fi |
| 146 |
.P |
| 147 |
.BR sigisemptyset () |
| 148 |
returns 1 if |
| 149 |
.I set |
| 150 |
contains no signals, and 0 otherwise. |
| 151 |
.P |
| 152 |
.BR sigorset () |
| 153 |
places the union of the sets |
| 154 |
.I left |
| 155 |
and |
| 156 |
.I right |
| 157 |
in |
| 158 |
.IR dest . |
| 159 |
.BR sigandset () |
| 160 |
places the intersection of the sets |
| 161 |
.I left |
| 162 |
and |
| 163 |
.I right |
| 164 |
in |
| 165 |
.IR dest . |
| 166 |
Both functions return 0 on success, and \-1 on failure. |
| 167 |
.P |
| 168 |
These functions are nonstandard (a few other systems provide similar |
| 169 |
functions) and their use should be avoided in portable applications. |
| 170 |
.SH STANDARDS |
| 171 |
POSIX.1-2008. |
| 172 |
.SH HISTORY |
| 173 |
POSIX.1-2001. |
| 174 |
.SH NOTES |
| 175 |
When creating a filled signal set, the glibc |
| 176 |
.BR sigfillset () |
| 177 |
function does not include the two real-time signals used internally |
| 178 |
by the NPTL threading implementation. |
| 179 |
See |
| 180 |
.BR nptl (7) |
| 181 |
for details. |
| 182 |
.SH SEE ALSO |
| 183 |
.BR sigaction (2), |
| 184 |
.BR sigpending (2), |
| 185 |
.BR sigprocmask (2), |
| 186 |
.BR sigsuspend (2) |