]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl) |
2 | .\" | |
3 | .\" This is free documentation; you can redistribute it and/or | |
4 | .\" modify it under the terms of the GNU General Public License as | |
5 | .\" published by the Free Software Foundation; either version 2 of | |
6 | .\" the License, or (at your option) any later version. | |
7 | .\" | |
8 | .\" The GNU General Public License's references to "object code" | |
9 | .\" and "executables" are to be interpreted as the output of any | |
10 | .\" document formatting or typesetting system, including | |
11 | .\" intermediate and printed output. | |
12 | .\" | |
13 | .\" This manual is distributed in the hope that it will be useful, | |
14 | .\" but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | .\" GNU General Public License for more details. | |
17 | .\" | |
18 | .\" You should have received a copy of the GNU General Public | |
19 | .\" License along with this manual; if not, write to the Free | |
20 | .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, | |
21 | .\" USA. | |
22 | .\" | |
23 | .TH AIO_WRITE 3 2003-11-14 "" "Linux Programmer's Manual" | |
24 | .SH NAME | |
25 | aio_write \- asynchronous write | |
26 | .SH SYNOPSIS | |
27 | .sp | |
28 | .B "#include <aio.h>" | |
29 | .sp | |
30 | .BI "int aio_write(struct aiocb *" aiocbp ); | |
fea681da MK |
31 | .SH DESCRIPTION |
32 | The | |
e511ffb6 | 33 | .BR aio_write () |
fea681da MK |
34 | function requests an asynchronous "n = write(fd, buf, count)" |
35 | with fd, buf, count given by | |
36 | .IR aiocbp->aio_fildes , | |
37 | .IR aiocbp->aio_buf , | |
38 | .IR aiocbp->aio_nbytes , | |
c13182ef MK |
39 | respectively. |
40 | The return status n can be retrieved upon completion using | |
fea681da MK |
41 | .BR aio_return (3). |
42 | .LP | |
43 | If O_APPEND is not set, the data is written starting at the | |
44 | absolute file offset | |
45 | .IR aiocbp->aio_offset , | |
46 | regardless of the current file position. | |
47 | If O_APPEND is set, the data is written at the end of the file. | |
48 | After this request, the value of the current file position is unspecified. | |
49 | .LP | |
50 | The "asynchronous" means that this call returns as soon as the | |
51 | request has been enqueued; the write may or may not have completed | |
c13182ef MK |
52 | when the call returns. |
53 | One tests for completion using | |
fea681da MK |
54 | .BR aio_error (3). |
55 | .LP | |
56 | If _POSIX_PRIORITIZED_IO is defined, and this file supports it, | |
57 | then the asynchronous operation is submitted at a priority equal | |
58 | to that of the calling process minus | |
59 | .IR aiocbp->aio_reqprio . | |
60 | .LP | |
61 | The field | |
62 | .I aiocbp->aio_lio_opcode | |
63 | is ignored. | |
64 | .LP | |
65 | No data is written to a regular file beyond its maximum offset. | |
66 | .SH "RETURN VALUE" | |
c13182ef MK |
67 | On success, 0 is returned. |
68 | On error the request is not enqueued, \-1 | |
fea681da MK |
69 | is returned, and |
70 | .I errno | |
c13182ef MK |
71 | is set appropriately. |
72 | If an error is first detected later, it will | |
fea681da MK |
73 | be reported via |
74 | .BR aio_return (3) | |
75 | (returns status \-1) and | |
76 | .BR aio_error (3) | |
77 | (error status whatever one would have gotten in | |
78 | .IR errno , | |
79 | such as EBADF). | |
80 | .SH ERRORS | |
81 | .TP | |
82 | .B EAGAIN | |
83 | Out of resources. | |
84 | .TP | |
85 | .B EBADF | |
86 | .I aio_fildes | |
87 | is not a valid file descriptor open for writing. | |
88 | .TP | |
89 | .B EFBIG | |
90 | The file is a regular file, we want to write at least one byte, | |
91 | but the starting position is at or beyond the maximum offset for this file. | |
92 | .TP | |
93 | .B EINVAL | |
94 | One or more of | |
95 | .IR aio_offset , | |
96 | .IR aio_reqprio , | |
97 | .IR aio_nbytes | |
98 | are invalid. | |
99 | .TP | |
100 | .B ENOSYS | |
101 | This function is not supported. | |
fea681da MK |
102 | .SH NOTES |
103 | It is a good idea to zero out the control block before use. | |
104 | This control block must not be changed while the write operation | |
105 | is in progress. | |
106 | The buffer area being written out | |
107 | .\" or the control block of the operation | |
108 | must not be accessed during the operation or undefined results may | |
c13182ef MK |
109 | occur. |
110 | The memory areas involved must remain valid. | |
fea681da | 111 | .SH "CONFORMING TO" |
68e1685c | 112 | POSIX.1-2001 |
fea681da MK |
113 | .SH "SEE ALSO" |
114 | .BR aio_cancel (3), | |
115 | .BR aio_error (3), | |
116 | .BR aio_fsync (3), | |
117 | .BR aio_read (3), | |
118 | .BR aio_return (3), | |
119 | .BR aio_suspend (3) |