summaryrefslogtreecommitdiff
path: root/lib/libc/sys
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2001-03-06 16:46:24 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2001-03-06 16:46:24 +0000
commit0d8324cd3617af09a60559e2f4557a793a167e34 (patch)
tree2933c6e9f72276c03f0a16b3abc112db4f58a90e /lib/libc/sys
parent1367cb73f53466185f1c79ee57154ab6a72ea325 (diff)
Notes
Diffstat (limited to 'lib/libc/sys')
-rw-r--r--lib/libc/sys/aio_cancel.211
-rw-r--r--lib/libc/sys/aio_error.22
-rw-r--r--lib/libc/sys/aio_return.22
-rw-r--r--lib/libc/sys/aio_suspend.22
-rw-r--r--lib/libc/sys/aio_waitcomplete.225
-rw-r--r--lib/libc/sys/brk.24
-rw-r--r--lib/libc/sys/execve.28
-rw-r--r--lib/libc/sys/fcntl.220
-rw-r--r--lib/libc/sys/fhopen.22
-rw-r--r--lib/libc/sys/getdirentries.23
-rw-r--r--lib/libc/sys/getlogin.217
-rw-r--r--lib/libc/sys/getsockopt.23
-rw-r--r--lib/libc/sys/kill.22
-rw-r--r--lib/libc/sys/kldstat.26
-rw-r--r--lib/libc/sys/listen.210
-rw-r--r--lib/libc/sys/lseek.22
-rw-r--r--lib/libc/sys/madvise.22
-rw-r--r--lib/libc/sys/mmap.2139
-rw-r--r--lib/libc/sys/ptrace.244
-rw-r--r--lib/libc/sys/recv.22
-rw-r--r--lib/libc/sys/select.26
-rw-r--r--lib/libc/sys/semget.28
-rw-r--r--lib/libc/sys/sendfile.22
-rw-r--r--lib/libc/sys/setreuid.25
-rw-r--r--lib/libc/sys/shmget.28
-rw-r--r--lib/libc/sys/socket.22
26 files changed, 207 insertions, 130 deletions
diff --git a/lib/libc/sys/aio_cancel.2 b/lib/libc/sys/aio_cancel.2
index dc55c84085c3..320e36f4c87c 100644
--- a/lib/libc/sys/aio_cancel.2
+++ b/lib/libc/sys/aio_cancel.2
@@ -46,13 +46,14 @@ If
.Fa iocb
is specified, only that specific asynchronous I/O request is cancelled.
.Pp
-Normal asynchronous notification occurs for cancelled requests. Requests
-complete with an error result of
+Normal asynchronous notification occurs for cancelled requests.
+Requests complete with an error result of
.Er ECANCELED .
.Sh RESTRICTIONS
The
.Fn aio_cancel
-function does not cancel asynchronous I/O requests for raw disk devices. The
+function does not cancel asynchronous I/O requests for raw disk devices.
+The
.Fn aio_cancel
function will always return
.Dv AIO_NOTCANCELED
@@ -76,7 +77,7 @@ All of the requests meeting the criteria have finished.
.Xr aio_read 2 ,
.Xr aio_return 2 ,
.Xr aio_suspend 2 ,
-.Xr aio_write 2 .
+.Xr aio_write 2
.Sh ERRORS
An error return from
.Fn aio_cancel
@@ -97,7 +98,7 @@ The
.Fn aio_cancel
function first appeared in
.Fx 3.0 .
-The first functional implemenation of
+The first functional implementation of
.Fn aio_cancel
appeared in
.Fx 4.0 .
diff --git a/lib/libc/sys/aio_error.2 b/lib/libc/sys/aio_error.2
index a204d474c6db..e27c973da812 100644
--- a/lib/libc/sys/aio_error.2
+++ b/lib/libc/sys/aio_error.2
@@ -78,7 +78,7 @@ does not reference an outstanding asynchronous I/O request.
.Xr aio_write 2 ,
.Xr fsync 2 ,
.Xr read 2 ,
-.Xr write 2 .
+.Xr write 2
.Sh STANDARDS
.Fn aio_error
is expected to conform to the
diff --git a/lib/libc/sys/aio_return.2 b/lib/libc/sys/aio_return.2
index a6bca22dfb7f..3477288bccee 100644
--- a/lib/libc/sys/aio_return.2
+++ b/lib/libc/sys/aio_return.2
@@ -71,7 +71,7 @@ to indicate the error condition.
.Xr aio_write 2 ,
.Xr fsync 2 ,
.Xr read 2 ,
-.Xr write 2 .
+.Xr write 2
.Sh ERRORS
The
.Fn aio_return
diff --git a/lib/libc/sys/aio_suspend.2 b/lib/libc/sys/aio_suspend.2
index 8d36c34879a6..333ad82e861b 100644
--- a/lib/libc/sys/aio_suspend.2
+++ b/lib/libc/sys/aio_suspend.2
@@ -72,7 +72,7 @@ to indicate the error, as enumerated below.
.Xr aio_error 2 ,
.Xr aio_read 2 ,
.Xr aio_suspend 2 ,
-.Xr aio_write 2 .
+.Xr aio_write 2
.Sh ERRORS
The
.Fn aio_suspend
diff --git a/lib/libc/sys/aio_waitcomplete.2 b/lib/libc/sys/aio_waitcomplete.2
index ccc91d6954c2..c554673a3e2c 100644
--- a/lib/libc/sys/aio_waitcomplete.2
+++ b/lib/libc/sys/aio_waitcomplete.2
@@ -35,27 +35,30 @@
.Sh SYNOPSIS
.Fd #include <aio.h>
.Ft int
-.Fn aio_waitcomplete "struct aiocb **iocbp, struct timeval *timeout"
+.Fn aio_waitcomplete "struct aiocb **iocbp" "struct timespec *timeout"
.Sh DESCRIPTION
The
.Fn aio_waitcomplete
-function waits for completion of an asynchronous I/O request. Upon completion,
+function waits for completion of an asynchronous I/O request.
+Upon completion,
.Fn aio_waitcomplete
returns the result of the function and sets
.Fa iocbp
-to point to the structure associated with the original request. If an
-asynchronous I/O request is completed before
+to point to the structure associated with the original request.
+If an asynchronous I/O request is completed before
.Fn aio_waitcomplete
is called, it returns immediately with the completed request.
.Pp
If
.Fa timeout
is a non-NULL pointer, it specifies a maximum interval to wait for a
-asynchronous I/O request to complete. If
+asynchronous I/O request to complete.
+If
.Fa timeout
is a NULL pointer,
.Fn aio_waitcomplete
-waits indefinitely. To effect a poll, the
+waits indefinitely.
+To effect a poll, the
.Fa timeout
argument should be non-NULL, pointing to a zero-valued timeval structure.
.Pp
@@ -70,8 +73,8 @@ should not be called for the control block returned in
.Sh RETURN VALUES
If an asynchronous I/O request has completed,
.Fa iocbp
-is set to point to the control block passed with the original request, and
-the status is returned as described in
+is set to point to the control block passed with the original request,
+and the status is returned as described in
.Xr read 2 ,
.Xr write 2 ,
or
@@ -82,8 +85,8 @@ returns
.Dv -1 ,
sets iocbp to
.Dv NULL
-and
-.Dv errno
+and sets
+.Va errno
to indicate the error condition.
.Sh ERRORS
The
@@ -114,7 +117,7 @@ completed.
.Xr aio_write 2 ,
.Xr fsync 2 ,
.Xr read 2 ,
-.Xr write 2 .
+.Xr write 2
.Sh STANDARDS
The
.Fn aio_waitcomplete
diff --git a/lib/libc/sys/brk.2 b/lib/libc/sys/brk.2
index 09072a4e1565..7f40e3417a27 100644
--- a/lib/libc/sys/brk.2
+++ b/lib/libc/sys/brk.2
@@ -99,11 +99,11 @@ beyond the
value returned from a call to
.Xr getrlimit 2 ,
e.g.\&
-.Dq etext + rlp\(->rlim_max.
+.Dq Va etext No + Va rlp\->rlim_max .
(See
.Xr end 3
for the definition of
-.Em etext ) .
+.Va etext ) .
.Sh RETURN VALUES
.Fn Brk
returns 0 if successful;
diff --git a/lib/libc/sys/execve.2 b/lib/libc/sys/execve.2
index 113e83be2b68..ccc4d663b667 100644
--- a/lib/libc/sys/execve.2
+++ b/lib/libc/sys/execve.2
@@ -58,11 +58,13 @@ An executable object file consists of an identifying header,
followed by pages of data representing the initial program (text)
and initialized data pages. Additional pages may be specified
by the header to be initialized with zero data; see
+.Xr elf 5
+and
.Xr a.out 5 .
.Pp
An interpreter file begins with a line of the form:
.Pp
-.Bd -filled -offset indent -compact
+.Bd -ragged -offset indent -compact
.Sy \&#!
.Em interpreter
.Bq Em arg
@@ -103,7 +105,7 @@ The argument
is also a pointer to a null-terminated array of
character pointers to null-terminated strings.
A pointer to this array is normally stored in the global variable
-.Va environ.
+.Va environ .
These strings pass information to the
new process that is not directly an argument to the command (see
.Xr environ 7 ) .
@@ -280,6 +282,8 @@ of a super-user as well.
.Xr execl 3 ,
.Xr exit 3 ,
.Xr sysctl 3 ,
+.Xr a.out 5 ,
+.Xr elf 5 ,
.Xr environ 7 ,
.Xr mount 8
.Sh HISTORY
diff --git a/lib/libc/sys/fcntl.2 b/lib/libc/sys/fcntl.2
index 49522c77c414..0b2ec8924d02 100644
--- a/lib/libc/sys/fcntl.2
+++ b/lib/libc/sys/fcntl.2
@@ -193,11 +193,11 @@ taken as a pointer to a
(see above).
.Dv F_SETLK
is used to establish shared (or read) locks
-.Dv (F_RDLCK)
+.Pq Dv F_RDLCK
or exclusive (or write) locks,
-.Dv (F_WRLCK) ,
+.Pq Dv F_WRLCK ,
as well as remove either type of lock
-.Dv (F_UNLCK) .
+.Pq Dv F_UNLCK .
If a shared or exclusive lock cannot be set,
.Fn fcntl
returns immediately with
@@ -392,11 +392,11 @@ The argument
is
.Dv F_SETLK ,
the type of lock
-.Fa (l_type)
+.Pq Fa l_type
is a shared lock
-.Dv (F_RDLCK)
+.Pq Dv F_RDLCK
or exclusive lock
-.Dv (F_WRLCK) ,
+.Pq Dv F_WRLCK ,
and the segment of a file to be locked is already
exclusive-locked by another process;
or the type is an exclusive lock and some portion of the
@@ -413,9 +413,9 @@ is
or
.Dv F_SETLKW ,
the type of lock
-.Fa (l_type)
+.Pq Fa l_type
is a shared lock
-.Dv (F_RDLCK) ,
+.Pq Dv F_RDLCK ,
and
.Fa fildes
is not a valid file descriptor open for reading.
@@ -427,9 +427,9 @@ is
or
.Dv F_SETLKW ,
the type of lock
-.Fa (l_type)
+.Pq Fa l_type
is an exclusive lock
-.Dv (F_WRLCK) ,
+.Pq Dv F_WRLCK ,
and
.Fa fildes
is not a valid file descriptor open for writing.
diff --git a/lib/libc/sys/fhopen.2 b/lib/libc/sys/fhopen.2
index 75af67f32357..dbe10a79275a 100644
--- a/lib/libc/sys/fhopen.2
+++ b/lib/libc/sys/fhopen.2
@@ -54,7 +54,7 @@
.Fn fhstatfs "const fhandle_t *fhp" "struct statfs *buf"
.Sh DESCRIPTION
These functions provide a means to access a file given the file handle
-.Fa fhp.
+.Fa fhp .
As this method bypasses directory access restrictions, these calls are
restricted to the superuser.
.Pp
diff --git a/lib/libc/sys/getdirentries.2 b/lib/libc/sys/getdirentries.2
index 4dab8a65f871..f883fec4cfe1 100644
--- a/lib/libc/sys/getdirentries.2
+++ b/lib/libc/sys/getdirentries.2
@@ -137,7 +137,8 @@ Alternatively, the current position pointer may be set and retrieved by
The current position pointer should only be set to a value returned by
.Xr lseek 2 ,
a value returned in the location pointed to by
-.Fa basep ( Ns Fn getdirentries
+.Fa basep
+.Pf ( Fn getdirentries
only)
or zero.
.Sh IMPLEMENTATION NOTES
diff --git a/lib/libc/sys/getlogin.2 b/lib/libc/sys/getlogin.2
index 023ea1d6de0b..c52bb2e2e1e1 100644
--- a/lib/libc/sys/getlogin.2
+++ b/lib/libc/sys/getlogin.2
@@ -86,8 +86,8 @@ is normally used only when a new session is being created on behalf
of the named user
(for example, at login time, or when a remote shell is invoked).
.Pp
-.Em NOTE:
-There is only one `login name' per `session .
+.Em NOTE :
+There is only one login name per session.
.Pp
It is
.Em CRITICALLY
@@ -107,9 +107,9 @@ which is an ideal way of detaching from a controlling terminal and
forking into the background.
.Pp
In particular, doing a
-.Fn ioctl ttyfd TIOCNOTTY ...
+.Fn ioctl ttyfd TIOCNOTTY ...\&
or
-.Fn setpgrp ...
+.Fn setpgrp ...\&
is
.Em NOT
sufficient.
@@ -190,12 +190,13 @@ function first appeared in
.Bx 4.4 .
The return value of
.Fn getlogin_r
-was changed from earlier versions of FreeBSD to be conformant with
-.St -iso9945-1 .
+was changed from earlier versions of
+.Fx
+to be conformant with
+.St -p1003.1-96 .
.Sh STANDARDS
.Fn getlogin
and
.Fn getlogin_r
conform to
-.St -iso9945-1 .
-
+.St -p1003.1-96 .
diff --git a/lib/libc/sys/getsockopt.2 b/lib/libc/sys/getsockopt.2
index dd6ae3a4a763..deb70b96d93c 100644
--- a/lib/libc/sys/getsockopt.2
+++ b/lib/libc/sys/getsockopt.2
@@ -191,7 +191,8 @@ are queued on socket and a
.Xr close 2
is performed.
If the socket promises reliable delivery of data and
-.Dv SO_LINGER is set,
+.Dv SO_LINGER
+is set,
the system will block the process on the
.Xr close 2
attempt until it is able to transmit the data or until it decides it
diff --git a/lib/libc/sys/kill.2 b/lib/libc/sys/kill.2
index 8ce5c71949d3..5a7c05cb355e 100644
--- a/lib/libc/sys/kill.2
+++ b/lib/libc/sys/kill.2
@@ -75,7 +75,7 @@ to any descendant of the current process.
.It \&If Fa pid No \&is greater than zero :
.Fa Sig
is sent to the process whose ID is equal to
-.Fa pid.
+.Fa pid .
.It \&If Fa pid No \&is zero :
.Fa Sig
is sent to all processes whose group ID is equal
diff --git a/lib/libc/sys/kldstat.2 b/lib/libc/sys/kldstat.2
index 988841120c2d..1187f6951bc8 100644
--- a/lib/libc/sys/kldstat.2
+++ b/lib/libc/sys/kldstat.2
@@ -79,8 +79,12 @@ The load address of the kld file.
The size of the file.
.El
.Sh RETURN VALUES
+The function
.Fn kldstat
-seems to always return 0.
+returns 0 on success.
+It returns -1 on failure, and sets
+.Va errno
+to indicate the error.
.Sh ERRORS
The information for the file referred to by
.Fa fileid
diff --git a/lib/libc/sys/listen.2 b/lib/libc/sys/listen.2
index 11f8fd2db65d..3a98629bf13a 100644
--- a/lib/libc/sys/listen.2
+++ b/lib/libc/sys/listen.2
@@ -60,7 +60,7 @@ The
call applies only to sockets of type
.Dv SOCK_STREAM
or
-.Dv SOCK_SEQPACKET.
+.Dv SOCK_SEQPACKET .
.Pp
The
.Fa backlog
@@ -76,15 +76,15 @@ the request may be ignored so that retries may succeed.
The
.Xr sysctl 3
MIB variable
-.Dq Li kern.ipc.somaxconn
+.Dq Va kern.ipc.somaxconn
specifies a hard limit on
.Fa backlog ;
-if a value greater than
-.Li kern.ipc.somaxconn
+if a value greater than
+.Va kern.ipc.somaxconn
or less than zero is specified,
.Fa backlog
is silently forced to
-.Li kern.ipc.somaxconn .
+.Va kern.ipc.somaxconn .
.Sh IMPLEMENTATION NOTES
.Pp
In the non-threaded library
diff --git a/lib/libc/sys/lseek.2 b/lib/libc/sys/lseek.2
index 5ca26cbb135c..5cc0f222240b 100644
--- a/lib/libc/sys/lseek.2
+++ b/lib/libc/sys/lseek.2
@@ -53,7 +53,7 @@ to the
argument
.Fa offset
according to the directive
-.Fa whence.
+.Fa whence .
The argument
.Fa fildes
must be an open
diff --git a/lib/libc/sys/madvise.2 b/lib/libc/sys/madvise.2
index 0fffc5665cad..4886d0225c49 100644
--- a/lib/libc/sys/madvise.2
+++ b/lib/libc/sys/madvise.2
@@ -154,7 +154,7 @@ arguments is not valid.
.Xr mincore 2 ,
.Xr mprotect 2 ,
.Xr msync 2 ,
-.Xr munmap 2 .
+.Xr munmap 2
.Sh HISTORY
The
.Fn madvise
diff --git a/lib/libc/sys/mmap.2 b/lib/libc/sys/mmap.2
index 53c4dac7f6d7..2c2c5799a512 100644
--- a/lib/libc/sys/mmap.2
+++ b/lib/libc/sys/mmap.2
@@ -37,14 +37,14 @@
.Os BSD 4
.Sh NAME
.Nm mmap
-.Nd map files or devices into memory
+.Nd allocate memory, or map files or devices into memory
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.Fd #include <sys/types.h>
.Fd #include <sys/mman.h>
.Ft void *
-.Fn mmap "void * addr" "size_t len" "int prot" "int flags" "int fd" "off_t offset"
+.Fn mmap "void *addr" "size_t len" "int prot" "int flags" "int fd" "off_t offset"
.Sh DESCRIPTION
The
.Fn mmap
@@ -81,13 +81,15 @@ argument by
.Em or Ns 'ing
the following values:
.Pp
-.Bl -tag -width MAP_FIXEDX
-.It Dv PROT_EXEC
-Pages may be executed.
+.Bl -tag -width PROT_WRITE -compact
+.It Dv PROT_NONE
+Pages may not be accessed.
.It Dv PROT_READ
Pages may be read.
.It Dv PROT_WRITE
Pages may be written.
+.It Dv PROT_EXEC
+Pages may be executed.
.El
.Pp
The
@@ -100,8 +102,7 @@ Sharing, mapping type and options are specified in the
argument by
.Em or Ns 'ing
the following values:
-.Pp
-.Bl -tag -width MAP_FIXEDX
+.Bl -tag -width MAP_HASSEMAPHORE
.It Dv MAP_ANON
Map anonymous memory not associated with any specific file.
The file descriptor used for creating
@@ -118,7 +119,9 @@ specified.
If the specified address cannot be used,
.Fn mmap
will fail.
-If MAP_FIXED is specified,
+If
+.Dv MAP_FIXED
+is specified,
.Fa addr
must be a multiple of the pagesize.
Use of this option is discouraged.
@@ -129,32 +132,8 @@ handling may be necessary.
Permit regions to be inherited across
.Xr execve 2
system calls.
-.It Dv MAP_PRIVATE
-Modifications are private.
-.It Dv MAP_SHARED
-Modifications are shared.
-.It Dv MAP_STACK
-This option is only available if your system has been compiled with
-VM_STACK defined when compiling the kernel.
-This is the default for
-i386 only.
-Consider adding -DVM_STACK to COPTFLAGS in your /etc/make.conf
-to enable this option for other architechures.
-MAP_STACK implies
-MAP_ANON, and
-.Fa offset
-of 0.
-.Fa fd
-must be -1 and
-.Fa prot
-must include at least PROT_READ and PROT_WRITE. This option creates
-a memory region that grows to at most
-.Fa len
-bytes in size, starting from the stack top and growing down. The
-stack top is the starting address returned by the call, plus
-.Fa len
-bytes. The bottom of the stack at maximum growth is the starting
-address returned by the call.
+.It Dv MAP_NOCORE
+Region is not included in a core file.
.It Dv MAP_NOSYNC
Causes data dirtied via this VM map to be flushed to physical media
only when necessary (usually by the pager) rather then gratuitously.
@@ -165,10 +144,43 @@ this option any VM pages you dirty may be flushed to disk every so often
(every 30-60 seconds usually) which can create performance problems if you
do not need that to occur (such as when you are using shared file-backed
mmap regions for IPC purposes). Note that VM/filesystem coherency is
-maintained whether you use MAP_NOSYNC or not. This option is not portable
-across UNIX platforms (yet), though some may implement the same behavior
+maintained whether you use
+.Dv MAP_NOSYNC
+or not. This option is not portable
+across
+.Ux
+platforms (yet), though some may implement the same behavior
by default.
.Pp
+.Em WARNING !
+Extending a file with
+.Xr ftruncate 2 ,
+thus creating a big hole, and then filling the hole by modifying a shared
+.Fn mmap
+can lead to severe file fragmentation.
+In order to avoid such fragmentation you should always pre-allocate the
+file's backing store by
+.Fn write Ns ing
+zero's into the newly extended area prior to modifying the area via your
+.Fn mmap .
+The fragmentation problem is especially sensitive to
+.Dv MAP_NOSYNC
+pages, because pages may be flushed to disk in a totally random order.
+.Pp
+The same applies when using
+.Dv MAP_NOSYNC
+to implement a file-based shared memory store.
+It is recommended that you create the backing store by
+.Fn write Ns ing
+zero's to the backing file rather then
+.Fn ftruncate Ns ing
+it.
+You can test file fragmentation by observing the KB/t (kilobytes per
+transfer) results from an
+.Dq Li iostat 1
+while reading a large file sequentially, e.g. using
+.Dq Li dd if=filename of=/dev/null bs=32k .
+.Pp
The
.Xr fsync 2
function will flush all dirty data and metadata associated with a file,
@@ -184,8 +196,44 @@ system call is obsolete since
implements a coherent filesystem buffer cache. However, it may be
used to associate dirty VM pages with filesystem buffers and thus cause
them to be flushed to physical media sooner rather then later.
-.It Dv MAP_NOCORE
-Region is not included in a core file.
+.It Dv MAP_PRIVATE
+Modifications are private.
+.It Dv MAP_SHARED
+Modifications are shared.
+.It Dv MAP_STACK
+This option is only available if your system has been compiled with
+.Dv VM_STACK
+defined when compiling the kernel.
+This is the default for
+i386 only.
+Consider adding
+.Li -DVM_STACK
+to
+.Va COPTFLAGS
+in your
+.Pa /etc/make.conf
+to enable this option for other architechures.
+.Dv MAP_STACK
+implies
+.Dv MAP_ANON ,
+and
+.Fa offset
+of 0.
+.Fa fd
+must be -1 and
+.Fa prot
+must include at least
+.Dv PROT_READ
+and
+.Dv PROT_WRITE .
+This option creates
+a memory region that grows to at most
+.Fa len
+bytes in size, starting from the stack top and growing down. The
+stack top is the starting address returned by the call, plus
+.Fa len
+bytes. The bottom of the stack at maximum growth is the starting
+address returned by the call.
.El
.Pp
The
@@ -205,7 +253,9 @@ should be done.
Upon successful completion,
.Fn mmap
returns a pointer to the mapped region.
-Otherwise, a value of MAP_FAILED is returned and
+Otherwise, a value of
+.Dv MAP_FAILED
+is returned and
.Va errno
is set to indicate the error.
.Sh ERRORS
@@ -255,17 +305,22 @@ has not been specified and
did not reference a regular or character special file.
.It Bq Er EINVAL
.Fa Offset
-was not page-aligned. (See BUGS below.)
+was not page-aligned.
+(See
+.Sx BUGS
+below.)
.It Bq Er ENOMEM
.Dv MAP_FIXED
was specified and the
.Fa addr
parameter wasn't available, or the system has reached the per-process mmap
-limit specified in the vm.max_proc_mmap sysctl.
+limit specified in the
+.Va vm.max_proc_mmap
+sysctl.
.Dv MAP_ANON
was specified and insufficient memory was available.
.El
-.Sh "SEE ALSO"
+.Sh SEE ALSO
.Xr madvise 2 ,
.Xr mincore 2 ,
.Xr mlock 2 ,
diff --git a/lib/libc/sys/ptrace.2 b/lib/libc/sys/ptrace.2
index 708f9ac44058..c91b2d1a5cee 100644
--- a/lib/libc/sys/ptrace.2
+++ b/lib/libc/sys/ptrace.2
@@ -54,9 +54,7 @@ that the process expects to be traced by its parent. All the other
arguments are ignored. (If the parent process does not expect to trace
the child, it will probably be rather confused by the results; once the
traced process stops, it cannot be made to continue except via
-.Eo \&
-.Fn ptrace
-.Ec \&.)
+.Fn ptrace . )
When a process has used this request and calls
.Xr execve 2
or any of the routines built on it
@@ -69,7 +67,7 @@ Also, any setuid or setgid bits on the executable being executed will
be ignored.
.It Dv PT_READ_I , Dv PT_READ_D
These requests read a single
-.Li int
+.Vt int
of data from the traced process' address space. Traditionally,
.Fn ptrace
has allowed for machines with distinct address spaces for instruction
@@ -99,12 +97,12 @@ except that they write rather than read. The
argument supplies the value to be written.
.It Dv PT_READ_U
This request reads an
-.Li int
+.Vt int
from the traced process' user structure. The
.Fa addr
argument specifies the location of the int relative to the base of the
user structure; it will usually be an integer value cast to
-.Li caddr_t
+.Vt caddr_t
either explicitly or via the presence of a prototype for
.Eo \&
.Fn ptrace
@@ -115,14 +113,14 @@ and
.Dv PT_READ_D ,
.Fa addr
must be aligned on an
-.Li int
+.Vt int
boundary. The value read is returned as the return value from
.Eo \&
.Fn ptrace
.Ec .
.It Dv PT_WRITE_U
This request writes an
-.Li int
+.Vt int
into the traced process' user structure.
.Fa addr
specifies the offset, just as for
@@ -138,7 +136,9 @@ The traced process continues execution.
.Fa addr
is an address specifying the place where execution is to be resumed (a
new value for the program counter), or
-.Li (caddr_t)1
+.Po
+.Vt caddr_t
+.Pc Ns 1
to indicate that execution is to pick up where it left off.
.Fa data
provides a signal number to be delivered to the traced process as it
@@ -180,7 +180,9 @@ are:
.Bl -tag -width 12n
.It Dv PT_GETREGS
This request reads the traced process' machine registers into the
-.Dq Li "struct reg"
+.Do
+.Vt "struct reg"
+.Dc
(defined in
.Aq Pa machine/reg.h )
pointed to by
@@ -189,7 +191,9 @@ pointed to by
This request is the converse of
.Dv PT_GETREGS ;
it loads the traced process' machine registers from the
-.Dq Li "struct reg"
+.Do
+.Vt "struct reg"
+.Dc
(defined in
.Aq Pa machine/reg.h )
pointed to by
@@ -197,7 +201,9 @@ pointed to by
.It Dv PT_GETFPREGS
This request reads the traced process' floating-point registers into
the
-.Dq Li "struct fpreg"
+.Do
+.Vt "struct fpreg"
+.Dc
(defined in
.Aq Pa machine/reg.h )
pointed to by
@@ -206,7 +212,9 @@ pointed to by
This request is the converse of
.Dv PT_GETFPREGS ;
it loads the traced process' floating-point registers from the
-.Dq Li "struct fpreg"
+.Do
+.Vt "struct fpreg"
+.Dc
(defined in
.Aq Pa machine/reg.h )
pointed to by
@@ -214,7 +222,9 @@ pointed to by
.It Dv PT_GETDBREGS
This request reads the traced process' debug registers into
the
-.Dq Li "struct dbreg"
+.Do
+.Vt "struct dbreg"
+.Dc
(defined in
.Aq Pa machine/reg.h )
pointed to by
@@ -223,7 +233,9 @@ pointed to by
This request is the converse of
.Dv PT_GETDBREGS ;
it loads the traced process' debug registers from the
-.Dq Li "struct dbreg"
+.Do
+.Vt "struct dbreg"
+.Dc
(defined in
.Aq Pa machine/reg.h )
pointed to by
@@ -265,7 +277,7 @@ to
or
.Dv PT_WRITE_U
was not
-.Li int Ns \&-aligned.
+.Vt int Ns \-aligned .
.It
The signal number (in
.Fa data )
diff --git a/lib/libc/sys/recv.2 b/lib/libc/sys/recv.2
index 88d7a4a3e2de..1c543fd9475f 100644
--- a/lib/libc/sys/recv.2
+++ b/lib/libc/sys/recv.2
@@ -210,7 +210,7 @@ Process credentials can also be passed as ancillary data for
domain sockets using a
.Fa cmsg_type
of
-.Dv SCM_CREDS.
+.Dv SCM_CREDS .
In this case,
.Fa cmsg_data
should be a structure of type
diff --git a/lib/libc/sys/select.2 b/lib/libc/sys/select.2
index 70d679b607d4..16e6be2111e0 100644
--- a/lib/libc/sys/select.2
+++ b/lib/libc/sys/select.2
@@ -186,10 +186,8 @@ reasons,
.Fn select
will always examine the first 256 descriptors.
.Sh BUGS
-.Fn select
-should probably return the time remaining from the original timeout,
-if any, by modifying the time value in place.
-This may be implemented in future versions of the system.
+.St -susv2
+allows systems to modify the original timeout in place.
Thus, it is unwise to assume that the timeout value will be unmodified
by the
.Fn select
diff --git a/lib/libc/sys/semget.2 b/lib/libc/sys/semget.2
index cdcd9644801a..dc22c0ac272f 100644
--- a/lib/libc/sys/semget.2
+++ b/lib/libc/sys/semget.2
@@ -84,13 +84,13 @@ parameter:
Read access for user.
.It Dv SEM_A
Alter access for user.
-.It Dv (SEM_R>>3)
+.It Dv ( SEM_R>>3 )
Read access for group.
-.It Dv (SEM_A>>3)
+.It Dv ( SEM_A>>3 )
Alter access for group.
-.It Dv (SEM_R>>6)
+.It Dv ( SEM_R>>6 )
Read access for other.
-.It Dv (SEM_A>>6)
+.It Dv ( SEM_A>>6 )
Alter access for other.
.El
.Pp
diff --git a/lib/libc/sys/sendfile.2 b/lib/libc/sys/sendfile.2
index 5619891c36ce..e9d17b862dc2 100644
--- a/lib/libc/sys/sendfile.2
+++ b/lib/libc/sys/sendfile.2
@@ -69,7 +69,7 @@ struct sf_hdtr {
The
.Fa headers
and
-.Fa tailers
+.Fa trailers
pointers, if non-NULL, point to arrays of struct iovec structures.
See the
.Fn writev
diff --git a/lib/libc/sys/setreuid.2 b/lib/libc/sys/setreuid.2
index e2309257dc0d..f50b94c6e69b 100644
--- a/lib/libc/sys/setreuid.2
+++ b/lib/libc/sys/setreuid.2
@@ -70,10 +70,7 @@ the standard
.Fn setuid
function is preferred.
.Sh RETURN VALUES
-Upon successful completion, a value of 0 is returned. Otherwise,
-a value of -1 is returned and
-.Va errno
-is set to indicate the error.
+.Rv -std setreuid
.Sh ERRORS
.Bl -tag -width Er
.It Bq Er EPERM
diff --git a/lib/libc/sys/shmget.2 b/lib/libc/sys/shmget.2
index 88d3b4a4f582..05bc68cf66fe 100644
--- a/lib/libc/sys/shmget.2
+++ b/lib/libc/sys/shmget.2
@@ -82,13 +82,13 @@ parameter:
Read access for user.
.It Dv SHM_W
Write access for user.
-.It Dv (SHM_R>>3)
+.It Dv ( SHM_R>>3 )
Read access for group.
-.It Dv (SHM_W>>3)
+.It Dv ( SHM_W>>3 )
Write access for group.
-.It Dv (SHM_R>>6)
+.It Dv ( SHM_R>>6 )
Read access for other.
-.It Dv (SHM_W>>6)
+.It Dv ( SHM_W>>6 )
Write access for other.
.El
.\"
diff --git a/lib/libc/sys/socket.2 b/lib/libc/sys/socket.2
index 1cf4616b627e..7049bc102a7c 100644
--- a/lib/libc/sys/socket.2
+++ b/lib/libc/sys/socket.2
@@ -168,7 +168,7 @@ and
calls.
(Some protocol families, such as the Internet family,
support the notion of an
-.Dq implied connect,
+.Dq implied connect ,
which permits data to be sent piggybacked onto a connect operation by
using the
.Xr sendto 2