2001-08-13 16:33:00 +00:00
|
|
|
.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
|
2000-05-02 06:51:40 +00:00
|
|
|
.\" All rights reserved.
|
2001-07-15 07:53:42 +00:00
|
|
|
.\"
|
2000-05-02 06:51:40 +00:00
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice(s), this list of conditions and the following disclaimer as
|
|
|
|
.\" the first lines of this file unmodified other than the possible
|
|
|
|
.\" addition of one or more copyright notices.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice(s), this list of conditions and the following disclaimer in
|
|
|
|
.\" the documentation and/or other materials provided with the
|
|
|
|
.\" distribution.
|
2001-07-15 07:53:42 +00:00
|
|
|
.\"
|
2000-05-02 06:51:40 +00:00
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
|
|
|
|
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
|
|
|
|
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
|
|
|
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
|
|
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
|
|
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2001-07-15 07:53:42 +00:00
|
|
|
.\"
|
2000-05-02 06:51:40 +00:00
|
|
|
.\" $FreeBSD$
|
2004-07-03 23:14:34 +00:00
|
|
|
.\"
|
2005-11-17 13:00:00 +00:00
|
|
|
.Dd November 11, 2005
|
2004-01-14 21:22:10 +00:00
|
|
|
.Dt SIGWAIT 2
|
2000-05-02 06:51:40 +00:00
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm sigwait
|
|
|
|
.Nd select a set of signals
|
|
|
|
.Sh LIBRARY
|
2004-01-14 21:22:10 +00:00
|
|
|
.Lb libc
|
2000-05-02 06:51:40 +00:00
|
|
|
.Sh SYNOPSIS
|
2001-10-01 16:09:29 +00:00
|
|
|
.In signal.h
|
2000-05-02 06:51:40 +00:00
|
|
|
.Ft int
|
2002-10-02 10:53:44 +00:00
|
|
|
.Fn sigwait "const sigset_t * restrict set" "int * restrict sig"
|
2000-05-02 06:51:40 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Fn sigwait
|
2004-01-14 21:22:10 +00:00
|
|
|
system call selects a set of signals, specified by
|
2000-05-02 06:51:40 +00:00
|
|
|
.Fa set .
|
|
|
|
If none of the selected signals are pending,
|
|
|
|
.Fn sigwait
|
|
|
|
waits until one or more of the selected signals has been generated.
|
|
|
|
Then
|
|
|
|
.Fn sigwait
|
|
|
|
atomically clears one of the selected signals from the set of pending signals
|
|
|
|
for the process and sets the location pointed to by
|
|
|
|
.Fa sig
|
|
|
|
to the signal number that was cleared.
|
|
|
|
.Pp
|
|
|
|
The signals specified by
|
|
|
|
.Fa set
|
|
|
|
should be blocked at the time of the call to
|
|
|
|
.Fn sigwait .
|
2005-11-11 05:40:39 +00:00
|
|
|
.Pp
|
|
|
|
If more than one thread is using
|
|
|
|
.Fn sigwait
|
|
|
|
to wait for the same signal, no more than one of these threads will return from
|
|
|
|
.Fn sigwait
|
2005-11-17 13:00:00 +00:00
|
|
|
with the signal number.
|
|
|
|
If more than a single thread is blocked in
|
2005-11-11 05:40:39 +00:00
|
|
|
.Fn sigwait
|
|
|
|
for a signal when that signal is generated for the process, it is unspecified
|
|
|
|
which of the waiting threads returns from
|
|
|
|
.Fn sigwait .
|
|
|
|
If the signal is generated for a specific thread, as by
|
|
|
|
.Fn pthread_kill ,
|
|
|
|
only that thread will return.
|
|
|
|
.Pp
|
2005-11-17 13:00:00 +00:00
|
|
|
Should any of the multiple pending signals in the range
|
|
|
|
.Dv SIGRTMIN
|
|
|
|
to
|
|
|
|
.Dv SIGRTMAX
|
|
|
|
be
|
|
|
|
selected, it will be the lowest numbered one.
|
|
|
|
The selection order between realtime
|
2005-11-11 05:40:39 +00:00
|
|
|
and non-realtime signals, or between multiple pending non-realtime signals,
|
|
|
|
is unspecified.
|
2000-05-02 06:51:40 +00:00
|
|
|
.Sh RETURN VALUES
|
|
|
|
If successful,
|
|
|
|
.Fn sigwait
|
|
|
|
returns 0 and sets the location pointed to by
|
|
|
|
.Fa sig
|
|
|
|
to the cleared signal number.
|
|
|
|
Otherwise, an error number is returned.
|
|
|
|
.Sh ERRORS
|
2003-03-24 16:05:24 +00:00
|
|
|
The
|
2000-05-02 06:51:40 +00:00
|
|
|
.Fn sigwait
|
2004-01-14 21:22:10 +00:00
|
|
|
system call will fail if:
|
2000-05-02 06:51:40 +00:00
|
|
|
.Bl -tag -width Er
|
|
|
|
.It Bq Er EINVAL
|
2004-07-03 23:14:34 +00:00
|
|
|
The
|
2000-05-02 06:51:40 +00:00
|
|
|
.Fa set
|
2004-07-03 23:14:34 +00:00
|
|
|
argument
|
2000-05-02 06:51:40 +00:00
|
|
|
specifies one or more invalid signal numbers.
|
2005-11-11 05:40:39 +00:00
|
|
|
.It Bq Er EFAULT
|
|
|
|
Any arguments point outside the allocated address space or there is a
|
|
|
|
memory protection fault.
|
2000-05-02 06:51:40 +00:00
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr sigaction 2 ,
|
|
|
|
.Xr sigpending 2 ,
|
2005-11-17 13:00:00 +00:00
|
|
|
.Xr sigqueue 2 ,
|
2000-05-04 08:05:45 +00:00
|
|
|
.Xr sigsuspend 2 ,
|
2005-11-17 13:00:00 +00:00
|
|
|
.Xr sigtimedwait 2 ,
|
|
|
|
.Xr sigwaitinfo 2 ,
|
2000-05-04 08:05:45 +00:00
|
|
|
.Xr pause 3 ,
|
|
|
|
.Xr pthread_sigmask 3
|
2000-05-02 06:51:40 +00:00
|
|
|
.Sh STANDARDS
|
2003-03-24 16:05:24 +00:00
|
|
|
The
|
2000-05-02 06:51:40 +00:00
|
|
|
.Fn sigwait
|
2003-03-24 16:05:24 +00:00
|
|
|
function conforms to
|
2004-01-14 21:22:10 +00:00
|
|
|
.St -p1003.1-96 .
|