Debian Codegraph @

upstream/debian-trixie/man3/sigwait.3

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