summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/write.2
diff options
context:
space:
mode:
authordt <dt@FreeBSD.org>1999-04-11 21:14:40 +0000
committerdt <dt@FreeBSD.org>1999-04-11 21:14:40 +0000
commitaa2a8a165f46ceee1384f0dcb21173a1aba008ea (patch)
tree1d55f0b77dd575ad46d66665a4eed3b8a3de038f /lib/libc/sys/write.2
parentcb5131e1df64c490ed29cd4246bffd8700ce4821 (diff)
downloadFreeBSD-src-aa2a8a165f46ceee1384f0dcb21173a1aba008ea.zip
FreeBSD-src-aa2a8a165f46ceee1384f0dcb21173a1aba008ea.tar.gz
Document pread() and pwrite().
Obtained from: NetBSD (mostly)
Diffstat (limited to 'lib/libc/sys/write.2')
-rw-r--r--lib/libc/sys/write.234
1 files changed, 31 insertions, 3 deletions
diff --git a/lib/libc/sys/write.2 b/lib/libc/sys/write.2
index f8d8063..240f970 100644
--- a/lib/libc/sys/write.2
+++ b/lib/libc/sys/write.2
@@ -36,7 +36,8 @@
.Os BSD 4
.Sh NAME
.Nm write ,
-.Nm writev
+.Nm writev ,
+.Nm pwrite
.Nd write output
.Sh SYNOPSIS
.Fd #include <sys/types.h>
@@ -46,6 +47,8 @@
.Fn write "int d" "const void *buf" "size_t nbytes"
.Ft ssize_t
.Fn writev "int d" "const struct iovec *iov" "int iovcnt"
+.Ft ssize_t
+.Fn pwrite "int d" "const void *buf" "size_t nbytes" "off_t offset"
.Sh DESCRIPTION
.Fn Write
attempts to write
@@ -61,6 +64,9 @@ from the
buffers specified by the members of the
.Fa iov
array: iov[0], iov[1], ..., iov[iovcnt\|-\|1].
+.Fn Pwrite
+performs the same function, but writes to the specified position in
+the file without modifying the file pointer.
.Pp
For
.Fn writev ,
@@ -168,9 +174,10 @@ is returned. Otherwise a -1 is returned and the global variable
.Va errno
is set to indicate the error.
.Sh ERRORS
-.Fn Write
+.Fn Write ,
+.Fn writev ,
and
-.Fn writev
+.Fn pwrite
will fail and the file pointer will remain unchanged if:
.Bl -tag -width Er
.It Bq Er EBADF
@@ -229,6 +236,16 @@ values in the
.Fa iov
array overflowed a 32-bit integer.
.El
+.Pp
+The
+.Fn pwrite
+call may also return the following errors:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The specified file offset is invalid.
+.It Bq Er ESPIPE
+The file descriptor is associated with a pipe, socket, or FIFO.
+.El
.Sh SEE ALSO
.Xr fcntl 2 ,
.Xr lseek 2 ,
@@ -240,8 +257,19 @@ The
.Fn write
function call is expected to conform to
.St -p1003.1-90 .
+The
+.Fn writev
+and
+.Fn pwrite
+functions are expected to conform to
+.St -xpg4.2 .
.Sh HISTORY
The
+.Fn pwrite
+function call
+appeared in
+.At V.4 .
+The
.Fn writev
function call
appeared in
OpenPOWER on IntegriCloud