summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2015-02-05 02:33:09 +0000
committerschwarze <schwarze@openbsd.org>2015-02-05 02:33:09 +0000
commit0e5e29b0acdc0ee4e690553a6bc8d573b5e26335 (patch)
treed03e470c7096ed54c1a9f6122a297cc536a42908 /lib/libc/sys
parentfix handling of empty .An macros (diff)
downloadwireguard-openbsd-0e5e29b0acdc0ee4e690553a6bc8d573b5e26335.tar.xz
wireguard-openbsd-0e5e29b0acdc0ee4e690553a6bc8d573b5e26335.zip
macro fixes from Kaspars at Bankovskis dot net;
also fixing one typo in fts(3) while here
Diffstat (limited to 'lib/libc/sys')
-rw-r--r--lib/libc/sys/poll.229
-rw-r--r--lib/libc/sys/read.216
-rw-r--r--lib/libc/sys/setregid.26
-rw-r--r--lib/libc/sys/setreuid.26
-rw-r--r--lib/libc/sys/write.224
5 files changed, 43 insertions, 38 deletions
diff --git a/lib/libc/sys/poll.2 b/lib/libc/sys/poll.2
index b778819fad9..8474abb66cb 100644
--- a/lib/libc/sys/poll.2
+++ b/lib/libc/sys/poll.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: poll.2,v 1.28 2014/12/16 00:06:49 schwarze Exp $
+.\" $OpenBSD: poll.2,v 1.29 2015/02/05 02:33:09 schwarze Exp $
.\"
.\" Copyright (c) 1994 Jason R. Thorpe
.\" All rights reserved.
@@ -28,7 +28,7 @@
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\"
-.Dd $Mdocdate: December 16 2014 $
+.Dd $Mdocdate: February 5 2015 $
.Dt POLL 2
.Os
.Sh NAME
@@ -61,7 +61,7 @@ The arguments are as follows:
.Bl -tag -width timeout
.It Fa fds
Points to an array of
-.Fa pollfd
+.Vt pollfd
structures, which are defined as:
.Bd -literal -offset indent
struct pollfd {
@@ -78,7 +78,7 @@ If
.Fa fd
is -1,
the
-.Fa pollfd
+.Vt pollfd
structure is considered unused, and
.Fa revents
will be cleared.
@@ -91,14 +91,15 @@ members are bitmasks of conditions to monitor and conditions found,
respectively.
.It Fa nfds
An unsigned integer specifying the number of
-.Fa pollfd
+.Vt pollfd
structures in the array.
.It Fa timeout
Maximum interval to wait for the poll to complete, in milliseconds.
If this value is 0,
.Fn poll
will return immediately.
-If this value is INFTIM (-1),
+If this value is
+.Dv INFTIM Pq -1 ,
.Fn poll
will block indefinitely until a condition is found.
.El
@@ -210,18 +211,18 @@ to indicate the error.
If the timeout interval was reached before any events occurred,
they return 0.
Otherwise, they return the number of
-.Fa pollfd
+.Vt pollfd
structures for which
.Fa revents
is non-zero.
.Sh IDIOMS
Care must be taken when converting code from
-.Fn select
+.Xr select 2
to
.Fn poll
as they have slightly different semantics.
The first semantic difference is that, unlike
-.Fn select ,
+.Xr select 2 ,
.Fn poll
has a way of indicating that one or more file descriptors is invalid
by setting a flag in the
@@ -229,9 +230,11 @@ by setting a flag in the
field of corresponding entry of
.Fa fds ,
whereas
-.Fn select
+.Xr select 2
returns an error (-1) if any of the descriptors with bits set in
-the fd_set are invalid.
+the
+.Vt fd_set
+are invalid.
The second difference is that on EOF there is no guarantee that
.Dv POLLIN
will be set in
@@ -239,11 +242,11 @@ will be set in
the caller must also check for
.Dv POLLHUP .
This differs from
-.Fn select
+.Xr select 2
where EOF is considered as a read event.
.Pp
Consider the following usage of
-.Fn select
+.Xr select 2
that implements a read from the standard input with a
60 second time out:
.Bd -literal -offset indent
diff --git a/lib/libc/sys/read.2 b/lib/libc/sys/read.2
index 1cbad9e4dc9..48e227354ee 100644
--- a/lib/libc/sys/read.2
+++ b/lib/libc/sys/read.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: read.2,v 1.34 2014/05/29 06:28:51 guenther Exp $
+.\" $OpenBSD: read.2,v 1.35 2015/02/05 02:33:09 schwarze 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: May 29 2014 $
+.Dd $Mdocdate: February 5 2015 $
.Dt READ 2
.Os
.Sh NAME
@@ -40,17 +40,17 @@
.Nm preadv
.Nd read input
.Sh SYNOPSIS
-.Fd #include <unistd.h>
+.In unistd.h
.Ft ssize_t
.Fn read "int d" "void *buf" "size_t nbytes"
.Ft ssize_t
.Fn pread "int d" "void *buf" "size_t nbytes" "off_t offset"
.Pp
-.Fd #include <sys/uio.h>
+.In sys/uio.h
.Ft ssize_t
.Fn readv "int d" "const struct iovec *iov" "int iovcnt"
-.Fd #include <sys/types.h>
-.Fd #include <sys/uio.h>
+.In sys/types.h
+.In sys/uio.h
.Ft ssize_t
.Fn preadv "int d" "const struct iovec *iov" "int iovcnt" "off_t offset"
.Sh DESCRIPTION
@@ -220,7 +220,7 @@ The sum of the
values in the
.Fa iov
array overflowed an
-.Em ssize_t .
+.Vt ssize_t .
.It Bq Er EFAULT
Part of
.Fa iov
@@ -266,7 +266,7 @@ while ((nr = read(fd, buf, sizeof(buf))) > 0)
.Ed
.Pp
is not maximally portable, as some platforms allow for
-.Va nbytes
+.Fa nbytes
to range between
.Dv SSIZE_MAX
and
diff --git a/lib/libc/sys/setregid.2 b/lib/libc/sys/setregid.2
index 38b550532b5..602da875710 100644
--- a/lib/libc/sys/setregid.2
+++ b/lib/libc/sys/setregid.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: setregid.2,v 1.10 2014/12/10 19:19:00 schwarze Exp $
+.\" $OpenBSD: setregid.2,v 1.11 2015/02/05 02:33:09 schwarze Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
@@ -29,14 +29,14 @@
.\"
.\" @(#)setregid.2 8.2 (Berkeley) 4/16/94
.\"
-.Dd $Mdocdate: December 10 2014 $
+.Dd $Mdocdate: February 5 2015 $
.Dt SETREGID 2
.Os
.Sh NAME
.Nm setregid
.Nd set real and effective group IDs
.Sh SYNOPSIS
-.Fd #include <unistd.h>
+.In unistd.h
.Ft int
.Fn setregid "gid_t rgid" "gid_t egid"
.Sh DESCRIPTION
diff --git a/lib/libc/sys/setreuid.2 b/lib/libc/sys/setreuid.2
index 533f20958ed..29c11c2e017 100644
--- a/lib/libc/sys/setreuid.2
+++ b/lib/libc/sys/setreuid.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: setreuid.2,v 1.11 2014/12/10 19:19:00 schwarze Exp $
+.\" $OpenBSD: setreuid.2,v 1.12 2015/02/05 02:33:09 schwarze Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
@@ -29,14 +29,14 @@
.\"
.\" @(#)setreuid.2 8.2 (Berkeley) 4/16/94
.\"
-.Dd $Mdocdate: December 10 2014 $
+.Dd $Mdocdate: February 5 2015 $
.Dt SETREUID 2
.Os
.Sh NAME
.Nm setreuid
.Nd set real and effective user IDs
.Sh SYNOPSIS
-.Fd #include <unistd.h>
+.In unistd.h
.Ft int
.Fn setreuid "uid_t ruid" "uid_t euid"
.Sh DESCRIPTION
diff --git a/lib/libc/sys/write.2 b/lib/libc/sys/write.2
index 930e445c1a1..60463ee05b0 100644
--- a/lib/libc/sys/write.2
+++ b/lib/libc/sys/write.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: write.2,v 1.38 2013/04/08 07:39:17 jmc Exp $
+.\" $OpenBSD: write.2,v 1.39 2015/02/05 02:33:09 schwarze 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: April 8 2013 $
+.Dd $Mdocdate: February 5 2015 $
.Dt WRITE 2
.Os
.Sh NAME
@@ -40,17 +40,17 @@
.Nm pwritev
.Nd write output
.Sh SYNOPSIS
-.Fd #include <unistd.h>
+.In unistd.h
.Ft ssize_t
.Fn write "int d" "const void *buf" "size_t nbytes"
.Ft ssize_t
.Fn pwrite "int d" "const void *buf" "size_t nbytes" "off_t offset"
.Pp
-.Fd #include <sys/uio.h>
+.In sys/uio.h
.Ft ssize_t
.Fn writev "int d" "const struct iovec *iov" "int iovcnt"
-.Fd #include <sys/types.h>
-.Fd #include <sys/uio.h>
+.In sys/types.h
+.In sys/uio.h
.Ft ssize_t
.Fn pwritev "int d" "const struct iovec *iov" "int iovcnt" "off_t offset"
.Sh DESCRIPTION
@@ -79,7 +79,7 @@ For
and
.Fn pwritev ,
the
-.Fa iovec
+.Vt iovec
structure is defined as:
.Bd -literal -offset indent
struct iovec {
@@ -89,7 +89,7 @@ struct iovec {
.Ed
.Pp
Each
-.Fa iovec
+.Vt iovec
entry specifies the base address and length of an area
in memory from which data should be written.
.Fn writev
@@ -106,7 +106,9 @@ starts at a position given by the pointer associated with
Upon return from
.Fn write ,
the pointer is incremented by the number of bytes which were written.
-If a file was opened with the O_APPEND flag (see
+If a file was opened with the
+.Dv O_APPEND
+flag (see
.Xr open 2 ) ,
calls to
.Fn write
@@ -264,7 +266,7 @@ The sum of the
values in the
.Fa iov
array overflowed an
-.Em ssize_t .
+.Vt ssize_t .
.It Bq Er EFAULT
Part of
.Fa iov
@@ -313,7 +315,7 @@ while ((nr = write(fd, buf, sizeof(buf))) > 0)
.Ed
.Pp
is not maximally portable, as some platforms allow for
-.Va nbytes
+.Fa nbytes
to range between
.Dv SSIZE_MAX
and