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