aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/sys/aio_write.2
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/sys/aio_write.2')
-rw-r--r--lib/libc/sys/aio_write.263
1 files changed, 52 insertions, 11 deletions
diff --git a/lib/libc/sys/aio_write.2 b/lib/libc/sys/aio_write.2
index a3268e50ea90..601515b0e7b0 100644
--- a/lib/libc/sys/aio_write.2
+++ b/lib/libc/sys/aio_write.2
@@ -24,11 +24,12 @@
.\"
.\" $FreeBSD$
.\"
-.Dd August 19, 2016
+.Dd January 2, 2021
.Dt AIO_WRITE 2
.Os
.Sh NAME
-.Nm aio_write
+.Nm aio_write ,
+.Nm aio_writev
.Nd asynchronous write to a file (REALTIME)
.Sh LIBRARY
.Lb libc
@@ -36,28 +37,48 @@
.In aio.h
.Ft int
.Fn aio_write "struct aiocb *iocb"
+.In sys/uio.h
+.Ft int
+.Fn aio_writev "struct aiocb *iocb"
.Sh DESCRIPTION
The
.Fn aio_write
-system call allows the calling process to write
-.Fa iocb->aio_nbytes
-from the buffer pointed to by
-.Fa iocb->aio_buf
+and
+.Fn aio_writev
+system calls allow the calling process to write
to the descriptor
.Fa iocb->aio_fildes .
-The call returns immediately after the write request has been enqueued
+.Fn aio_write
+will write
+.Fa iocb->aio_nbytes
+from the buffer pointed to by
+.Fa iocb->aio_buf ,
+whereas
+.Fn aio_writev
+gathers the data from the
+.Fa iocb->aio_iovcnt
+buffers specified by the members of the
+.Fa iocb->aio_iov
+array.
+Both syscalls return immediately after the write request has been enqueued
to the descriptor; the write may or may not have completed at the time
the call returns.
If the request could not be enqueued, generally due
to invalid arguments, the call returns without having enqueued the
request.
.Pp
+For
+.Fn aio_writev
+the
+.Fa iovec
+structure is defined in
+.Xr writev 2 .
+.Pp
If
.Dv O_APPEND
is set for
.Fa iocb->aio_fildes ,
-.Fn aio_write
-operations append to the file in the same order as the calls were
+write operations append to the file in the same order as the calls were
made.
If
.Dv O_APPEND
@@ -103,6 +124,8 @@ The asynchronous I/O control buffer
.Fa iocb
should be zeroed before the
.Fn aio_write
+or
+.Fn aio_writev
system call to avoid passing bogus context information to the kernel.
.Pp
Modifications of the Asynchronous I/O Control Block structure or the
@@ -114,14 +137,20 @@ is past the offset maximum for
.Fa iocb->aio_fildes ,
no I/O will occur.
.Sh RETURN VALUES
-.Rv -std aio_write
+.Rv -std aio_write aio_writev
.Sh ERRORS
The
.Fn aio_write
-system call will fail if:
+and
+.Fn aio_writev
+system calls will fail if:
.Bl -tag -width Er
.It Bq Er EAGAIN
The request was not queued because of system resource limitations.
+.It Bq Er EFAULT
+Part of
+.Fa aio_iov
+points outside the process's allocated address space.
.It Bq Er EINVAL
The asynchronous notification method in
.Fa iocb->aio_sigevent.sigev_notify
@@ -134,10 +163,14 @@ are unsafe and unsafe asynchronous I/O operations are disabled.
.Pp
The following conditions may be synchronously detected when the
.Fn aio_write
+or
+.Fn aio_writev
system call is made, or asynchronously, at any time thereafter.
If they
are detected at call time,
.Fn aio_write
+or
+.Fn aio_writev
returns -1 and sets
.Va errno
appropriately; otherwise the
@@ -203,11 +236,19 @@ system call
is expected to conform to the
.St -p1003.1
standard.
+.Pp
+The
+.Fn aio_writev
+system call is a FreeBSD extension, and should not be used in portable code.
.Sh HISTORY
The
.Fn aio_write
system call first appeared in
.Fx 3.0 .
+The
+.Fn aio_writev
+system call first appeared in
+.Fx 13.0 .
.Sh AUTHORS
This manual page was written by
.An Wes Peters Aq Mt wes@softweyr.com .