Node:Interrupt Input, Next:IOCTLs, Previous:File Locks, Up:Low-Level I/O
If you set the O_ASYNC status flag on a file descriptor
(see File Status Flags), a SIGIO signal is sent whenever
input or output becomes possible on that file descriptor. The process
or process group to receive the signal can be selected by using the
F_SETOWN command to the fcntl function. If the file
descriptor is a socket, this also selects the recipient of SIGURG
signals that are delivered when out-of-band data arrives on that socket;
see Out-of-Band Data. (SIGURG is sent in any situation
where select would report the socket as having an "exceptional
condition". See Waiting for I/O.)
If the file descriptor corresponds to a terminal device, then SIGIO
signals are sent to the foreground process group of the terminal.
See Job Control.
The symbols in this section are defined in the header file
fcntl.h.
| int F_GETOWN | Macro |
This macro is used as the command argument to fcntl, to
specify that it should get information about the process or process
group to which SIGIO signals are sent. (For a terminal, this is
actually the foreground process group ID, which you can get using
tcgetpgrp; see Terminal Access Functions.)
The return value is interpreted as a process ID; if negative, its absolute value is the process group ID. The following
|
| int F_SETOWN | Macro |
This macro is used as the command argument to fcntl, to
specify that it should set the process or process group to which
SIGIO signals are sent. This command requires a third argument
of type pid_t to be passed to fcntl, so that the form of
the call is:
fcntl (filedes, F_SETOWN, pid) The pid argument should be a process ID. You can also pass a negative number whose absolute value is a process group ID. The return value from
|