source: trunk/packages/xen-3.1/xen-3.1/tools/libaio/man/aio_write.3 @ 34

Last change on this file since 34 was 34, checked in by hartmans, 17 years ago

Add xen and xen-common

File size: 3.9 KB
Line 
1.TH aio_write 3 2002-09-12 "Linux 2.4" Linux AIO"
2.SH NAME
3aio_write  \-  Initiate an asynchronous write operation
4.SH SYNOPSYS
5.nf
6.B #include <errno.h>
7.sp
8.br
9.B #include <aio.h>
10.sp
11.br
12.BI "int aio_write (struct aiocb * aiocbp);"
13.fi
14.SH DESCRIPTION
15This function initiates an asynchronous write operation.  The function
16call immediately returns after the operation was enqueued or if before
17this happens an error was encountered.
18
19The first
20.IR "aiocbp->aio_nbytes"
21bytes from the buffer starting at
22.IR "aiocbp->aio_buf"
23are written to the file for which
24.IR "aiocbp->aio_fildes"
25is an descriptor, starting at the absolute
26position
27.IR "aiocbp->aio_offset"
28in the file.
29
30If prioritized I/O is supported by the platform, the
31.IR "aiocbp->aio_reqprio "
32value is used to adjust the priority before
33the request is actually enqueued.
34
35The calling process is notified about the termination of the read
36request according to the
37.IR "aiocbp->aio_sigevent"
38value.
39
40When
41.IR "aio_write"
42returns, the return value is zero if no error
43occurred that can be found before the process is enqueued.  If such an
44early error is found the function returns
45.IR -1
46and sets
47.IR "errno"
48to one of the following values.
49
50.TP
51.B EAGAIN
52The request was not enqueued due to (temporarily) exceeded resource
53limitations.
54.TP
55.B ENOSYS
56The
57.IR "aio_write"
58function is not implemented.
59.TP
60.B EBADF
61The
62.IR "aiocbp->aio_fildes"
63descriptor is not valid.  This condition
64may not be recognized before enqueueing the request, and so this error
65might also be signaled asynchronously.
66.TP
67.B EINVAL
68The
69.IR "aiocbp->aio_offset"
70or
71.IR "aiocbp->aio_reqprio"
72value is
73invalid.  This condition may not be recognized before enqueueing the
74request and so this error might also be signaled asynchronously.
75.PP
76
77In the case
78.IR "aio_write"
79returns zero, the current status of the
80request can be queried using
81.IR "aio_error"
82and
83.IR "aio_return"
84functions.  As long as the value returned by
85.IR "aio_error"
86is
87.IR "EINPROGRESS"
88the operation has not yet completed.  If
89.IR "aio_error"
90returns zero, the operation successfully terminated,
91otherwise the value is to be interpreted as an error code.  If the
92function terminated, the result of the operation can be get using a call
93to
94.IR "aio_return"
95.  The returned value is the same as an equivalent
96call to
97.IR "read"
98would have returned.  Possible error codes returned
99by
100.IR "aio_error"
101are:
102
103.TP
104.B EBADF
105The
106.IR "aiocbp->aio_fildes"
107descriptor is not valid.
108.TP
109.B ECANCELED
110The operation was canceled before the operation was finished.
111.TP
112.B EINVAL
113The
114.IR "aiocbp->aio_offset"
115value is invalid.
116.PP
117When the sources are compiled with
118.IR "_FILE_OFFSET_BITS == 64"
119, this
120function is in fact
121.IR "aio_write64"
122since the LFS interface transparently
123replaces the normal implementation.
124.SH "RETURN VALUES"
125When
126.IR "aio_write"
127returns, the return value is zero if no error
128occurred that can be found before the process is enqueued.  If such an
129early error is found the function returns
130.IR -1
131and sets
132.IR "errno"
133to one of the following values.
134.SH ERRORS
135.TP
136.B EAGAIN
137The request was not enqueued due to (temporarily) exceeded resource
138limitations.
139.TP
140.B ENOSYS
141The
142.IR "aio_write"
143function is not implemented.
144.TP
145.B EBADF
146The
147.IR "aiocbp->aio_fildes"
148descriptor is not valid.  This condition
149may not be recognized before enqueueing the request, and so this error
150might also be signaled asynchronously.
151.TP
152.B EINVAL
153The
154.IR "aiocbp->aio_offset"
155or
156.IR "aiocbp->aio_reqprio"
157value is
158invalid.  This condition may not be recognized before enqueueing the
159request and so this error might also be signaled asynchronously.
160.SH "SEE ALSO"
161.BR aio(3),
162.BR aio_cancel(3),
163.BR aio_cancel64(3),
164.BR aio_error(3),
165.BR aio_error64(3),
166.BR aio_fsync(3),
167.BR aio_fsync64(3),
168.BR aio_init(3),
169.BR aio_read(3),
170.BR aio_read64(3),
171.BR aio_return(3),
172.BR aio_return64(3),
173.BR aio_suspend(3),
174.BR aio_suspend64(3),
175.BR aio_write64(3),
176.BR errno(3),
Note: See TracBrowser for help on using the repository browser.