Debian Codegraph @

upstream/debian-unstable/man3/sigwait.3

raw
1 '\" t
2 .\" Copyright, the authors of the Linux man-pages project
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .TH sigwait 3 2025-05-17 "Linux man-pages 6.18"
7 .SH NAME
8 sigwait \- wait for a signal
9 .SH LIBRARY
10 Standard C library
11 .RI ( libc ,\~ \-lc )
12 .SH SYNOPSIS
13 .nf
14 .B #include <signal.h>
15 .P
16 .BI "int sigwait(const sigset_t *restrict " set ", int *restrict " sig );
17 .fi
18 .P
19 .RS -4
20 Feature Test Macro Requirements for glibc (see
21 .BR feature_test_macros (7)):
22 .RE
23 .P
24 .BR sigwait ():
25 .nf
26 Since glibc 2.26:
27 _POSIX_C_SOURCE >= 199506L
28 glibc 2.25 and earlier:
29 _POSIX_C_SOURCE
30 .fi
31 .SH DESCRIPTION
32 The
33 .BR sigwait ()
34 function suspends execution of the calling thread until
35 one of the signals specified in the signal set
36 .I set
37 becomes pending.
38 For a signal to become pending,
39 it must first be blocked with
40 .BR sigprocmask (2).
41 The function accepts the signal
42 (removes it from the pending list of signals),
43 and returns the signal number in
44 .IR sig .
45 .P
46 The operation of
47 .BR sigwait ()
48 is the same as
49 .BR sigwaitinfo (2),
50 except that:
51 .IP \[bu] 3
52 .BR sigwait ()
53 returns only the signal number, rather than a
54 .I siginfo_t
55 structure describing the signal.
56 .IP \[bu]
57 The return values of the two functions are different.
58 .SH RETURN VALUE
59 On success,
60 .BR sigwait ()
61 returns 0.
62 On error, it returns a positive error number (listed in ERRORS).
63 .SH ERRORS
64 .TP
65 .B EINVAL
66 .\" Does not occur for glibc.
67 .I set
68 contains an invalid signal number.
69 .SH ATTRIBUTES
70 For an explanation of the terms used in this section, see
71 .BR attributes (7).
72 .TS
73 allbox;
74 lbx lb lb
75 l l l.
76 Interface Attribute Value
77 T{
78 .na
79 .nh
80 .BR sigwait ()
81 T} Thread safety MT-Safe
82 .TE
83 .SH VERSIONS
84 .BR sigwait ()
85 is implemented using
86 .BR sigtimedwait (2);
87 consult its
88 .BR NOTES .
89 .P
90 The glibc implementation of
91 .BR sigwait ()
92 silently ignores attempts to wait for the two real-time signals that
93 are used internally by the NPTL threading implementation.
94 See
95 .BR nptl (7)
96 for details.
97 .SH STANDARDS
98 POSIX.1-2008.
99 .SH HISTORY
100 POSIX.1-2001.
101 .SH EXAMPLES
102 See
103 .BR pthread_sigmask (3).
104 .SH SEE ALSO
105 .BR sigaction (2),
106 .BR signalfd (2),
107 .BR sigpending (2),
108 .BR sigsuspend (2),
109 .BR sigwaitinfo (2),
110 .BR sigsetops (3),
111 .BR signal (7)