]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/aio_write.3
man*/: ffix (un-bracket tables)
[thirdparty/man-pages.git] / man3 / aio_write.3
CommitLineData
a1eaacb1 1'\" t
fea681da
MK
2.\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
3.\"
e4a74ca8 4.\" SPDX-License-Identifier: GPL-2.0-or-later
fea681da 5.\"
4c1c5274 6.TH aio_write 3 (date) "Linux man-pages (unreleased)"
fea681da
MK
7.SH NAME
8aio_write \- asynchronous write
a42212d0
AC
9.SH LIBRARY
10Real-time library
8fc3b2cf 11.RI ( librt ", " \-lrt )
fea681da 12.SH SYNOPSIS
c7db92b9 13.nf
fea681da 14.B "#include <aio.h>"
68e4db0a 15.PP
fea681da 16.BI "int aio_write(struct aiocb *" aiocbp );
c7db92b9 17.fi
fea681da
MK
18.SH DESCRIPTION
19The
e511ffb6 20.BR aio_write ()
c8cedd7e 21function queues the I/O request described by the buffer pointed to by
c0a2871b 22.IR aiocbp .
c8cedd7e
MK
23This function is the asynchronous analog of
24.BR write (2).
25The arguments of the call
847e0d88 26.PP
1ae6b2c7
AC
27.in +4n
28.EX
29write(fd, buf, count)
30.EE
31.in
847e0d88 32.PP
c8cedd7e
MK
33correspond (in order) to the fields
34.IR aio_fildes ,
35.IR aio_buf ,
36and
1ae6b2c7 37.I aio_nbytes
c8cedd7e
MK
38of the structure pointed to by
39.IR aiocbp .
2b014d76
MK
40(See
41.BR aio (7)
42for a description of the
43.I aiocb
44structure.)
dd3568a1 45.PP
1274071a
MK
46If
47.B O_APPEND
48is not set, the data is written starting at the
c72249c5 49absolute position
94e9d9fe 50.IR aiocbp\->aio_offset ,
c72249c5 51regardless of the file offset.
1274071a
MK
52If
53.B O_APPEND
c8cedd7e
MK
54is set, data is written at the end of the file in the same order as
55.BR aio_write ()
56calls are made.
c72249c5 57After the call, the value of the file offset is unspecified.
dd3568a1 58.PP
fea681da
MK
59The "asynchronous" means that this call returns as soon as the
60request has been enqueued; the write may or may not have completed
c13182ef
MK
61when the call returns.
62One tests for completion using
fea681da 63.BR aio_error (3).
c8cedd7e
MK
64The return status of a completed I/O operation can be obtained
65.BR aio_return (3).
2c1c3c95 66Asynchronous notification of I/O completion can be obtained by setting
1ae6b2c7 67.I aiocbp\->aio_sigevent
2c1c3c95
MK
68appropriately; see
69.BR sigevent (7)
70for details.
dd3568a1 71.PP
2f0af33b
MK
72If
73.B _POSIX_PRIORITIZED_IO
74is defined, and this file supports it,
fea681da
MK
75then the asynchronous operation is submitted at a priority equal
76to that of the calling process minus
94e9d9fe 77.IR aiocbp\->aio_reqprio .
dd3568a1 78.PP
fea681da 79The field
94e9d9fe 80.I aiocbp\->aio_lio_opcode
fea681da 81is ignored.
dd3568a1 82.PP
fea681da 83No data is written to a regular file beyond its maximum offset.
47297adb 84.SH RETURN VALUE
c13182ef 85On success, 0 is returned.
dec985f9 86On error, the request is not enqueued, \-1
fea681da
MK
87is returned, and
88.I errno
f6a4078b 89is set to indicate the error.
33a0ccb2 90If an error is detected only later, it will
fea681da
MK
91be reported via
92.BR aio_return (3)
93(returns status \-1) and
94.BR aio_error (3)
36546c38 95(error status\[em]whatever one would have gotten in
fea681da 96.IR errno ,
2f0af33b
MK
97such as
98.BR EBADF ).
fea681da
MK
99.SH ERRORS
100.TP
101.B EAGAIN
102Out of resources.
103.TP
104.B EBADF
105.I aio_fildes
106is not a valid file descriptor open for writing.
107.TP
108.B EFBIG
109The file is a regular file, we want to write at least one byte,
110but the starting position is at or beyond the maximum offset for this file.
111.TP
112.B EINVAL
113One or more of
114.IR aio_offset ,
115.IR aio_reqprio ,
0daa9e92 116.I aio_nbytes
fea681da
MK
117are invalid.
118.TP
119.B ENOSYS
aea038d6
MK
120.BR aio_write ()
121is not implemented.
7eab2fad
MS
122.SH ATTRIBUTES
123For an explanation of the terms used in this section, see
124.BR attributes (7).
125.TS
126allbox;
c466875e 127lbx lb lb
7eab2fad
MS
128l l l.
129Interface Attribute Value
130T{
9e54434e
BR
131.na
132.nh
7eab2fad
MS
133.BR aio_write ()
134T} Thread safety MT-Safe
135.TE
c466875e 136.sp 1
3113c7f3 137.SH STANDARDS
4131356c
AC
138POSIX.1-2008.
139.SH HISTORY
140glibc 2.1.
141POSIX.1-2001.
fea681da
MK
142.SH NOTES
143It is a good idea to zero out the control block before use.
c8cedd7e 144The control block must not be changed while the write operation
fea681da
MK
145is in progress.
146The buffer area being written out
147.\" or the control block of the operation
c8cedd7e 148must not be accessed during the operation or undefined results may occur.
c13182ef 149The memory areas involved must remain valid.
847e0d88 150.PP
c8cedd7e
MK
151Simultaneous I/O operations specifying the same
152.I aiocb
153structure produce undefined results.
47297adb 154.SH SEE ALSO
fea681da
MK
155.BR aio_cancel (3),
156.BR aio_error (3),
157.BR aio_fsync (3),
158.BR aio_read (3),
159.BR aio_return (3),
25fa6c3d 160.BR aio_suspend (3),
cd587df6 161.BR lio_listio (3),
25fa6c3d 162.BR aio (7)