User:Rob Kennedy/Signals
- This is not a real article. It’s here for testing changes to the signal-related articles.
Description: | Pollable event (Sys V) |
---|---|
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 a user wishes to interrupt the process. 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.
Etymology
[edit]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.
Usage
[edit]As specified by POSIX, when the F_SETSIG
operation is performed on a file descriptor with the fcntl
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.