Notification (SIGIO)
When an asynchronous I/O call returns successfully, the I/O operation
has only been queued and waits to be done. The actual operation has a return
value and a potential error identifier. This return value and potential error
identifier would have been returned to the caller if the call had been synchronous.
When the I/O is finished, both the return and error values are stored at a
location given by the user at the time of the request as a pointer to an aio_result_t
. The structure of the aio_result_t
is
defined in <sys/asynch.h>
:
typedef struct aio_result_t { ssize_t aio_return; /* return value of read or write */ int aio_errno; /* errno generated by the IO */ } aio_result_t;
When the aio_result_t
has been updated, a SIGIO signal
is delivered to the process that made the I/O request.
Note that a process with two or more asynchronous I/O operations pending has no certain way to determine the cause of the SIGIO signal. A process that receives a SIGIO should check all its conditions that could be generating the SIGIO signal.