1AIO_WRITE(3)               Linux Programmer's Manual              AIO_WRITE(3)
2
3
4

NAME

6       aio_write - asynchronous write
7

SYNOPSIS

9       #include <aio.h>
10
11       int aio_write(struct aiocb *aiocbp);
12
13       Link with -lrt.
14

DESCRIPTION

16       The  aio_write()  function requests an asynchronous "n = write(fd, buf,
17       count)"   with   fd,   buf,   count   given   by    aiocbp->aio_fildes,
18       aiocbp->aio_buf, aiocbp->aio_nbytes, respectively.  The return status n
19       can be retrieved upon completion using aio_return(3).
20
21       If O_APPEND is not set, the data is written starting  at  the  absolute
22       file  offset  aiocbp->aio_offset,  regardless of the current file posi‐
23       tion.  If O_APPEND is set, the data is written at the end of the  file.
24       After  this request, the value of the current file position is unspeci‐
25       fied.
26
27       The "asynchronous" means that this call returns as soon as the  request
28       has  been  enqueued;  the  write may or may not have completed when the
29       call returns.  One tests for completion using aio_error(3).
30
31       If _POSIX_PRIORITIZED_IO is defined, and this file  supports  it,  then
32       the  asynchronous operation is submitted at a priority equal to that of
33       the calling process minus aiocbp->aio_reqprio.
34
35       The field aiocbp->aio_lio_opcode is ignored.
36
37       No data is written to a regular file beyond its maximum offset.
38

RETURN VALUE

40       On success, 0 is returned.  On error the request is not enqueued, -1 is
41       returned,  and  errno  is  set  appropriately.   If  an  error is first
42       detected later, it will be reported via aio_return(3)  (returns  status
43       -1)  and  aio_error(3)  (error status whatever one would have gotten in
44       errno, such as EBADF).
45

ERRORS

47       EAGAIN Out of resources.
48
49       EBADF  aio_fildes is not a valid file descriptor open for writing.
50
51       EFBIG  The file is a regular file, we want to write at least one  byte,
52              but the starting position is at or beyond the maximum offset for
53              this file.
54
55       EINVAL One or more of aio_offset, aio_reqprio, aio_nbytes are invalid.
56
57       ENOSYS This function is not supported.
58

CONFORMING TO

60       POSIX.1-2001.
61

NOTES

63       It is a good idea to zero out the control block before use.  This  con‐
64       trol  block  must  not  be  changed  while  the  write  operation is in
65       progress.  The buffer area being written out must not be accessed  dur‐
66       ing  the  operation  or  undefined results may occur.  The memory areas
67       involved must remain valid.
68

SEE ALSO

70       aio_cancel(3), aio_error(3), aio_fsync(3), aio_read(3),  aio_return(3),
71       aio_suspend(3)
72

COLOPHON

74       This  page  is  part of release 3.25 of the Linux man-pages project.  A
75       description of the project, and information about reporting  bugs,  can
76       be found at http://www.kernel.org/doc/man-pages/.
77
78
79
80                                  2003-11-14                      AIO_WRITE(3)
Impressum