aio_read(2)aio_read(2)NAMEaio_read() - start an asynchronous read operation
SYNOPSISDESCRIPTION
The function allows the calling process to perform an asynchronous read
from a previously opened file. The function call returns when the read
operation has been enqueued for processing. At this point, processing
of the read operation may proceed concurrently with execution of the
calling process or thread.
If an error condition is detected that prevents the read request from
being enqueued, returns and sets to indicate the cause of the failure.
Once the read operation has been successfully enqueued, an and function
referencing the referred to by must be used to determine its status and
any error conditions, including those normally reported by The request
remains enqueued and consumes process and system resources until is
called.
The function allows the calling process to read from the file associ‐
ated with into the buffer pointed to by The priority of the read opera‐
tion is reduced by the value of which must be a value between 0 (zero)
and a maximum value which can be obtained using the call with the argu‐
ment A value of 0 (zero) yields no reduction in priority. The field is
ignored.
The read operation takes place at the absolute position in the file
given by as if were called immediately prior to the operation with
equal to and set to However, the value of the file offset is never
changed by asynchronous I/O operations.
Deallocating or altering the contents of memory referred to by while an
asynchronous read operation is outstanding (i.e. before has been
called) may produce unpredictable results.
If is a valid signal event structure, then the designated signal will
be delivered when the requested asynchronous read operation completes.
To use this function, link in the realtime library by specifying on the
compiler or linker command line.
RETURN VALUE
returns the following values:
Successful completion, the operation has been enqueued.
Failure. The requested operation was not enqueued. is set
to indicate the error.
The return value from reflects the success or failure of enqueuing the
requested read operation for asynchronous processing. fails if an
error in the function call is immediately detected, or if system
resource limits prevent the request from being enqueued. Other error
conditions are reported asynchronously and must be retrieved with and
ERRORS
If detects one of the following error conditions, is set to the indi‐
cated value:
The request could not be queued either because of a resource
shortage
or because the per-process or system-wide limit
on asynchronous I/O operations or asynchronous
threads would have been exceeded.
is not a valid address in the process virtual address space.
The parameters of the indicated
in are invalid.
The is already in use for another asynchronous I/O
operation.
Once the read request has been enqueued by the following errors, in
addition to all of the errors normally reported by the function, may be
reported asynchronously by a subsequent call to or referencing its
The was not a valid file descriptor open for reading.
The value of is not valid.
The value of is invalid.
The file offset implied by
or are not valid for the file at the time the
request is processed.
The read operation was canceled due to a subsequent
call to
EXAMPLES
The following code sequence and call to starts an asynchronous read
operation.
SEE ALSOaio_cancel(2), aio_error(2), aio_fsync(2), aio_return(2), aio_sus‐
pend(2), aio_write(2), lio_listio(2), read(2), aio(5).
STANDARDS CONFORMANCEaio_read(2)