Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man3c / sigwaitinfo.3c
blob1ecdb88c19ee8a07fc7d15d9dba0806bbb6bebd4
1 '\" te
2 .\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved.
3 .\" Copyright 1989 AT&T
4 .\" Portions Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
6 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
8 .\"  This notice shall appear on any product containing this material.
9 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
10 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
11 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
12 .TH SIGWAITINFO 3C "Feb 5, 2008"
13 .SH NAME
14 sigwaitinfo, sigtimedwait \- wait for queued signals
15 .SH SYNOPSIS
16 .LP
17 .nf
18 #include <signal.h>
20 \fBint\fR \fBsigwaitinfo\fR(\fBconst sigset_t *restrict\fR \fIset\fR,
21      \fBsiginfo_t *restrict\fR \fIinfo\fR);
22 .fi
24 .LP
25 .nf
26 \fBint\fR \fBsigtimedwait\fR(\fBconst sigset_t *restrict\fR \fIset\fR,
27      \fBsiginfo_t *restrict\fR \fIinfo\fR,
28      \fBconst struct timespec *restrict\fR \fItimeout\fR);
29 .fi
31 .SH DESCRIPTION
32 .sp
33 .LP
34 The  \fBsigwaitinfo()\fR function selects the pending signal from the set
35 specified by \fBset\fR. Should any of multiple pending signals in the range
36 \fBSIGRTMIN\fR to \fBSIGRTMAX\fR be selected, it will be the lowest numbered
37 one. The selection order between realtime and non-realtime signals, or between
38 multiple pending non-realtime signals, is unspecified. If no signal in
39 \fBset\fR is pending at the time of the call, the calling thread is suspended
40 until one or more signals in \fBset\fR become pending or until it is
41 interrupted by an unblocked, caught signal.
42 .sp
43 .LP
44 The  \fBsigwaitinfo()\fR function behaves the same as the \fBsigwait\fR(2)
45 function if the \fIinfo\fR argument is \fINULL\fR. If the \fIinfo\fR argument
46 is non-\fINULL\fR, the \fBsigwaitinfo()\fR function behaves the same as
47 \fBsigwait\fR(2), except that the selected signal number is stored in the
48 \fIsi_signo\fR member, and the cause of the signal is stored in the
49 \fIsi_code\fR member. If any value is queued to the selected signal, the first
50 such queued value is dequeued and, if the \fIinfo\fR argument is
51 non-\fINULL\fR, the value is stored in the \fIsi_value\fR member of \fIinfo\fR.
52 The system resource used to queue the signal will be released and made
53 available to queue other signals. If no value is queued, the content of the
54 \fIsi_value\fR member is undefined. If no further signals are queued for the
55 selected signal, the pending indication for that signal will be reset. If the
56 value of the \fBsi_code\fR member is \fBSI_NOINFO\fR, only the \fBsi_signo\fR
57 member of \fBsiginfo_t\fR is meaningful, and the value of all other members is
58 unspecified.
59 .sp
60 .LP
61 The  \fBsigtimedwait()\fR function behaves the same as \fBsigwaitinfo()\fR
62 except that if none of the signals specified by \fBset\fR are pending,
63 \fBsigtimedwait()\fR waits for the time interval specified in the
64 \fBtimespec\fR structure referenced by \fItimeout\fR. If the \fBtimespec\fR
65 structure pointed to by \fItimeout\fR is zero-valued and if none of the signals
66 specified by \fBset\fR are pending, then \fBsigtimedwait()\fR returns
67 immediately with an error. If \fItimeout\fR is the \fINULL\fR pointer, the
68 behavior is unspecified.
69 .sp
70 .LP
71 If, while \fBsigwaitinfo()\fR or \fBsigtimedwait()\fR is waiting, a signal
72 occurs which is eligible for delivery (that is, not blocked by the process
73 signal mask), that signal is handled asynchronously and the wait is
74 interrupted.
75 .SH RETURN VALUES
76 .sp
77 .LP
78 Upon successful completion (that is, one of the signals specified by \fIset\fR
79 is pending or is generated) \fBsigwaitinfo()\fR and \fBsigtimedwait()\fR will
80 return the selected signal number. Otherwise, the function returns \fB\(mi1\fR
81 and sets \fBerrno\fR to indicate the error.
82 .SH ERRORS
83 .sp
84 .LP
85 The \fBsigwaitinfo()\fR and \fBsigtimedwait()\fR functions will fail if:
86 .sp
87 .ne 2
88 .na
89 \fB\fBEINTR\fR\fR
90 .ad
91 .RS 10n
92 The wait was interrupted by an unblocked, caught signal.
93 .RE
95 .sp
96 .ne 2
97 .na
98 \fB\fBENOSYS\fR\fR
99 .ad
100 .RS 10n
101 The \fBsigwaitinfo()\fR and \fBsigtimedwait()\fR functions are not supported.
106 The \fBsigtimedwait()\fR function will fail if:
108 .ne 2
110 \fB\fBEAGAIN\fR\fR
112 .RS 10n
113 No signal specified by \fBset\fR was generated within the specified timeout
114 period.
119 The \fBsigwaitinfo()\fR and \fBsigtimedwait()\fR functions may fail if:
121 .ne 2
123 \fB\fBEFAULT\fR\fR
125 .RS 10n
126 The \fIset\fR, \fIinfo\fR, or \fItimeout\fR argument points to an invalid
127 address.
132 The \fBsigtimedwait()\fR function may fail if:
134 .ne 2
136 \fB\fBEINVAL\fR\fR
138 .RS 10n
139 The \fItimeout\fR argument specified a \fBtv_nsec\fR value less than zero or
140 greater than or equal to 1000 million. The system only checks for this error if
141 no signal is pending in \fIset\fR and it is necessary to wait.
144 .SH ATTRIBUTES
147 See \fBattributes\fR(5) for descriptions of the following attributes:
152 box;
153 c | c
154 l | l .
155 ATTRIBUTE TYPE  ATTRIBUTE VALUE
157 Interface Stability     Committed
159 MT-Level        Async-Safe
161 Standard        See \fBstandards\fR(5).
164 .SH SEE ALSO
167 \fBtime\fR(2), \fBsigqueue\fR(3C), \fBsiginfo.h\fR(3HEAD),
168 \fBsignal.h\fR(3HEAD), \fBtime.h\fR(3HEAD), \fBattributes\fR(5),
169 \fBstandards\fR(5)