[Linux manuál]
Návod, kniha: POSIX Programmer's Manual
int pselect(int nfds, fd_set *restrict
readfds ,
fd_set *restrict
writefds , fd_set *restrict
errorfds ,
const struct timespec *restrict
timeout,
const sigset_t *restrict
sigmask);
int select(int nfds, fd_set *restrict
readfds ,
fd_set *restrict
writefds , fd_set *restrict
errorfds ,
struct timeval *restrict
timeout);
void FD_CLR(int fd, fd_set
*fdset );
int FD_ISSET(int fd, fd_set
*fdset );
void FD_SET(int fd, fd_set
*fdset );
void FD_ZERO(fd_set * fdset);
pselect, select: synchronní V / V multiplexování
Originální popis anglicky: pselect, select - synchronous I/O multiplexingNávod, kniha: POSIX Programmer's Manual
STRUČNĚ
#include <sys/select.h>POPIS / INSTRUKCE
The pselect() function shall examine the file descriptor sets whose addresses are passed in the readfds, writefds, and errorfds parameters to see whether some of their descriptors are ready for reading, are ready for writing, or have an exceptional condition pending, respectively. The select() function shall be equivalent to the pselect() function, except as follows:- *
- For the select() function, the timeout period is given in seconds and microseconds in an argument of type struct timeval, whereas for the pselect() function the timeout period is given in seconds and nanoseconds in an argument of type struct timespec.
- *
- The select() function has no sigmask argument; it shall behave as pselect() does when sigmask is a null pointer.
- *
- Upon successful completion, the select() function may modify the object pointed to by the timeout argument.
NÁVRATOVÁ HODNOTA
Upon successful completion, the pselect() and select() functions shall return the total number of bits set in the bit masks. Otherwise, -1 shall be returned, and errno shall be set to indicate the error. FD_CLR(), FD_SET(), and FD_ZERO() do not return a value. FD_ISSET() shall return a non-zero value if the bit for the file descriptor fd is set in the file descriptor set pointed to by fdset, and 0 otherwise.CHYBY / ERRORY
Under the following conditions, pselect() and select() shall fail and set errno to:- EBADF
- One or more of the file descriptor sets specified a file descriptor that is not a valid open file descriptor.
- EINTR
- The function was interrupted before any of the selected events occurred and before the timeout interval expired.
- EINVAL
- An invalid timeout interval was specified.
- EINVAL
- The nfds argument is less than 0 or greater than FD_SETSIZE.
- EINVAL
- One of the specified file descriptors refers to a STREAM or
multiplexer that is linked (directly or indirectly) downstream from a
multiplexer.
PŘÍKLADY POUŽITÍ
None.APPLICATION USAGE
None.RATIONALE
In previous versions of the Single UNIX Specification, the select() function was defined in the <sys/time.h> header. This is now changed to <sys/select.h>. The rationale for this change was as follows: the introduction of the pselect() function included the <sys/select.h> header and the <sys/select.h> header defines all the related definitions for the pselect() and select() functions. Backwards-compatibility to existing XSI implementations is handled by allowing <sys/time.h> to include <sys/select.h>.FUTURE DIRECTIONS
None.SOUVISEJÍCÍ
accept() , alarm() , connect() , fcntl() , poll() , read() , recvmsg() , sendmsg() , setitimer() , ualarm() , write() , the Base Definitions volume of IEEE Std 1003.1-2001, <sys/select.h>, <sys/time.h>COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .| 2003 | IEEE/The Open Group |