summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2011-11-06 12:07:23 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2011-11-06 12:07:23 +0000
commit30bbeba7de8ac5cebaa8cd334dbbb8999b5b4aa6 (patch)
tree8574f71c620ef25c5d77eded9b92796edf4b532c /lib
parent90a1f2aa7a0e0bb6f2e311f3e57c79c148a1711f (diff)
repair documentation offset in the p*() versions of the calls and EINVAL;
plus merge differences between two pages. ok guenther jmc
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/sys/read.237
-rw-r--r--lib/libc/sys/write.215
2 files changed, 25 insertions, 27 deletions
diff --git a/lib/libc/sys/read.2 b/lib/libc/sys/read.2
index 5c45a033967..47bb157df19 100644
--- a/lib/libc/sys/read.2
+++ b/lib/libc/sys/read.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: read.2,v 1.29 2011/11/05 17:55:49 guenther Exp $
+.\" $OpenBSD: read.2,v 1.30 2011/11/06 12:07:22 deraadt Exp $
.\" $NetBSD: read.2,v 1.6 1995/02/27 12:35:47 cgd Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)read.2 8.4 (Berkeley) 2/26/94
.\"
-.Dd $Mdocdate: November 5 2011 $
+.Dd $Mdocdate: November 6 2011 $
.Dt READ 2
.Os
.Sh NAME
@@ -63,17 +63,17 @@ of data from the object referenced by the descriptor
into the buffer pointed to by
.Fa buf .
.Fn readv
-performs the same action, but scatters the input data
-into the
+performs the same action, but scatters the input data into the
.Fa iovcnt
buffers specified by the members of the
.Fa iov
-array: iov[0], iov[1], ..., iov[iovcnt\|\-\|1].
+array: iov[0], iov[1], ..., iov[iovcnt-1].
.Fn pread
and
.Fn preadv
-perform the same functions, but read from the specified position in
-the file without modifying the file pointer.
+perform the same functions, but read from the specified position
+.Fa offset
+in the file without modifying the file pointer.
.Pp
For
.Fn readv
@@ -94,13 +94,13 @@ Each
entry specifies the base address and length of an area
in memory where data should be placed.
.Fn readv
-will always fill an area completely before proceeding
-to the next.
+and
+.Fn preadv
+will always fill an area completely before proceeding to the next.
.Pp
On objects capable of seeking, the
.Fn read
-starts at a position
-given by the pointer associated with
+starts at a position given by the pointer associated with
.Fa d
(see
.Xr lseek 2 ) .
@@ -163,10 +163,6 @@ A read from a slow device
(i.e. one that might block for an arbitrary amount of time)
was interrupted by the delivery of a signal
before any data arrived.
-.It Bq Er EINVAL
-The pointer associated with
-.Fa d
-was negative.
.El
.Pp
In addition,
@@ -196,6 +192,9 @@ and
.Fn preadv
may return the following error:
.Bl -tag -width Er
+.It Bq Er EINVAL
+.Fa offset
+was negative.
.It Bq Er ESPIPE
.Fa d
is associated with a pipe, socket, FIFO, or tty.
@@ -262,8 +261,8 @@ function call appeared in
.Sh CAVEATS
Error checks should explicitly test for \-1.
Code such as
-.Bd -literal
- while ((nr = read(fd, buf, sizeof(buf))) > 0)
+.Bd -literal -offset indent
+while ((nr = read(fd, buf, sizeof(buf))) > 0)
.Ed
.Pp
is not maximally portable, as some platforms allow for
@@ -276,6 +275,6 @@ and
.Fn read
may appear as a negative number distinct from \-1.
Proper loops should use
-.Bd -literal
- while ((nr = read(fd, buf, sizeof(buf))) != -1 && nr != 0)
+.Bd -literal -offset indent
+while ((nr = read(fd, buf, sizeof(buf))) != -1 && nr != 0)
.Ed
diff --git a/lib/libc/sys/write.2 b/lib/libc/sys/write.2
index 75b16f040b4..f5c8460aac5 100644
--- a/lib/libc/sys/write.2
+++ b/lib/libc/sys/write.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: write.2,v 1.34 2011/11/05 17:55:49 guenther Exp $
+.\" $OpenBSD: write.2,v 1.35 2011/11/06 12:07:22 deraadt Exp $
.\" $NetBSD: write.2,v 1.6 1995/02/27 12:39:43 cgd Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)write.2 8.5 (Berkeley) 4/2/94
.\"
-.Dd $Mdocdate: November 5 2011 $
+.Dd $Mdocdate: November 6 2011 $
.Dt WRITE 2
.Os
.Sh NAME
@@ -67,7 +67,7 @@ performs the same action, but gathers the output data from the
.Fa iovcnt
buffers specified by the members of the
.Fa iov
-array: iov[0], iov[1], ..., iov[iovcnt\|-\|1].
+array: iov[0], iov[1], ..., iov[iovcnt-1].
.Fn pwrite
and
.Fn pwritev
@@ -161,10 +161,6 @@ is not a valid descriptor open for writing.
.It Bq Er EFBIG
An attempt was made to write a file that exceeds the process's
file size limit or the maximum file size.
-.It Bq Er EINVAL
-The pointer associated with
-.Fa d
-was negative.
.It Bq Er ENOSPC
There is no free space remaining on the file system containing the file.
.It Bq Er EDQUOT
@@ -210,7 +206,7 @@ may return the following error:
.It Bq Er EINVAL
.Fa nbytes
was larger than
-.Ev SSIZE_MAX .
+.Dv SSIZE_MAX .
.El
.Pp
.Fn pwrite
@@ -218,6 +214,9 @@ and
.Fn pwritev
may return the following error:
.Bl -tag -width Er
+.It Bq Er EINVAL
+.Fa offset
+was negative.
.It Bq Er ESPIPE
.Fa d
is associated with a pipe, socket, FIFO, or tty.