1AIO_WRITE(3P)              POSIX Programmer's Manual             AIO_WRITE(3P)
2
3
4

PROLOG

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

NAME

12       aio_write — asynchronous write to a file
13

SYNOPSIS

15       #include <aio.h>
16
17       int aio_write(struct aiocb *aiocbp);
18

DESCRIPTION

20       The aio_write() function shall write  aiocbp->aio_nbytes  to  the  file
21       associated  with  aiocbp->aio_fildes  from  the  buffer  pointed  to by
22       aiocbp->aio_buf. The function shall return when the write  request  has
23       been initiated or, at a minimum, queued to the file or device.
24
25       If  prioritized  I/O  is supported for this file, then the asynchronous
26       operation shall be submitted at a priority equal to a  base  scheduling
27       priority  minus  aiocbp->aio_reqprio. If Thread Execution Scheduling is
28       not supported, then the base scheduling priority is that of the calling
29       process;
30       otherwise, the base scheduling priority is that of the calling thread.
31
32       The  aiocbp  argument  may  be  used  as an argument to aio_error() and
33       aio_return() in order to determine the error status and return  status,
34       respectively, of the asynchronous operation while it is proceeding.
35
36       The aiocbp argument points to an aiocb structure. If the buffer pointed
37       to by aiocbp->aio_buf or the control block pointed to by aiocbp becomes
38       an  illegal  address  prior  to  asynchronous  I/O completion, then the
39       behavior is undefined.
40
41       If O_APPEND is not set for the file  descriptor  aio_fildes,  then  the
42       requested  operation  shall  take place at the absolute position in the
43       file as given by aio_offset, as  if  lseek()  were  called  immediately
44       prior  to the operation with an offset equal to aio_offset and a whence
45       equal to SEEK_SET.  If O_APPEND is set for the file descriptor,  or  if
46       aio_fildes  is  associated  with a device that is incapable of seeking,
47       write operations append to the file in the same order as the calls were
48       made,  except under circumstances described in Section 2.8.2, Asynchro‐
49       nous I/O.  After a successful call to enqueue an asynchronous I/O oper‐
50       ation, the value of the file offset for the file is unspecified.
51
52       The  aio_sigevent  member  specifies the notification which occurs when
53       the request is completed.
54
55       The aiocbp->aio_lio_opcode field shall be ignored by aio_write().
56
57       Simultaneous asynchronous operations  using  the  same  aiocbp  produce
58       undefined results.
59
60       If   synchronized   I/O   is   enabled  on  the  file  associated  with
61       aiocbp->aio_fildes, the behavior of this function shall be according to
62       the definitions of synchronized I/O data integrity completion, and syn‐
63       chronized I/O file integrity completion.
64
65       For any system action that changes the process memory  space  while  an
66       asynchronous I/O is outstanding to the address range being changed, the
67       result of that action is undefined.
68
69       For regular files, no data transfer shall occur past the offset maximum
70       established    in   the   open   file   description   associated   with
71       aiocbp->aio_fildes.
72

RETURN VALUE

74       The aio_write() function shall return the value zero if the I/O  opera‐
75       tion  is  successfully queued; otherwise, the function shall return the
76       value -1 and set errno to indicate the error.
77

ERRORS

79       The aio_write() function shall fail if:
80
81       EAGAIN The requested asynchronous I/O operation was not queued  due  to
82              system resource limitations.
83
84       Each  of  the following conditions may be detected synchronously at the
85       time of the call to aio_write(), or asynchronously. If any of the  con‐
86       ditions  below  are  detected  synchronously,  the aio_write() function
87       shall return -1 and set errno to the corresponding value. If any of the
88       conditions  below are detected asynchronously, the return status of the
89       asynchronous operation shall be set to -1, and the error status of  the
90       asynchronous operation is set to the corresponding value.
91
92       EBADF  The  aiocbp->aio_fildes  argument is not a valid file descriptor
93              open for writing.
94
95       EINVAL The file offset value implied  by  aiocbp->aio_offset  would  be
96              invalid,
97              aiocbp->aio_reqprio  is not a valid value, or aiocbp->aio_nbytes
98              is an invalid value.
99
100       In the case that the aio_write() successfully queues the I/O operation,
101       the  return  status  of  the asynchronous operation shall be one of the
102       values normally returned by the write() function call. If the operation
103       is  successfully  queued  but is subsequently canceled or encounters an
104       error, the error status for the asynchronous operation contains one  of
105       the  values  normally  set  by the write() function call, or one of the
106       following:
107
108       EBADF  The aiocbp->aio_fildes argument is not a valid  file  descriptor
109              open for writing.
110
111       EINVAL The  file  offset  value  implied by aiocbp->aio_offset would be
112              invalid.
113
114       ECANCELED
115              The requested I/O was canceled before the I/O completed  due  to
116              an explicit aio_cancel() request.
117
118       The   following  condition  may  be  detected  synchronously  or  asyn‐
119       chronously:
120
121       EFBIG  The file is a regular file, aiobcp->aio_nbytes is  greater  than
122              0, and the starting offset in aiobcp->aio_offset is at or beyond
123              the offset maximum in the open file description associated  with
124              aiocbp->aio_fildes.
125
126       The following sections are informative.
127

EXAMPLES

129       None.
130

APPLICATION USAGE

132       None.
133

RATIONALE

135       None.
136

FUTURE DIRECTIONS

138       None.
139

SEE ALSO

141       Section 2.8.2, Asynchronous I/O, aio_cancel(), aio_error(), aio_read(),
142       aio_return(), close(), exec,  exit(),  fork(),  lio_listio(),  lseek(),
143       write()
144
145       The Base Definitions volume of POSIX.1‐2017, <aio.h>
146
148       Portions  of  this text are reprinted and reproduced in electronic form
149       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
150       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
151       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
152       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
153       event of any discrepancy between this version and the original IEEE and
154       The  Open Group Standard, the original IEEE and The Open Group Standard
155       is the referee document. The original Standard can be  obtained  online
156       at http://www.opengroup.org/unix/online.html .
157
158       Any  typographical  or  formatting  errors that appear in this page are
159       most likely to have been introduced during the conversion of the source
160       files  to  man page format. To report such errors, see https://www.ker
161       nel.org/doc/man-pages/reporting_bugs.html .
162
163
164
165IEEE/The Open Group                  2017                        AIO_WRITE(3P)
Impressum