]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/sigwaitinfo.2
Fixed as per: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=222145
[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 .B #include <signal.h>
25 .sp
26 .BI "int sigwaitinfo(const sigset_t *" set ", siginfo_t *" info ");"
27 .sp
28 .BI "int sigtimedwait(const sigset_t *" set ", siginfo_t *" info ", "
29 .BI "const struct timespec *" timeout ");"
30 .SH DESCRIPTION
31 .BR sigwaitinfo ()
32 suspends execution of the calling process until one of the signals in
33 .I set
34 is delivered.
35 (If one of the signals in
36 .I set
37 is already pending for the calling process,
38 .BR sigwaitinfo ()
39 will return immediately with information about that signal.)
40
41 .BR sigwaitinfo ()
42 removes the delivered signal from the calling process's list of pending
43 signals and returns the signal number as its function result.
44 If the
45 .I info
46 argument is not
47 .BR NULL ,
48 then it returns a structure of type
49 .I siginfo_t
50 (see
51 .BR sigaction (2))
52 containing information about the signal.
53 .PP
54 Signals returned via
55 .BR sigwaitinfo ()
56 are delivered in the usual order; see
57 .BR signal (7)
58 for further details.
59 .PP
60 .BR sigtimedwait ()
61 operates in exactly the same way as
62 .BR sigwaitinfo ()
63 except that it has an additional argument,
64 .IR timeout ,
65 which enables an upper bound to be placed on the time for which
66 the process is suspended.
67 This argument is of the following type:
68 .sp
69 .in +2n
70 .nf
71 struct timespec {
72 long tv_sec; /* seconds */
73 long tv_nsec; /* nanoseconds */
74 }
75 .fi
76 .in -2n
77 .sp
78 If both fields of this structure are specified as 0, a poll is performed:
79 .BR sigtimedwait ()
80 returns immediately, either with information about a signal that
81 was pending for the caller, or with an error
82 if none of the signals in
83 .I set
84 was pending.
85 .SH "RETURN VALUE"
86 On success, both
87 .BR sigwaitinfo ()
88 and
89 .BR sigtimedwait ()
90 return a signal number (i.e., a value greater than zero).
91 On failure both calls return \-1, with
92 .I errno
93 set to indicate the error.
94 .SH ERRORS
95 .TP
96 .B EAGAIN
97 No signal in
98 .I set
99 was delivered within the
100 .I timeout
101 period specified to
102 .BR sigtimedwait ().
103 .TP
104 .B EINTR
105 The wait was interrupted by a signal handler.
106 (This handler was for a signal other than one of those in
107 .IR set .)
108 .TP
109 .B EINVAL
110 .I timeout
111 was invalid.
112 .SH NOTES
113 In normal usage, the caller blocks the signals in
114 .I set
115 via a prior call to
116 .BR sigprocmask ()
117 (so that the default disposition for these signals does not occur if they
118 are delivered between successive calls to
119 .BR sigwaitinfo () or
120 .BR sigtimedwait())
121 and does not establish handlers for these signals.
122 .PP
123 POSIX leaves the meaning of a
124 .B NULL
125 value for the
126 .I timeout
127 argument of
128 .BR sigtimedwait ()
129 unspecified, permitting the possibility that this has the same meaning
130 as a call to
131 .BR sigwaitinfo (),
132 and indeed this is what is done on Linux.
133 .SH "CONFORMING TO"
134 POSIX 1003.1-2001
135 .SH "SEE ALSO"
136 .BR kill (2),
137 .BR sigaction (2),
138 .BR signal (2),
139 .BR sigpending (2),
140 .BR sigprocmask (2),
141 .BR sigqueue (2),
142 .BR sigsetops (3),
143 .BR signal (7)