aboutsummaryrefslogtreecommitdiffstats
path: root/man2/select_tut.2
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2020-02-18 11:14:45 +0100
committerMichael Kerrisk <mtk.manpages@gmail.com>2020-02-18 22:59:35 +0100
commitc9a275a703d37eea1724f12f95e0d592fbed79c3 (patch)
tree2c7d1c77744cde8a274c33eff38f61dffe820234 /man2/select_tut.2
parentb3b45b2b16bfb0eb29906cfeb9cea66f3cb79aab (diff)
downloadman-pages-c9a275a703d37eea1724f12f95e0d592fbed79c3.tar.gz
select_tut.2: DESCRIPTION: defer to select(2)
Avoid duplicating the same information in two pages. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Diffstat (limited to 'man2/select_tut.2')
-rw-r--r--man2/select_tut.2138
1 files changed, 9 insertions, 129 deletions
diff --git a/man2/select_tut.2 b/man2/select_tut.2
index eaad9cb117..f608a1f2fb 100644
--- a/man2/select_tut.2
+++ b/man2/select_tut.2
@@ -31,8 +31,7 @@
.\"
.TH SELECT_TUT 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.SH NAME
-select, pselect, FD_CLR, FD_ISSET, FD_SET, FD_ZERO \-
-synchronous I/O multiplexing
+select, pselect \- synchronous I/O multiplexing
.SH SYNOPSIS
.PP
See
@@ -46,135 +45,16 @@ to see if any of them is, or becomes, "ready";
that is, to see whether I/O becomes possible,
or an "exceptional condition" has occurred on any of the file descriptors.
.PP
-Its principal arguments are three "sets" of file descriptors:
-\fIreadfds\fP, \fIwritefds\fP, and \fIexceptfds\fP.
-Each set is declared as type
-.IR fd_set ,
-and its contents can be manipulated with the macros
-.BR FD_CLR (),
-.BR FD_ISSET (),
-.BR FD_SET (),
-and
-.BR FD_ZERO ().
-A newly declared set should first be cleared using
-.BR FD_ZERO ().
-.BR select ()
-modifies the contents of the sets according to the rules
-described below; after calling
-.BR select ()
-you can test if a file descriptor is still present in a set with the
-.BR FD_ISSET ()
-macro.
-.BR FD_ISSET ()
-returns nonzero if a specified file descriptor is present in a set
-and zero if it is not.
-.BR FD_CLR ()
-removes a file descriptor from a set.
-.SS Arguments
-.TP
-\fIreadfds\fP
-This set is watched to see if data is available for reading from any of
-its file descriptors.
-After
+This page provides background and tutorial information
+on the use of these system calls.
+For details of the arguments and semantics of
.BR select ()
-has returned, \fIreadfds\fP will be
-cleared of all file descriptors except for those that
-are immediately available for reading.
-.TP
-\fIwritefds\fP
-This set is watched to see if there is space to write data to any of
-its file descriptors.
-After
-.BR select ()
-has returned, \fIwritefds\fP will be
-cleared of all file descriptors except for those that
-are immediately available for writing.
-.TP
-\fIexceptfds\fP
-This set is watched for "exceptional conditions".
-In practice, only one such exceptional condition is common:
-the availability of \fIout-of-band\fP (OOB) data for reading
-from a TCP socket.
-See
-.BR recv (2),
-.BR send (2),
and
-.BR tcp (7)
-for more details about OOB data.
-(One other less common case where
-.BR select (2)
-indicates an exceptional condition occurs with pseudoterminals
-in packet mode; see
-.BR ioctl_tty (2).)
-After
-.BR select ()
-has returned,
-\fIexceptfds\fP will be cleared of all file descriptors except for those
-for which an exceptional condition has occurred.
-.TP
-\fInfds\fP
-This is an integer one more than the maximum of any file descriptor in
-any of the sets.
-In other words, while adding file descriptors to each of the sets,
-you must calculate the maximum integer value of all of them,
-then increment this value by one, and then pass this as \fInfds\fP.
-.TP
-\fIutimeout\fP
-This is the longest time
-.BR select ()
-may wait before returning, even if nothing interesting happened.
-If this value is passed as NULL, then
-.BR select ()
-blocks indefinitely waiting for a file descriptor to become ready.
-\fIutimeout\fP can be set to zero seconds, which causes
-.BR select ()
-to return immediately, with information about the readiness
-of file descriptors at the time of the call.
-The structure \fIstruct timeval\fP is defined as:
-.IP
-.in +4n
-.EX
-struct timeval {
- time_t tv_sec; /* seconds */
- long tv_usec; /* microseconds */
-};
-.EE
-.in
-.TP
-\fIntimeout\fP
-This argument for
-.BR pselect ()
-has the same meaning as
-.IR utimeout ,
-but
-.I "struct timespec"
-has nanosecond precision as follows:
-.IP
-.in +4n
-.EX
-struct timespec {
- long tv_sec; /* seconds */
- long tv_nsec; /* nanoseconds */
-};
-.EE
-.in
-.TP
-\fIsigmask\fP
-This argument holds a set of signals that the kernel should unblock
-(i.e., remove from the signal mask of the calling thread),
-while the caller is blocked inside the
-.BR pselect ()
-call (see
-.BR sigaddset (3)
-and
-.BR sigprocmask (2)).
-It may be NULL,
-in which case the call does not modify the signal mask on
-entry and exit to the function.
-In this case,
-.BR pselect ()
-will then behave just like
-.BR select ().
+.BR pselect (),
+see
+.BR select (2).
+.PP
+.\"
.SS Combining signal and data events
.BR pselect ()
is useful if you are waiting for a signal as well as