aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/sys
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/sys')
-rw-r--r--lib/libc/sys/Makefile.inc2
-rw-r--r--lib/libc/sys/Symbol.map2
-rw-r--r--lib/libc/sys/aio_error.26
-rw-r--r--lib/libc/sys/aio_read.263
-rw-r--r--lib/libc/sys/aio_return.24
-rw-r--r--lib/libc/sys/aio_write.263
6 files changed, 116 insertions, 24 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index d43a59719563..82d16fb81b6b 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -354,6 +354,8 @@ MAN+= sctp_generic_recvmsg.2 \
write.2 \
_umtx_op.2
+MLINKS+=aio_read.2 aio_readv.2
+MLINKS+=aio_write.2 aio_writev.2
MLINKS+=accept.2 accept4.2
MLINKS+=access.2 eaccess.2 \
access.2 faccessat.2
diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map
index 9f0d3749ac01..847dd9cca987 100644
--- a/lib/libc/sys/Symbol.map
+++ b/lib/libc/sys/Symbol.map
@@ -403,6 +403,8 @@ FBSD_1.5 {
FBSD_1.6 {
__sysctlbyname;
+ aio_readv;
+ aio_writev;
close_range;
copy_file_range;
fhlink;
diff --git a/lib/libc/sys/aio_error.2 b/lib/libc/sys/aio_error.2
index 030914616121..1ec6505a64aa 100644
--- a/lib/libc/sys/aio_error.2
+++ b/lib/libc/sys/aio_error.2
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd June 2, 1999
+.Dd January 2, 2021
.Dt AIO_ERROR 2
.Os
.Sh NAME
@@ -52,7 +52,9 @@ is returned.
If the request has completed unsuccessfully the error
status is returned as described in
.Xr read 2 ,
+.Xr readv 2 ,
.Xr write 2 ,
+.Xr writev 2 ,
or
.Xr fsync 2 .
On failure,
@@ -76,9 +78,11 @@ does not reference an outstanding asynchronous I/O request.
.Sh SEE ALSO
.Xr aio_cancel 2 ,
.Xr aio_read 2 ,
+.Xr aio_readv 2 ,
.Xr aio_return 2 ,
.Xr aio_suspend 2 ,
.Xr aio_write 2 ,
+.Xr aio_writev 2 ,
.Xr fsync 2 ,
.Xr read 2 ,
.Xr write 2 ,
diff --git a/lib/libc/sys/aio_read.2 b/lib/libc/sys/aio_read.2
index bbf96cc89890..0327ef1f747b 100644
--- a/lib/libc/sys/aio_read.2
+++ b/lib/libc/sys/aio_read.2
@@ -24,11 +24,12 @@
.\"
.\" $FreeBSD$
.\"
-.Dd August 19, 2016
+.Dd January 2, 2021
.Dt AIO_READ 2
.Os
.Sh NAME
-.Nm aio_read
+.Nm aio_read ,
+.Nm aio_readv
.Nd asynchronous read from a file (REALTIME)
.Sh LIBRARY
.Lb libc
@@ -36,21 +37,42 @@
.In aio.h
.Ft int
.Fn aio_read "struct aiocb *iocb"
+.In sys/uio.h
+.Ft int
+.Fn aio_readv "struct aiocb *iocb"
.Sh DESCRIPTION
The
.Fn aio_read
-system call allows the calling process to read
-.Fa iocb->aio_nbytes
+and
+.Fn aio_readv
+system calls allow the calling process to read
from the descriptor
.Fa iocb->aio_fildes
beginning at the offset
-.Fa iocb->aio_offset
-into the buffer pointed to by
-.Fa iocb->aio_buf .
-The call returns immediately after the read request has
+.Fa iocb->aio_offset .
+.Fn aio_read
+will read
+.Fa iocb->aio_nbytes
+from the buffer pointed to by
+.Fa iocb->aio_buf ,
+whereas
+.Fn aio_readv
+reads the data into the
+.Fa iocb->aio_iovcnt
+buffers specified by the members of the
+.Fa iocb->aio_iov
+array.
+Both syscalls return immediately after the read request has
been enqueued to the descriptor; the read may or may not have
completed at the time the call returns.
.Pp
+For
+.Fn aio_readv
+the
+.Fa iovec
+structure is defined in
+.Xr readv 2 .
+.Pp
If _POSIX_PRIORITIZED_IO is defined, and the descriptor supports it,
then the enqueued operation is submitted at a priority equal to that
of the calling process minus
@@ -61,7 +83,9 @@ The
argument
is ignored by the
.Fn aio_read
-system call.
+and
+.Fn aio_readv
+system calls.
.Pp
The
.Fa iocb
@@ -108,16 +132,22 @@ is past the offset maximum for
.Fa iocb->aio_fildes ,
no I/O will occur.
.Sh RETURN VALUES
-.Rv -std aio_read
+.Rv -std aio_read aio_readv
.Sh DIAGNOSTICS
None.
.Sh ERRORS
The
.Fn aio_read
-system call will fail if:
+and
+.Fn aio_readv
+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
@@ -130,10 +160,14 @@ are unsafe and unsafe asynchronous I/O operations are disabled.
.Pp
The following conditions may be synchronously detected when the
.Fn aio_read
+or
+.Fn aio_readv
system call is made, or asynchronously, at any time thereafter.
If they
are detected at call time,
.Fn aio_read
+or
+.Fn aio_readv
returns -1 and sets
.Va errno
appropriately; otherwise the
@@ -207,11 +241,18 @@ The
system call is expected to conform to the
.St -p1003.1
standard.
+The
+.Fn aio_readv
+system call is a FreeBSD extension, and should not be used in portable code.
.Sh HISTORY
The
.Fn aio_read
system call first appeared in
.Fx 3.0 .
+The
+.Fn aio_readv
+system call first appeared in
+.Fx 13.0 .
.Sh AUTHORS
This
manual page was written by
diff --git a/lib/libc/sys/aio_return.2 b/lib/libc/sys/aio_return.2
index df558734ed41..d94fcc7eba62 100644
--- a/lib/libc/sys/aio_return.2
+++ b/lib/libc/sys/aio_return.2
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 21, 2016
+.Dd January 2, 2021
.Dt AIO_RETURN 2
.Os
.Sh NAME
@@ -55,7 +55,9 @@ returns something other than
If the asynchronous I/O request has completed, the status is returned
as described in
.Xr read 2 ,
+.Xr readv 2 ,
.Xr write 2 ,
+.Xr writev 2 ,
or
.Xr fsync 2 .
Otherwise,
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 .