summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/select.2
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/sys/select.2')
-rw-r--r--lib/libc/sys/select.244
1 files changed, 26 insertions, 18 deletions
diff --git a/lib/libc/sys/select.2 b/lib/libc/sys/select.2
index 3de5b5e..c9a332dc 100644
--- a/lib/libc/sys/select.2
+++ b/lib/libc/sys/select.2
@@ -104,7 +104,7 @@ If
is a non-nil pointer, it specifies a maximum interval to wait for the
selection to complete. If
.Fa timeout
-is a nil pointer, the select blocks indefinitely. To affect a poll, the
+is a nil pointer, the select blocks indefinitely. To effect a poll, the
.Fa timeout
argument should be non-nil, pointing to a zero-valued timeval structure.
.Pp
@@ -140,6 +140,9 @@ before any of the selected events occurred.
.It Bq Er EINVAL
The specified time limit is invalid. One of its components is
negative or too large.
+.It Bq Er EINVAL
+.Fa nfds
+was invalid.
.El
.Sh SEE ALSO
.Xr accept 2 ,
@@ -149,26 +152,31 @@ negative or too large.
.Xr read 2 ,
.Xr recv 2 ,
.Xr send 2 ,
-.Xr write 2
-.Sh BUGS
-Although the provision of
-.Xr getdtablesize 2
-was intended to allow user programs to be written independent
-of the kernel limit on the number of open files, the dimension
-of a sufficiently large bit field for select remains a problem.
-The default size
+.Xr write 2 ,
+.Xr clocks 7
+.Sh NOTES
+The default size of
.Dv FD_SETSIZE
-(currently 256) is somewhat larger than
-the current kernel limit to the number of open files.
-However, in order to accommodate programs which might potentially
-use a larger number of open files with select, it is possible
-to increase this size within a program by providing
-a larger definition of
+is currently 256.
+In order to accomodate programs which might potentially
+use a larger number of open files with
+.Fn select
+, it is possible
+to increase this size by having the program define
.Dv FD_SETSIZE
-before the inclusion of
+before the inclusion of any header which includes
.Aq Pa sys/types.h .
.Pp
-.Fn Select
+If
+.Fa nfds
+is greater than the number of open files,
+.Fn select
+is not guaranteed to examine the unused file descriptors. For historical
+reasons,
+.Fn select
+will always examine the first 256 descriptors.
+.Sh BUGS
+.Fn select
should probably return the time remaining from the original timeout,
if any, by modifying the time value in place.
This may be implemented in future versions of the system.
@@ -178,6 +186,6 @@ by the
call.
.Sh HISTORY
The
-.Nm
+.Fn select
function call appeared in
.Bx 4.2 .
OpenPOWER on IntegriCloud