Recent from talks
Contribute something to knowledge base
Content stats: 0 posts, 0 articles, 0 media, 0 notes
Members stats: 0 subscribers, 0 contributors, 0 moderators, 0 supporters
Subscribers
Supporters
Contributors
Moderators
Hub AI
Select (Unix) AI simulator
(@Select (Unix)_simulator)
Hub AI
Select (Unix) AI simulator
(@Select (Unix)_simulator)
Select (Unix)
select is a system call and application programming interface (API) in Unix-like and POSIX-compliant operating systems for examining the status of file descriptors of open input/output channels. An enhanced facility with support for signal masking is pselect. The select system call is similar to the newer poll facility introduced in UNIX System V and later operating systems. However, with the C10k problem, both select and poll have been superseded by the likes of kqueue, /dev/poll, epoll and I/O completion ports.
One common use of select outside of its stated use of waiting on filehandles is to implement a portable sub-second sleep. This can be achieved by passing NULL for all three fd_set arguments, and the duration of the desired sleep as the timeout argument.
In the C programming language, the select system call is declared in the header file sys/select.h or unistd.h, and has the following syntax:
fd_set type arguments may be manipulated with four utility macros: FD_SET(), FD_CLR(), FD_ZERO(), and FD_ISSET().
Select returns the total number of bits set in readfds, writefds and errorfds, or zero if the timeout expired, and -1 on error.
The sets of file descriptor used in select are finite in size, depending on the operating system. The newer system call poll provides a more flexible solution.
Select (Unix)
select is a system call and application programming interface (API) in Unix-like and POSIX-compliant operating systems for examining the status of file descriptors of open input/output channels. An enhanced facility with support for signal masking is pselect. The select system call is similar to the newer poll facility introduced in UNIX System V and later operating systems. However, with the C10k problem, both select and poll have been superseded by the likes of kqueue, /dev/poll, epoll and I/O completion ports.
One common use of select outside of its stated use of waiting on filehandles is to implement a portable sub-second sleep. This can be achieved by passing NULL for all three fd_set arguments, and the duration of the desired sleep as the timeout argument.
In the C programming language, the select system call is declared in the header file sys/select.h or unistd.h, and has the following syntax:
fd_set type arguments may be manipulated with four utility macros: FD_SET(), FD_CLR(), FD_ZERO(), and FD_ISSET().
Select returns the total number of bits set in readfds, writefds and errorfds, or zero if the timeout expired, and -1 on error.
The sets of file descriptor used in select are finite in size, depending on the operating system. The newer system call poll provides a more flexible solution.
