AIO_READ(3)                POSIX Programmer's Manual               AIO_READ(3)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.


NNAAMMEE
       aio_read -- asynchronous read from a file

SSYYNNOOPPSSIISS
       #include <aio.h>

       int aio_read(struct aiocb *_a_i_o_c_b_p);

DDEESSCCRRIIPPTTIIOONN
       The _a_i_o___r_e_a_d() function shall read _a_i_o_c_b_p->_a_i_o___n_b_y_t_e_s from the file
       associated with _a_i_o_c_b_p->_a_i_o___f_i_l_d_e_s into the buffer pointed to by
       _a_i_o_c_b_p->_a_i_o___b_u_f. The function call shall return when the read request
       has been initiated or queued to the file or device (even when the data
       cannot be delivered immediately).

       If prioritized I/O is supported for this file, then the asynchronous
       operation shall be submitted at a priority equal to a base scheduling
       priority minus _a_i_o_c_b_p->_a_i_o___r_e_q_p_r_i_o. If Thread Execution Scheduling is
       not supported, then the base scheduling priority is that of the calling
       process;
       otherwise, the base scheduling priority is that of the calling thread.

       The _a_i_o_c_b_p value may be used as an argument to _a_i_o___e_r_r_o_r() and
       _a_i_o___r_e_t_u_r_n() in order to determine the error status and return status,
       respectively, of the asynchronous operation while it is proceeding. If
       an error condition is encountered during queuing, the function call
       shall return without having initiated or queued the request. The
       requested operation takes place at the absolute position in the file as
       given by _a_i_o___o_f_f_s_e_t, as if _l_s_e_e_k() were called immediately prior to the
       operation with an _o_f_f_s_e_t equal to _a_i_o___o_f_f_s_e_t and a _w_h_e_n_c_e equal to
       SEEK_SET.  After a successful call to enqueue an asynchronous I/O
       operation, the value of the file offset for the file is unspecified.

       The _a_i_o___s_i_g_e_v_e_n_t member specifies the notification which occurs when
       the request is completed.

       The _a_i_o_c_b_p->_a_i_o___l_i_o___o_p_c_o_d_e field shall be ignored by _a_i_o___r_e_a_d().

       The _a_i_o_c_b_p argument points to an aaiiooccbb structure. If the buffer pointed
       to by _a_i_o_c_b_p->_a_i_o___b_u_f or the control block pointed to by _a_i_o_c_b_p becomes
       an illegal address prior to asynchronous I/O completion, then the
       behavior is undefined.

       Simultaneous asynchronous operations using the same _a_i_o_c_b_p produce
       undefined results.

       If synchronized I/O is enabled on the file associated with
       _a_i_o_c_b_p->_a_i_o___f_i_l_d_e_s, the behavior of this function shall be according to
       the definitions of synchronized I/O data integrity completion and
       synchronized I/O file integrity completion.

       For any system action that changes the process memory space while an
       asynchronous I/O is outstanding to the address range being changed, the
       result of that action is undefined.

       For regular files, no data transfer shall occur past the offset maximum
       established in the open file description associated with
       _a_i_o_c_b_p->_a_i_o___f_i_l_d_e_s.

RREETTUURRNN VVAALLUUEE
       The _a_i_o___r_e_a_d() function shall return the value zero if the I/O
       operation is successfully queued; otherwise, the function shall return
       the value -1 and set _e_r_r_n_o to indicate the error.

EERRRROORRSS
       The _a_i_o___r_e_a_d() function shall fail if:

       EEAAGGAAIINN The requested asynchronous I/O operation was not queued due to
              system resource limitations.

       Each of the following conditions may be detected synchronously at the
       time of the call to _a_i_o___r_e_a_d(), or asynchronously. If any of the
       conditions below are detected synchronously, the _a_i_o___r_e_a_d() function
       shall return -1 and set _e_r_r_n_o to the corresponding value. If any of the
       conditions below are detected asynchronously, the return status of the
       asynchronous operation is set to -1, and the error status of the
       asynchronous operation is set to the corresponding value.

       EEBBAADDFF  The _a_i_o_c_b_p->_a_i_o___f_i_l_d_e_s argument is not a valid file descriptor
              open for reading.

       EEIINNVVAALL The file offset value implied by _a_i_o_c_b_p->_a_i_o___o_f_f_s_e_t would be
              invalid,
              _a_i_o_c_b_p->_a_i_o___r_e_q_p_r_i_o is not a valid value, or _a_i_o_c_b_p->_a_i_o___n_b_y_t_e_s
              is an invalid value.

       In the case that the _a_i_o___r_e_a_d() successfully queues the I/O operation
       but the operation is subsequently canceled or encounters an error, the
       return status of the asynchronous operation is one of the values
       normally returned by the _r_e_a_d() function call. In addition, the error
       status of the asynchronous operation is set to one of the error
       statuses normally set by the _r_e_a_d() function call, or one of the
       following values:

       EEBBAADDFF  The _a_i_o_c_b_p->_a_i_o___f_i_l_d_e_s argument is not a valid file descriptor
              open for reading.

       EECCAANNCCEELLEEDD
              The requested I/O was canceled before the I/O completed due to
              an explicit _a_i_o___c_a_n_c_e_l() request.

       EEIINNVVAALL The file offset value implied by _a_i_o_c_b_p->_a_i_o___o_f_f_s_e_t would be
              invalid.

       The following condition may be detected synchronously or
       asynchronously:

       EEOOVVEERRFFLLOOWW
              The file is a regular file, _a_i_o_b_c_p->_a_i_o___n_b_y_t_e_s is greater than
              0, and the starting offset in _a_i_o_b_c_p->_a_i_o___o_f_f_s_e_t is before the
              end-of-file and is at or beyond the offset maximum in the open
              file description associated with _a_i_o_c_b_p->_a_i_o___f_i_l_d_e_s.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

EEXXAAMMPPLLEESS
       None.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       None.

RRAATTIIOONNAALLEE
       None.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _a_i_o___c_a_n_c_e_l(), _a_i_o___e_r_r_o_r(), _l_i_o___l_i_s_t_i_o(), _a_i_o___r_e_t_u_r_n(), _a_i_o___w_r_i_t_e(),
       _c_l_o_s_e(), _e_x_e_c, _e_x_i_t(), _f_o_r_k(), _l_s_e_e_k(), _r_e_a_d()

       The Base Definitions volume of POSIX.1-2008, <<aaiioo..hh>>

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
       -- Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, Copyright (C) 2013 by the Institute of
       Electrical and Electronics Engineers, Inc and The Open Group.  (This is
       POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
       event of any discrepancy between this version and the original IEEE and
       The Open Group Standard, the original IEEE and The Open Group Standard
       is the referee document. The original Standard can be obtained online
       at http://www.unix.org/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2013                          AIO_READ(3)
