81 lines
2.9 KiB
HTML
81 lines
2.9 KiB
HTML
<html><!-- This HTML file has been created by texi2html 1.29
|
|
from syscalls.texi on 4 June 1994 -->
|
|
|
|
<TITLE>Syscall specifications of Linux - select</TITLE>
|
|
<P>Go to the <A HREF="syscalls_28.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_28.html">previous</A>, <A HREF="syscalls_30.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_30.html">next</A> section.<P>
|
|
<H2><A NAME="SEC29" HREF="syscalls_toc.html#SEC29" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_toc.html#SEC29">select</A></H2>
|
|
<P>
|
|
<H3>SYNOPSIS</H3>
|
|
<P>
|
|
<CODE>int select(int <VAR>numfds</VAR>, fd_set *<VAR>readfds</VAR>, fd_set
|
|
*<VAR>writefds</VAR>, fd_set *<VAR>exceptfds</VAR>, struct timeval *<VAR>timeout</VAR>);</CODE>
|
|
<P>
|
|
Macro utilities:
|
|
<P>
|
|
<CODE>FD_CLR(int <VAR>fd</VAR>, fd_set *<VAR>set</VAR>);</CODE>
|
|
<P>
|
|
<CODE>FD_ISSET(int <VAR>fd</VAR>, fd_set *<VAR>set</VAR>);</CODE>
|
|
<P>
|
|
<CODE>FD_SET(int <VAR>fd</VAR>, fd_set *<VAR>set</VAR>);</CODE>
|
|
<P>
|
|
<CODE>FD_ZERO(fd_set *<VAR>set</VAR>);</CODE>
|
|
<P>
|
|
<H3>PARAMETERS</H3>
|
|
<P>
|
|
<VAR>numfds</VAR>: [in] the number of file descriptors to watch.
|
|
<P>
|
|
<VAR>readfds</VAR>: [in out] on entry, the file descriptor to watch for
|
|
readability. On exit, the file descriptors that are readable.
|
|
<P>
|
|
<VAR>writefds</VAR>: [in out] on entry, the file descriptors to watch for
|
|
writability. On exit, the file descriptors that are writable.
|
|
<P>
|
|
<VAR>exceptfds</VAR>: [in out] on entry, the file descriptor to watch
|
|
exceptions. On exit, the file descriptors have exceptions raised.
|
|
<P>
|
|
<VAR>timeout</VAR>: [in out] on entry, the timeout value. On return, contains
|
|
the remaining time.
|
|
<P>
|
|
<H3>DESCRIPTION</H3>
|
|
<P>
|
|
Makes the calling task sleep until some conditions on the file
|
|
descriptors become true or until a timeout value expires. There are
|
|
three conditions for which files may be tested:
|
|
<P>
|
|
<UL>
|
|
<LI>with <VAR>readfds</VAR>: Can the file be read?
|
|
<LI>with <VAR>writefds</VAR>: Can the file be written?
|
|
<LI>with <VAR>exceptfds</VAR>: Is there any exception pending on the file?
|
|
</UL>
|
|
<P>
|
|
Whenever one of the conditions on one the specified files is true, the
|
|
call returns.
|
|
<P>
|
|
There are four utilities provided for manipulation of the file
|
|
descriptor sets:
|
|
<P>
|
|
<DL COMPACT>
|
|
<DT><CODE>FD_SET</CODE>
|
|
<DD>sets the specified file descriptor flag.
|
|
<P>
|
|
<DT><CODE>FD_CLR</CODE>
|
|
<DD>clears the specified file descriptor flag.
|
|
<P>
|
|
<DT><CODE>FD_ZERO</CODE>
|
|
<DD>clears the set.
|
|
<P>
|
|
<DT><CODE>FD_ISSET</CODE>
|
|
<DD>returns true if the file descriptor flag is set.
|
|
</DL>
|
|
<P>
|
|
<H3>RETURN VALUE</H3>
|
|
<P>
|
|
On success, returns zero. On error, returns -1 and sets <CODE>errno</CODE> to
|
|
one of the following value:
|
|
<P>
|
|
<UL>
|
|
<LI><CODE>EBADF</CODE>, <CODE>EINTR</CODE>, <CODE>EINVAL</CODE> or <CODE>ENOMEM</CODE>
|
|
</UL>
|
|
<P>
|
|
<P>Go to the <A HREF="syscalls_28.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_28.html">previous</A>, <A HREF="syscalls_30.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_30.html">next</A> section.<P>
|