AIO_WRITE(3)               POSIX Programmer's Manual              AIO_WRITE(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_write -- asynchronous write to a file

SSYYNNOOPPSSIISS
       #include <aio.h>

       int aio_write(struct aiocb *_a_i_o_c_b_p);

DDEESSCCRRIIPPTTIIOONN
       The _a_i_o___w_r_i_t_e() function shall write _a_i_o_c_b_p->_a_i_o___n_b_y_t_e_s to the file
       associated with _a_i_o_c_b_p->_a_i_o___f_i_l_d_e_s from the buffer pointed to by
       _a_i_o_c_b_p->_a_i_o___b_u_f. The function shall return when the write request has
       been initiated or, at a minimum, queued to the file or device.

       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 argument 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.

       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.

       If O_APPEND is not set for the file descriptor _a_i_o___f_i_l_d_e_s, then the
       requested operation shall take 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.  If O_APPEND is set for the file descriptor, or if
       _a_i_o___f_i_l_d_e_s is associated with a device that is incapable of seeking,
       write operations append to the file in the same order as the calls were
       made, except under circumstances described in _S_e_c_t_i_o_n _2_._8_._2,
       _A_s_y_n_c_h_r_o_n_o_u_s _I_/_O.  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___w_r_i_t_e().

       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___w_r_i_t_e() 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___w_r_i_t_e() 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___w_r_i_t_e(), or asynchronously. If any of the
       conditions below are detected synchronously, the _a_i_o___w_r_i_t_e() 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 shall be 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 writing.

       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___w_r_i_t_e() successfully queues the I/O operation,
       the return status of the asynchronous operation shall be one of the
       values normally returned by the _w_r_i_t_e() function call. If the operation
       is successfully queued but is subsequently canceled or encounters an
       error, the error status for the asynchronous operation contains one of
       the values normally set by the _w_r_i_t_e() function call, or one of the
       following:

       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 writing.

       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.

       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.

       The following condition may be detected synchronously or
       asynchronously:

       EEFFBBIIGG  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 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
       _S_e_c_t_i_o_n _2_._8_._2, _A_s_y_n_c_h_r_o_n_o_u_s _I_/_O, _a_i_o___c_a_n_c_e_l(), _a_i_o___e_r_r_o_r(), _a_i_o___r_e_a_d(),
       _a_i_o___r_e_t_u_r_n(), _c_l_o_s_e(), _e_x_e_c, _e_x_i_t(), _f_o_r_k(), _l_i_o___l_i_s_t_i_o(), _l_s_e_e_k(),
       _w_r_i_t_e()

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

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  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.opengroup.org/unix/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                  2017                         AIO_WRITE(3)
