xref: /freebsd/lib/libsys/pselect.2 (revision a970610a3af63b3f4df5b69d91c6b4093a00ed8f)
1.\"
2.\" Copyright 2002 Massachusetts Institute of Technology
3.\"
4.\" Permission to use, copy, modify, and distribute this software and
5.\" its documentation for any purpose and without fee is hereby
6.\" granted, provided that both the above copyright notice and this
7.\" permission notice appear in all copies, that both the above
8.\" copyright notice and this permission notice appear in all
9.\" supporting documentation, and that the name of M.I.T. not be used
10.\" in advertising or publicity pertaining to distribution of the
11.\" software without specific, written prior permission.  M.I.T. makes
12.\" no representations about the suitability of this software for any
13.\" purpose.  It is provided "as is" without express or implied
14.\" warranty.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
17.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
18.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
20.\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
29.Dd July 2, 2022
30.Dt PSELECT 2
31.Os
32.Sh NAME
33.Nm pselect
34.Nd synchronous I/O multiplexing a la POSIX.1g
35.Sh LIBRARY
36.Lb libc
37.Sh SYNOPSIS
38.In sys/select.h
39.Ft int
40.Fo pselect
41.Fa "int nfds"
42.Fa "fd_set * restrict readfds"
43.Fa "fd_set * restrict writefds"
44.Fa "fd_set * restrict exceptfds"
45.Fa "const struct timespec * restrict timeout"
46.Fa "const sigset_t * restrict newsigmask"
47.Fc
48.Sh DESCRIPTION
49The
50.Fn pselect
51function was introduced by
52.St -p1003.1g-2000
53as a slightly stronger version of
54.Xr select 2 .
55The
56.Fa nfds , readfds , writefds ,
57and
58.Fa exceptfds
59arguments are all identical to the analogous arguments of
60.Fn select .
61The
62.Fa timeout
63argument in
64.Fn pselect
65points to a
66.Vt "const struct timespec"
67rather than the potentially modifiable
68.Vt "struct timeval"
69used by
70.Fn select ;
71as in
72.Fn select ,
73a null pointer may be passed to indicate that
74.Fn pselect
75should wait indefinitely.
76Finally,
77.Fa newsigmask
78specifies a signal mask which is set while waiting for input.
79When
80.Fn pselect
81returns, the original signal mask is restored.
82If
83.Fa newsigmask
84is a null pointer,
85.Fn pselect
86behaves like
87.Fn select
88with no setting or restoration of the signal mask.
89.Pp
90See
91.Xr select 2
92for a more detailed discussion of the semantics of this interface, and
93for macros used to manipulate the
94.Vt "fd_set"
95data type.
96.Sh RETURN VALUES
97The
98.Fn pselect
99function returns the same values and under the same conditions as
100.Fn select .
101.Sh ERRORS
102The
103.Fn pselect
104function may fail for any of the reasons documented for
105.Xr select 2
106and (if a signal mask is provided)
107.Xr sigprocmask 2 .
108.Sh SEE ALSO
109.Xr kqueue 2 ,
110.Xr poll 2 ,
111.Xr select 2 ,
112.Xr sigprocmask 2 ,
113.Xr sigsuspend 2
114.Sh STANDARDS
115The
116.Fn pselect
117function conforms to
118.St -p1003.1-2001 .
119.Sh HISTORY
120The
121.Fn pselect
122function first appeared in
123.Fx 5.0 .
124.Sh AUTHORS
125The first implementation of
126.Fn pselect
127function and this manual page were written by
128.An Garrett Wollman Aq Mt wollman@FreeBSD.org .
129