mount_setattr.2: Further tweaks after feedback from Christian Brauner
[man-pages.git] / man3 / sigwait.3
blobf05def412c760b9c5846f0a108913129122b134d
1 .\" Copyright (c) 2008, Linux Foundation, written by Michael Kerrisk
2 .\"     <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .TH SIGWAIT 3 2021-03-22 "Linux" "Linux Programmer's Manual"
27 .SH NAME
28 sigwait \- wait for a signal
29 .SH SYNOPSIS
30 .nf
31 .B #include <signal.h>
32 .PP
33 .BI "int sigwait(const sigset_t *restrict " set ", int *restrict " sig );
34 .fi
35 .PP
36 .RS -4
37 Feature Test Macro Requirements for glibc (see
38 .BR feature_test_macros (7)):
39 .RE
40 .PP
41 .BR sigwait ():
42 .nf
43     Since glibc 2.26:
44         _POSIX_C_SOURCE >= 199506L
45     Glibc 2.25 and earlier:
46         _POSIX_C_SOURCE
47 .fi
48 .SH DESCRIPTION
49 The
50 .BR sigwait ()
51 function suspends execution of the calling thread until
52 one of the signals specified in the signal set
53 .IR set
54 becomes pending.
55 The function accepts the signal
56 (removes it from the pending list of signals),
57 and returns the signal number in
58 .IR sig .
59 .PP
60 The operation of
61 .BR sigwait ()
62 is the same as
63 .BR sigwaitinfo (2),
64 except that:
65 .IP * 2
66 .BR sigwait ()
67 returns only the signal number, rather than a
68 .I siginfo_t
69 structure describing the signal.
70 .IP *
71 The return values of the two functions are different.
72 .SH RETURN VALUE
73 On success,
74 .BR sigwait ()
75 returns 0.
76 On error, it returns a positive error number (listed in ERRORS).
77 .SH ERRORS
78 .TP
79 .B EINVAL
80 .\" Does not occur for glibc.
81 .I set
82 contains an invalid signal number.
83 .SH ATTRIBUTES
84 For an explanation of the terms used in this section, see
85 .BR attributes (7).
86 .ad l
87 .nh
88 .TS
89 allbox;
90 lbx lb lb
91 l l l.
92 Interface       Attribute       Value
94 .BR sigwait ()
95 T}      Thread safety   MT-Safe
96 .TE
97 .hy
98 .ad
99 .sp 1
100 .SH CONFORMING TO
101 POSIX.1-2001, POSIX.1-2008.
102 .SH NOTES
103 .BR sigwait ()
104 is implemented using
105 .BR sigtimedwait (2).
107 The glibc implementation of
108 .BR sigwait ()
109 silently ignores attempts to wait for the two real-time signals that
110 are used internally by the NPTL threading implementation.
112 .BR nptl (7)
113 for details.
114 .SH EXAMPLES
116 .BR pthread_sigmask (3).
117 .SH SEE ALSO
118 .BR sigaction (2),
119 .BR signalfd (2),
120 .BR sigpending (2),
121 .BR sigsuspend (2),
122 .BR sigwaitinfo (2),
123 .BR sigsetops (3),
124 .BR signal (7)