]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/sigwaitinfo.2
Updated CONFORMING TO section
[thirdparty/man-pages.git] / man2 / sigwaitinfo.2
1 .\" Copyright (c) 2002 Michael kerrisk <mtk-manpages@gmx.net>
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.
16 .\"
17 .\" Formatted or processed versions of this manual, if unaccompanied by
18 .\" the source, must acknowledge the copyright and authors of this work.
19 .\"
20 .TH SIGWAITINFO 2 2002-06-07 "Linux 2.4.18" "Linux Programmer's Manual"
21 .SH NAME
22 sigwaitinfo, sigtimedwait \- synchronously wait for queued signals
23 .SH SYNOPSIS
24 .nf
25 .B #include <signal.h>
26 .sp
27 .BI "int sigwaitinfo(const sigset_t *" set ", siginfo_t *" info ");"
28 .sp
29 .BI "int sigtimedwait(const sigset_t *" set ", siginfo_t *" info ", "
30 .BI " const struct timespec *" timeout ");"
31 .fi
32 .SH DESCRIPTION
33 .BR sigwaitinfo ()
34 suspends execution of the calling process until one of the signals in
35 .I set
36 is delivered.
37 (If one of the signals in
38 .I set
39 is already pending for the calling process,
40 .BR sigwaitinfo ()
41 will return immediately with information about that signal.)
42
43 .BR sigwaitinfo ()
44 removes the delivered signal from the calling process's list of pending
45 signals and returns the signal number as its function result.
46 If the
47 .I info
48 argument is not NULL,
49 then it returns a structure of type
50 .I siginfo_t
51 (see
52 .BR sigaction (2))
53 containing information about the signal.
54 .PP
55 Signals returned via
56 .BR sigwaitinfo ()
57 are delivered in the usual order; see
58 .BR signal (7)
59 for further details.
60 .PP
61 .BR sigtimedwait ()
62 operates in exactly the same way as
63 .BR sigwaitinfo ()
64 except that it has an additional argument,
65 .IR timeout ,
66 which enables an upper bound to be placed on the time for which
67 the process is suspended.
68 This argument is of the following type:
69 .sp
70 .in +2n
71 .nf
72 struct timespec {
73 long tv_sec; /* seconds */
74 long tv_nsec; /* nanoseconds */
75 }
76 .fi
77 .in -2n
78 .sp
79 If both fields of this structure are specified as 0, a poll is performed:
80 .BR sigtimedwait ()
81 returns immediately, either with information about a signal that
82 was pending for the caller, or with an error
83 if none of the signals in
84 .I set
85 was pending.
86 .SH "RETURN VALUE"
87 On success, both
88 .BR sigwaitinfo ()
89 and
90 .BR sigtimedwait ()
91 return a signal number (i.e., a value greater than zero).
92 On failure both calls return \-1, with
93 .I errno
94 set to indicate the error.
95 .SH ERRORS
96 .TP
97 .B EAGAIN
98 No signal in
99 .I set
100 was delivered within the
101 .I timeout
102 period specified to
103 .BR sigtimedwait ().
104 .TP
105 .B EINTR
106 The wait was interrupted by a signal handler.
107 (This handler was for a signal other than one of those in
108 .IR set .)
109 .TP
110 .B EINVAL
111 .I timeout
112 was invalid.
113 .SH NOTES
114 In normal usage, the calling program blocks the signals in
115 .I set
116 via a prior call to
117 .BR sigprocmask ()
118 (so that the default disposition for these signals does not occur if they
119 are delivered between successive calls to
120 .BR sigwaitinfo ()
121 or
122 .BR sigtimedwait ())
123 and does not establish handlers for these signals.
124 In a multithreaded program,
125 the signal should be blocked in all threads to prevent
126 the signal being delivered to a thread other than the one calling
127 .BR sigwaitinfo ()
128 or
129 .BR sigtimedwait ()).
130 .PP
131 POSIX leaves the meaning of a NULL value for the
132 .I timeout
133 argument of
134 .BR sigtimedwait ()
135 unspecified, permitting the possibility that this has the same meaning
136 as a call to
137 .BR sigwaitinfo (),
138 and indeed this is what is done on Linux.
139 .SH "CONFORMING TO"
140 POSIX.1-2001
141 .SH "SEE ALSO"
142 .BR kill (2),
143 .BR sigaction (2),
144 .BR signal (2),
145 .BR sigpending (2),
146 .BR sigprocmask (2),
147 .BR sigqueue (2),
148 .BR sigsetops (3),
149 .BR signal (7)