SIGPOLL

From Wikipedia, the free encyclopedia

SIGPOLL
Description Pollable event (Sys V); synonym of SIGIO
Default action Abnormal termination of the process
SA_SIGINFO macros
POLL_IN Data input available
POLL_OUT Output buffers available
POLL_MSG Input message available
POLL_ERR I/O error
POLL_PRI High priority input available
POLL_HUP Device disconnected

On POSIX-compliant platforms, SIGPOLL is the signal thrown by computer programs when asynchronous I/O event occurs. The symbolic constant for SIGPOLL is defined in the header file signal.h. Symbolic signal names are used because signal numbers can vary across platforms.

On Linux, SIGIO is a synonym for SIGPOLL.

[edit] Etymology

SIG is a common prefix for signal names. POLL refers to polling, in the context of the poll system call. IO stands for input/output.

[edit] Usage

As specified by POSIX, when the I_SETSIG operation is performed on a file descriptor with the ioctl system call, the kernel is instructed to signal the calling process when a pollable event (i.e. one which would interrupt the poll system call) occurs on the file descriptor; for example when input or output becomes possible. The signal sent may be user-specified, but defaults to SIGPOLL. By employing this mechanism, the user may accomplish true asynchronous I/O without the conceptual overhead of a multiplexing select loop. A possible disadvantage is that the technique lends itself to producing spaghetti code, with race conditions a danger.

From POSIX 1003.1 (2003), it is preferred to use the standardised system calls for asynchronous I/O defined in aio.h. These allow requests to be queued for asynchronous execution; return and error status can be retrieved with the aio_return and aio_error functions, respectively.


Languages