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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

NOTES

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

CONFORMING TO

68       POSIX.1-2001
69

SEE ALSO

71       aio_cancel(3), aio_error(3), aio_fsync(3), aio_read(3),  aio_return(3),
72       aio_suspend(3)
73
74
75
76                                  2003-11-14                      AIO_WRITE(3)
Impressum