pselect.2 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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
  49. The
  50. .Fn pselect
  51. function was introduced by
  52. .St -p1003.1g-2000
  53. as a slightly stronger version of
  54. .Xr select 2 .
  55. The
  56. .Fa nfds , readfds , writefds ,
  57. and
  58. .Fa exceptfds
  59. arguments are all identical to the analogous arguments of
  60. .Fn select .
  61. The
  62. .Fa timeout
  63. argument in
  64. .Fn pselect
  65. points to a
  66. .Vt "const struct timespec"
  67. rather than the potentially modifiable
  68. .Vt "struct timeval"
  69. used by
  70. .Fn select ;
  71. as in
  72. .Fn select ,
  73. a null pointer may be passed to indicate that
  74. .Fn pselect
  75. should wait indefinitely.
  76. Finally,
  77. .Fa newsigmask
  78. specifies a signal mask which is set while waiting for input.
  79. When
  80. .Fn pselect
  81. returns, the original signal mask is restored.
  82. If
  83. .Fa newsigmask
  84. is a null pointer,
  85. .Fn pselect
  86. behaves like
  87. .Fn select
  88. with no setting or restoration of the signal mask.
  89. .Pp
  90. See
  91. .Xr select 2
  92. for a more detailed discussion of the semantics of this interface, and
  93. for macros used to manipulate the
  94. .Vt "fd_set"
  95. data type.
  96. .Sh RETURN VALUES
  97. The
  98. .Fn pselect
  99. function returns the same values and under the same conditions as
  100. .Fn select .
  101. .Sh ERRORS
  102. The
  103. .Fn pselect
  104. function may fail for any of the reasons documented for
  105. .Xr select 2
  106. and (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
  115. The
  116. .Fn pselect
  117. function conforms to
  118. .St -p1003.1-2001 .
  119. .Sh HISTORY
  120. The
  121. .Fn pselect
  122. function first appeared in
  123. .Fx 5.0 .
  124. .Sh AUTHORS
  125. The first implementation of
  126. .Fn pselect
  127. function and this manual page were written by
  128. .An Garrett Wollman Aq Mt wollman@FreeBSD.org .