aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/sys
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/sys')
-rw-r--r--lib/libc/sys/Makefile.inc68
-rw-r--r--lib/libc/sys/accept.22
-rw-r--r--lib/libc/sys/acct.23
-rw-r--r--lib/libc/sys/brk.212
-rw-r--r--lib/libc/sys/chown.22
-rw-r--r--lib/libc/sys/close.24
-rw-r--r--lib/libc/sys/execve.225
-rw-r--r--lib/libc/sys/fork.23
-rw-r--r--lib/libc/sys/getsockopt.22
-rw-r--r--lib/libc/sys/intro.24
-rw-r--r--lib/libc/sys/ioctl.23
-rw-r--r--lib/libc/sys/kill.22
-rw-r--r--lib/libc/sys/ktrace.266
-rw-r--r--lib/libc/sys/lseek.24
-rw-r--r--lib/libc/sys/mknod.23
-rw-r--r--lib/libc/sys/mount.23
-rw-r--r--lib/libc/sys/open.23
-rw-r--r--lib/libc/sys/pipe.23
-rw-r--r--lib/libc/sys/read.22
-rw-r--r--lib/libc/sys/setpgid.22
-rw-r--r--lib/libc/sys/setregid.250
-rw-r--r--lib/libc/sys/setreuid.245
-rw-r--r--lib/libc/sys/setsid.267
-rw-r--r--lib/libc/sys/sigaction.22
-rw-r--r--lib/libc/sys/sigsuspend.22
-rw-r--r--lib/libc/sys/socket.24
-rw-r--r--lib/libc/sys/stat.24
-rw-r--r--lib/libc/sys/statfs.25
-rw-r--r--lib/libc/sys/sync.23
-rw-r--r--lib/libc/sys/uname.230
-rw-r--r--lib/libc/sys/unlink.23
-rw-r--r--lib/libc/sys/wait.27
-rw-r--r--lib/libc/sys/write.22
33 files changed, 339 insertions, 101 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index e138dce490e9..3deb3bbcc702 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -4,9 +4,9 @@
.PATH: ${.CURDIR}/${MACHINE}/sys ${.CURDIR}/sys
# modules with non-default implementations on at least one architecture:
-SRCS+= Ovfork.s brk.s cerror.s exect.s fork.s pipe.s ptrace.s reboot.s \
- sbrk.s setlogin.s sigpending.s sigprocmask.s sigreturn.s \
- sigsuspend.s syscall.s
+SRCS+= Ovfork.S brk.S cerror.S exect.S fork.S pipe.S ptrace.S reboot.S \
+ sbrk.S setlogin.S sigpending.S sigprocmask.S sigreturn.S \
+ sigsuspend.S syscall.S
# modules with default implementations on all architectures:
ASM= accept.o access.o acct.o adjtime.o async_daemon.o bind.o chdir.o \
@@ -19,51 +19,66 @@ ASM= accept.o access.o acct.o adjtime.o async_daemon.o bind.o chdir.o \
getpriority.o getrlimit.o getrusage.o getsockname.o getsockopt.o \
gettimeofday.o getuid.o ioctl.o kill.o ktrace.o link.o listen.o \
lseek.o lstat.o madvise.o mincore.o mkdir.o mkfifo.o mknod.o \
- mmap.o mount.o mprotect.o msync.o munmap.o nfssvc.o open.o \
+ mmap.o mount.o mprotect.o msgsys.o msync.o munmap.o nfssvc.o open.o \
profil.o quotactl.o read.o readlink.o readv.o recvfrom.o recvmsg.o \
- rename.o revoke.o rmdir.o select.o sendmsg.o sendto.o setdomainname.o \
- setegid.o seteuid.o setgid.o setgroups.o sethostid.o sethostname.o \
- setitimer.o setpgid.o setpriority.o setregid.o setreuid.o \
- setrlimit.o setsid.o setsockopt.o settimeofday.o setuid.o shmsys.o \
- shutdown.o sigaction.o sigstack.o socket.o socketpair.o stat.o \
- statfs.o swapon.o symlink.o sync.o truncate.o umask.o uname.o unlink.o \
- unmount.o utimes.o vadvise.o wait4.o write.o writev.o
+ rename.o revoke.o rmdir.o select.o semsys.o sendmsg.o sendto.o \
+ setdomainname.o setegid.o seteuid.o setgid.o setgroups.o sethostid.o \
+ sethostname.o setitimer.o setpgid.o setpriority.o setregid.o \
+ setreuid.o setrlimit.o setsid.o setsockopt.o settimeofday.o setuid.o \
+ shmsys.o shutdown.o sigaction.o sigstack.o socket.o socketpair.o \
+ stat.o statfs.o swapon.o symlink.o sync.o sysarch.o truncate.o \
+ umask.o uname.o unlink.o unmount.o utimes.o vadvise.o vm_allocate.o \
+ vm_deallocate.o vm_inherit.o vm_protect.o wait4.o write.o writev.o
-PSEUDO= _exit.o _getlogin.o
PASM= ${ASM:.o=.po}
+SASM= ${ASM:.o=.so}
+
+PSEUDO= _exit.o _getlogin.o
PPSEUDO= ${PSEUDO:.o=.po}
+SPSEUDO= ${PSEUDO:.o=.so}
OBJS+= ${ASM} ${PSEUDO}
POBJS+= ${PASM} ${PPSEUDO}
+SOBJS+= ${SASM} ${SPSEUDO}
${ASM}: ${.CURDIR}/${MACHINE}/SYS.h /usr/include/sys/syscall.h
@echo creating ${.PREFIX}.o
@printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
${CPP} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.PREFIX}.o
- @${LD} -x -r ${.PREFIX}.o
- @mv a.out ${.PREFIX}.o
+# @${LD} -x -r ${.PREFIX}.o
+# @mv a.out ${.PREFIX}.o
${PASM}: ${.CURDIR}/${MACHINE}/SYS.h /usr/include/sys/syscall.h
@echo creating ${.PREFIX}.po
@printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
${CPP} -DPROF ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.PREFIX}.po
- @${LD} -x -r ${.PREFIX}.po
- @mv a.out ${.PREFIX}.po
+# @${LD} -x -r ${.PREFIX}.po
+# @mv a.out ${.PREFIX}.po
+
+${SASM}: ${.CURDIR}/${MACHINE}/SYS.h /usr/include/sys/syscall.h
+ @echo creating ${.TARGET}
+ @printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \
+ ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -k -o ${.TARGET}
${PSEUDO}: ${.CURDIR}/${MACHINE}/SYS.h /usr/include/sys/syscall.h
@echo creating ${.PREFIX}.o
@printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
${CPP} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.PREFIX}.o
- @${LD} -x -r ${.PREFIX}.o
- @mv a.out ${.PREFIX}.o
+# @${LD} -x -r ${.PREFIX}.o
+# @mv a.out ${.PREFIX}.o
${PPSEUDO}: ${.CURDIR}/${MACHINE}/SYS.h /usr/include/sys/syscall.h
@echo creating ${.PREFIX}.po
@printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
${CPP} -DPROF ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.PREFIX}.po
- @${LD} -x -r ${.PREFIX}.po
- @mv a.out ${.PREFIX}.po
+# @${LD} -x -r ${.PREFIX}.po
+# @mv a.out ${.PREFIX}.po
+
+${SPSEUDO}: ${.CURDIR}/${MACHINE}/SYS.h /usr/include/sys/syscall.h
+ @echo creating ${.TARGET}
+ @printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \
+ ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -k -o ${.TARGET}
MAN2+= sys/accept.2 sys/access.2 sys/acct.2 sys/adjtime.2 sys/async_daemon.2 \
sys/bind.2 sys/brk.2 sys/chdir.2 sys/chflags.2 sys/chmod.2 sys/chown.2 \
@@ -81,12 +96,12 @@ MAN2+= sys/accept.2 sys/access.2 sys/acct.2 sys/adjtime.2 sys/async_daemon.2 \
sys/msync.2 sys/munmap.2 sys/nfssvc.2 sys/open.2 sys/pipe.2 \
sys/quotactl.2 sys/read.2 sys/readlink.2 sys/reboot.2 sys/recv.2 \
sys/rename.2 sys/rmdir.2 sys/select.2 sys/send.2 sys/setgroups.2 \
- sys/setpgid.2 sys/setregid.2 sys/setreuid.2 sys/shutdown.2 \
- sys/sigaction.2 sys/sigprocmask.2 sys/sigreturn.2 sys/sigstack.2 \
- sys/sigsuspend.2 sys/socket.2 sys/socketpair.2 sys/stat.2 \
- sys/statfs.2 sys/swapon.2 sys/symlink.2 sys/sync.2 sys/syscall.2 \
- sys/truncate.2 sys/umask.2 sys/uname.2 sys/unlink.2 sys/utimes.2 \
- sys/vfork.2 sys/wait.2 sys/write.2
+ sys/setpgid.2 sys/setregid.2 sys/setreuid.2 sys/setsid.2 \
+ sys/shutdown.2 sys/sigaction.2 sys/sigprocmask.2 sys/sigreturn.2 \
+ sys/sigstack.2 sys/sigsuspend.2 sys/socket.2 sys/socketpair.2 \
+ sys/stat.2 sys/statfs.2 sys/swapon.2 sys/symlink.2 sys/sync.2 \
+ sys/syscall.2 sys/truncate.2 sys/umask.2 sys/uname.2 sys/unlink.2 \
+ sys/utimes.2 sys/vfork.2 sys/wait.2 sys/write.2
MLINKS+=brk.2 sbrk.2
MLINKS+=dup.2 dup2.2
@@ -112,6 +127,7 @@ MLINKS+=mount.2 unmount.2
MLINKS+=read.2 readv.2
MLINKS+=recv.2 recvfrom.2 recv.2 recvmsg.2
MLINKS+=send.2 sendmsg.2 send.2 sendto.2
+MLINKS+=setpgid.2 setpgrp.2
MLINKS+=stat.2 fstat.2 stat.2 lstat.2
MLINKS+=statfs.2 fstatfs.2
MLINKS+=truncate.2 ftruncate.2
diff --git a/lib/libc/sys/accept.2 b/lib/libc/sys/accept.2
index 6a0feb356069..5f257776166d 100644
--- a/lib/libc/sys/accept.2
+++ b/lib/libc/sys/accept.2
@@ -110,7 +110,7 @@ can be thought of
as merely dequeueing the next connection
request and not implying confirmation.
Confirmation can be implied by a normal read or write on the new
-file desciptor, and rejection can be implied by closing the
+file descriptor, and rejection can be implied by closing the
new socket.
.Pp
One can obtain user connection request data without confirming
diff --git a/lib/libc/sys/acct.2 b/lib/libc/sys/acct.2
index 0a36e7be149c..42cb1eb7c83c 100644
--- a/lib/libc/sys/acct.2
+++ b/lib/libc/sys/acct.2
@@ -112,4 +112,5 @@ An I/O error occurred while reading from or writing to the file system.
.Sh HISTORY
An
.Nm
-function call appeared in Version 7 AT&T UNIX.
+function call appeared in
+.At v7 .
diff --git a/lib/libc/sys/brk.2 b/lib/libc/sys/brk.2
index 79cf8cd74c51..d580b6aea757 100644
--- a/lib/libc/sys/brk.2
+++ b/lib/libc/sys/brk.2
@@ -40,10 +40,10 @@
.Nd change data segment size
.Sh SYNOPSIS
.Fd #include <sys/types.h>
-.Ft char
-.Fn *brk "const char *addr"
+.Ft int
+.Fn brk "const char *addr"
.Ft char *
-.Fn *sbrk "int incr"
+.Fn sbrk "int incr"
.Sh DESCRIPTION
.Bf -symbolic
The brk and sbrk functions are historical curiosities
@@ -107,8 +107,7 @@ returns 0 if successful; -1 if the process requests more memory than
than allowed by the system limit.
The
.Nm sbrk
-function returns 0 if successful, otherwise the error
-.Er EOPNOTSUPP
+function returns the old break value if successful, otherwise a -1
is returned.
.\" .Sh ERRORS
.\" .Xr Sbrk
@@ -141,4 +140,5 @@ the data segment without consulting
.Sh HISTORY
A
.Nm
-function call appeared in Version 7 AT&T UNIX.
+function call appeared in
+.At v7 .
diff --git a/lib/libc/sys/chown.2 b/lib/libc/sys/chown.2
index 257e1d09b2ba..4eca4f5248f9 100644
--- a/lib/libc/sys/chown.2
+++ b/lib/libc/sys/chown.2
@@ -65,7 +65,7 @@ capability is restricted to the super-user.
.Fn Chown
clears the set-user-id and set-group-id bits
on the file
-to prevent accidental or mischievious creation of
+to prevent accidental or mischievous creation of
set-user-id and set-group-id programs.
.Pp
.Fn Fchown
diff --git a/lib/libc/sys/close.2 b/lib/libc/sys/close.2
index 8400214dbac3..16ca1dc3725d 100644
--- a/lib/libc/sys/close.2
+++ b/lib/libc/sys/close.2
@@ -64,7 +64,7 @@ all associated file descriptors are freed, but since there is
a limit on active descriptors per processes, the
.Fn close
function call
-is useful when a large quanitity of file descriptors are being handled.
+is useful when a large quantity of file descriptors are being handled.
.Pp
When a process forks (see
.Xr fork 2 ) ,
@@ -103,7 +103,7 @@ will fail if:
.Fa D
is not an active descriptor.
.It Bq Er EINTR
-An interupt was received.
+An interrupt was received.
.El
.Sh SEE ALSO
.Xr accept 2 ,
diff --git a/lib/libc/sys/execve.2 b/lib/libc/sys/execve.2
index 63cda1443b46..726de1f88448 100644
--- a/lib/libc/sys/execve.2
+++ b/lib/libc/sys/execve.2
@@ -29,18 +29,19 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)execve.2 6.9 (Berkeley) 3/10/91
+.\" From: @(#)execve.2 6.9 (Berkeley) 3/10/91
+.\" $Id: execve.2,v 1.2.2.1 1994/05/01 16:06:05 jkh Exp $
.\"
-.Dd March 10, 1991
+.Dd March 16, 1994
.Dt EXECVE 2
-.Os BSD 4
+.Os
.Sh NAME
.Nm execve
.Nd execute a file
.Sh SYNOPSIS
.Fd #include <unistd.h>
.Ft int
-.Fn execve "const char *path" "const * char *argv" "const * char *envp"
+.Fn execve "const char *path" "char *const *argv" "char *const *envp"
.Sh DESCRIPTION
.Fn Execve
transforms the calling process into a new process.
@@ -134,6 +135,15 @@ of the new process image file.
The real user ID, real group ID and
supplementary group IDs of the new process image remain the same as the calling
process image.
+In either case, the
+.Dv SUGID
+process flag bit is set, and remains set until
+cleared by another call to
+.Nm
+which does not execute a set-id executable. This flag can be inspected
+by the
+.Xr ps 1
+utility.
.Pp
The new process also inherits the following attributes from
the calling process:
@@ -224,10 +234,10 @@ is allowed by the imposed maximum
.It Bq Er E2BIG
The number of bytes in the new process's argument list
is larger than the system-imposed limit.
-The limit in the system as released is 20480 bytes
-.Pf ( Dv NCARGS
+The limit in the system as released is 32768 bytes
+.Pf ( Dv ARG_MAX
in
-.Ao Pa sys/param.h Ac ) .
+.Ao Pa limits.h Ac ) .
.It Bq Er EFAULT
The new process file is not as long as indicated by
the size values in its header.
@@ -250,6 +260,7 @@ the real
is ``root'', then the program has some of the powers
of a super-user as well.
.Sh SEE ALSO
+.Xr ps 1 ,
.Xr exit 2 ,
.Xr fork 2 ,
.Xr execl 3 ,
diff --git a/lib/libc/sys/fork.2 b/lib/libc/sys/fork.2
index 8c16ae7eda11..8b4419a4612c 100644
--- a/lib/libc/sys/fork.2
+++ b/lib/libc/sys/fork.2
@@ -104,4 +104,5 @@ There is insufficient swap space for the new process.
.Sh HISTORY
A
.Nm
-function call appeared in Version 6 AT&T UNIX.
+function call appeared in
+.At v6 .
diff --git a/lib/libc/sys/getsockopt.2 b/lib/libc/sys/getsockopt.2
index ceab2b6abe11..8f075a80af2f 100644
--- a/lib/libc/sys/getsockopt.2
+++ b/lib/libc/sys/getsockopt.2
@@ -207,7 +207,7 @@ to the appropriate network interface according to the network portion
of the destination address.
.Pp
.Dv SO_LINGER
-controls the action taken when unsent messags
+controls the action taken when unsent messages
are queued on socket and a
.Xr close 2
is performed.
diff --git a/lib/libc/sys/intro.2 b/lib/libc/sys/intro.2
index a05db39f4bc3..ca29ec5333b8 100644
--- a/lib/libc/sys/intro.2
+++ b/lib/libc/sys/intro.2
@@ -93,7 +93,7 @@ or
.Dv SIGQUIT )
was caught by the process during the execution of an interruptible
function. If the signal handler performs a normal return, the
-interupted function call will seem to have returned the error condition.
+interrupted function call will seem to have returned the error condition.
.It Er 5 EIO Em "Input/output error" .
Some physical input or output error occurred.
This error not be reported until a subsequent operation on the same file
@@ -376,7 +376,7 @@ which is now unavailable as referenced by the file descriptor.
This may indicate the file was deleted on the
.Tn NFS
server or some
-other catastrophic event occured.
+other catastrophic event occurred.
.It Er 72 EBADRPC Em "RPC struct is bad" .
Exchange of
.Tn RPC
diff --git a/lib/libc/sys/ioctl.2 b/lib/libc/sys/ioctl.2
index a90d0b8e9380..9e16641afe89 100644
--- a/lib/libc/sys/ioctl.2
+++ b/lib/libc/sys/ioctl.2
@@ -103,4 +103,5 @@ is not valid.
.Sh HISTORY
An
.Nm
-function call appeared in Version 7 AT&T UNIX.
+function call appeared in
+.At v7 .
diff --git a/lib/libc/sys/kill.2 b/lib/libc/sys/kill.2
index bdb553d96eb6..4f16c45c226d 100644
--- a/lib/libc/sys/kill.2
+++ b/lib/libc/sys/kill.2
@@ -62,7 +62,7 @@ This can be used to check the validity of
For a process to have permission to send a signal to a process designated
by
.Fa pid ,
-the real or effective user ID of the receving process must match
+the real or effective user ID of the receiving process must match
that of the sending process or the user must have appropriate privileges
(such as given by a set-user-ID program or the user is the super-user).
A single exception is the signal SIGCONT, which may always be sent
diff --git a/lib/libc/sys/ktrace.2 b/lib/libc/sys/ktrace.2
new file mode 100644
index 000000000000..81d5b95f3bf2
--- /dev/null
+++ b/lib/libc/sys/ktrace.2
@@ -0,0 +1,66 @@
+.\" Copyright (c) 1983 The Regents of the University of California.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)ktrace.2 1.0 (Berkeley) 1/4/94
+.\"
+.Dd Jan 4, 1994
+.Dt KTRACE 2
+.Os BSD 4.3
+.Sh NAME
+.Nm ktrace
+.Nd kernel call trace
+.Sh SYNOPSIS
+.Fd #include <sys/ktrace.h>
+.Ft int
+.Fn ktrace "const char *file" "int op" "int flag" "pid_t pid"
+.Sh DESCRIPTION
+.Fn Ktrace
+enables kernel trace logging for the specified processes.
+Kernel trace data is logged to the file
+.Pa file .
+The kernel operations that are traced include system calls, namei
+translations, signal processing, and
+.Tn I/O .
+
+needs to be written.
+.Sh RETURN VALUES
+needs to be written.
+.Sh ERRORS
+.Fn Ktrace
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EACCESS
+.It Bq Er EPERM
+.It Bq Er EINVAL
+.It Bq Er ESRCH
+The pid doesn't exist.
+.Sh SEE ALSO
+.Xr ktrace 1
diff --git a/lib/libc/sys/lseek.2 b/lib/libc/sys/lseek.2
index f6d8e88425c1..53db4c32da4a 100644
--- a/lib/libc/sys/lseek.2
+++ b/lib/libc/sys/lseek.2
@@ -92,7 +92,7 @@ The
function allows the file offset to be set beyond the end
of the existing end-of-file of the file. If data is later written
at this point, subsequent reads of the data in the gap return
-bytes of zeros (until data is actualy written into the gap).
+bytes of zeros (until data is actually written into the gap).
.Pp
Some devices are incapable of seeking. The value of the pointer
associated with such a device is undefined.
@@ -100,7 +100,7 @@ associated with such a device is undefined.
Upon successful completion,
.Fn lseek
returns the resulting offset location as measured in bytes from the
-begining of the file.
+beginning of the file.
Otherwise,
a value of -1 is returned and
.Va errno
diff --git a/lib/libc/sys/mknod.2 b/lib/libc/sys/mknod.2
index edd5926863ce..da8e870ea188 100644
--- a/lib/libc/sys/mknod.2
+++ b/lib/libc/sys/mknod.2
@@ -124,4 +124,5 @@ points outside the process's allocated address space.
.Sh HISTORY
A
.Nm
-function call appeared in Version 6 AT&T UNIX.
+function call appeared in
+.At v6 .
diff --git a/lib/libc/sys/mount.2 b/lib/libc/sys/mount.2
index d830f5f8b924..1c32a25957cf 100644
--- a/lib/libc/sys/mount.2
+++ b/lib/libc/sys/mount.2
@@ -314,4 +314,5 @@ Some of the error codes need translation to more obvious messages.
.Fn Mount
and
.Fn umount
-function calls appeared in Version 6 AT&T UNIX.
+function calls appeared in
+.At v6 .
diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2
index 21160c688b1a..b2234a37cc2d 100644
--- a/lib/libc/sys/open.2
+++ b/lib/libc/sys/open.2
@@ -251,4 +251,5 @@ An attempt was made to open a socket (not currently implemented).
.Sh HISTORY
An
.Nm
-function call appeared in Version 6 AT&T UNIX.
+function call appeared in
+.At v6 .
diff --git a/lib/libc/sys/pipe.2 b/lib/libc/sys/pipe.2
index a34cd34ee817..8844fe5caf90 100644
--- a/lib/libc/sys/pipe.2
+++ b/lib/libc/sys/pipe.2
@@ -112,4 +112,5 @@ space.
.Sh HISTORY
A
.Nm
-function call appeared in Version 6 AT&T UNIX.
+function call appeared in
+.At v6 .
diff --git a/lib/libc/sys/read.2 b/lib/libc/sys/read.2
index e96a27329242..9bea77c73f76 100644
--- a/lib/libc/sys/read.2
+++ b/lib/libc/sys/read.2
@@ -185,4 +185,4 @@ A
.Nm read
function call
appeared in
-Version 6 AT&T UNIX.
+.At v6 .
diff --git a/lib/libc/sys/setpgid.2 b/lib/libc/sys/setpgid.2
index cdf4fcca418c..8d2592de1025 100644
--- a/lib/libc/sys/setpgid.2
+++ b/lib/libc/sys/setpgid.2
@@ -32,7 +32,7 @@
.\" @(#)setpgid.2 6.3 (Berkeley) 3/10/91
.\"
.Dd March 10, 1991
-.Dt SETPGRP 2
+.Dt SETPGID 2
.Os BSD 4
.Sh NAME
.Nm setpgid ,
diff --git a/lib/libc/sys/setregid.2 b/lib/libc/sys/setregid.2
index 70a368ee5172..86b0aa7949be 100644
--- a/lib/libc/sys/setregid.2
+++ b/lib/libc/sys/setregid.2
@@ -29,11 +29,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)setregid.2 6.4 (Berkeley) 3/10/91
+.\" From: @(#)setregid.2 6.4 (Berkeley) 3/10/91
+.\" $Id: setregid.2,v 1.1.1.1.2.1 1994/05/01 16:06:13 jkh Exp $
.\"
-.Dd March 10, 1991
+.Dd March 16, 1994
.Dt SETREGID 2
-.Os BSD 4.2
+.Os
.Sh NAME
.Nm setregid
.Nd set real and effective group ID
@@ -42,15 +43,42 @@
.Ft int
.Fn setregid "int rgid" "int egid"
.Sh DESCRIPTION
-The real and effective group ID's of the current process
-are set to the arguments.
-Unprivileged users may change the real group
-ID to the effective group ID and vice-versa; only the super-user may
-make other changes.
+NB: In
+.Fx 1.0.2
+and earlier versions, this function would set the real and effective
+group ID's of the current process according to the arguments. In
+.Fx 1.1 ,
+we have adopted the behavior of
+.Bx 4.4 .
.Pp
-Supplying a value of -1 for either the real or effective
-group ID forces the system to substitute the current
-ID in place of the -1 parameter.
+The
+.Nm
+function is normally used by programs which wish to temporarily
+renounce special privileges they have gained (usually as a result of
+being set-gid executables), by swapping real and effective
+group ID's, so that the renunciation is reversible.
+This can result in a security hole, and does not integrate well with
+the
+.Tn POSIX
+saved group ID. In
+.Fx 1.1 ,
+the
+.Nm
+function will never actually set the real group ID; however, it will
+check its value to ensure that a future
+.Xr setegid 2
+call with the
+.Fa rgid
+argument will succeed.
+.Pp
+If
+.Fa rgid
+or
+.Fa egid
+is -1, the current ID is filled in by the system.
+The effective group ID is set, if requested, as if
+.Xr setegid 2
+had been called.
.Sh RETURN VALUES
Upon successful completion, a value of 0 is returned. Otherwise,
a value of -1 is returned and
diff --git a/lib/libc/sys/setreuid.2 b/lib/libc/sys/setreuid.2
index 061141ef278a..de34b029ab57 100644
--- a/lib/libc/sys/setreuid.2
+++ b/lib/libc/sys/setreuid.2
@@ -29,11 +29,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)setreuid.2 6.4 (Berkeley) 3/10/91
+.\" From: @(#)setreuid.2 6.4 (Berkeley) 3/10/91
+.\" $Id: setreuid.2,v 1.1.1.1.2.1 1994/05/01 16:06:14 jkh Exp $
.\"
-.Dd March 10, 1991
+.Dd March 16, 1994
.Dt SETREUID 2
-.Os BSD 4
+.Os
.Sh NAME
.Nm setreuid
.Nd set real and effective user ID's
@@ -42,16 +43,42 @@
.Ft int
.Fn setreuid "int ruid" "int euid"
.Sh DESCRIPTION
-The real and effective user ID's of the
-current process are set according to the arguments.
+Note: In
+.Fx 1.0.2
+and earlier versions, this function would set the real and effective
+user ID's of the current process according to the arguments. In
+.Fx 1.1
+we have adopted the behavior of
+.Bx 4.4 .
+.Pp
+The
+.Nm
+function is normally used by programs which wish to temporarily
+renounce special privileges they have gained (usually as a result of
+being set-uid executables), by swapping real and effective
+user ID's, so that the renunciation is reversible.
+This can result in a security hole, and does not integrate well with
+the
+.Tn POSIX
+saved user ID. In
+.Fx 1.1 ,
+the
+.Nm
+function will never actually set the real user ID; however, it will
+check its value to ensure that a future
+.Xr seteuid 2
+call with the
+.Fa ruid
+argument will succeed.
+.Pp
If
.Fa ruid
or
.Fa euid
-is -1, the current uid is filled in by the system.
-Unprivileged users may change the real user
-ID to the effective user ID and vice-versa; only the super-user may
-make other changes.
+is -1, the current ID is filled in by the system.
+The effective user ID is set, if requested, as if
+.Xr seteuid 2
+had been called.
.Sh RETURN VALUES
Upon successful completion, a value of 0 is returned. Otherwise,
a value of -1 is returned and
diff --git a/lib/libc/sys/setsid.2 b/lib/libc/sys/setsid.2
new file mode 100644
index 000000000000..b4ff4db9a961
--- /dev/null
+++ b/lib/libc/sys/setsid.2
@@ -0,0 +1,67 @@
+.\" Copyright (c) 1994 Christoph M. Robitschko
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Christoph M. Robitschko
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software withough specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.Dd January 28, 1994
+.Dt SETSID 2
+.Os FreeBSD
+.Sh NAME
+.Nm setsid
+.Nd create session and set process group ID
+.Sh SYNOPSIS
+.Fd #include <sys/types.h>
+.Ft pid_t
+.Fn setsid
+.Sh DESCRIPTION
+If the calling process is not a process group leader, the
+.Fn setsid
+function creates a new session and a new process group.
+The calling process is the session leader and process group leader, and
+has no controlling terminal.
+The ID of the process group is set to the process ID of the calling process.
+The calling process is the only member of the new session and of the new
+process group.
+.Sh RETURN VALUES
+.Fn Setsid
+returns the value of the new process group ID when the operation was successful.
+If the request failed, -1 is returned and the global variable
+.Va errno
+indicates the reason.
+.Sh ERRORS
+.Fn Setsid
+will fail if:
+.Bl -tag -width indent
+.It Bq Er EPERM
+The calling process is already a process group leader, or the process group ID
+of another process matches the process ID of the calling process.
+.El
+.Sh SEE ALSO
+.Xr getpid 2 ,
+.Xr setpgid 2
+.Sh STANDARDS
+.Fn Setpgid
+conforms to IEEE Std 1003.1-1988
+.Pq Dq Tn POSIX .
diff --git a/lib/libc/sys/sigaction.2 b/lib/libc/sys/sigaction.2
index 13c2c5020e58..635512126614 100644
--- a/lib/libc/sys/sigaction.2
+++ b/lib/libc/sys/sigaction.2
@@ -49,7 +49,7 @@ struct sigaction {
.Fn sigaction "int sig" "struct sigaction *act" "struct sigaction *oact"
.Sh DESCRIPTION
The system defines a set of signals that may be delivered to a process.
-Signal delivery resembles the occurence of a hardware interrupt:
+Signal delivery resembles the occurrence of a hardware interrupt:
the signal is blocked from further occurrence, the current process
context is saved, and a new one is built. A process may specify a
.Em handler
diff --git a/lib/libc/sys/sigsuspend.2 b/lib/libc/sys/sigsuspend.2
index f4167dc9784b..8e0c73001c10 100644
--- a/lib/libc/sys/sigsuspend.2
+++ b/lib/libc/sys/sigsuspend.2
@@ -36,7 +36,7 @@
.Os
.Sh NAME
.Nm sigsuspend
-.Nd atomically release blocked signals and wait for interrupt
+.Nd automatically release blocked signals and wait for interrupt
.Sh SYNOPSIS
.Fd #include <sys/signal.h>
.Ft int
diff --git a/lib/libc/sys/socket.2 b/lib/libc/sys/socket.2
index 48427b4a9459..6738badd82d1 100644
--- a/lib/libc/sys/socket.2
+++ b/lib/libc/sys/socket.2
@@ -56,11 +56,11 @@ These families are defined in the include file
The currently understood formats are
.Pp
.Bd -literal -offset indent -compact
-AF_UNIX (UNIX internal protocols),
+AF_UNIX (operating-system internal protocols),
AF_INET (ARPA Internet protocols),
AF_ISO (ISO protocols),
AF_NS (Xerox Network Systems protocols), and
-AF_IMPLINK (IMP \*(lqhost at IMP\*(rq link layer).
+AF_CCITT (ITU-T X.25 protocols).
.Ed
.Pp
The socket has the indicated
diff --git a/lib/libc/sys/stat.2 b/lib/libc/sys/stat.2
index 8509716aef41..b99b79e46123 100644
--- a/lib/libc/sys/stat.2
+++ b/lib/libc/sys/stat.2
@@ -55,7 +55,7 @@ function obtains information about the file pointed to by
.Fa path .
Read, write or execute
permission of the named file is not required, but all directories
-listed in the path name leading to the file must be seachable.
+listed in the path name leading to the file must be searchable.
.Pp
.Fn Lstat
is like
@@ -91,7 +91,7 @@ struct stat {
dev_t st_dev; /* device inode resides on */
ino_t st_ino; /* inode's number */
mode_t st_mode; /* inode protection mode */
- nlink_t st_nlink; /* number or hard links to the file */
+ nlink_t st_nlink; /* number of hard links to the file */
uid_t st_uid; /* user-id of owner */
gid_t st_gid; /* group-id of owner */
dev_t st_rdev; /* device type, for special file inode */
diff --git a/lib/libc/sys/statfs.2 b/lib/libc/sys/statfs.2
index 8a870878e250..4433e56152f9 100644
--- a/lib/libc/sys/statfs.2
+++ b/lib/libc/sys/statfs.2
@@ -79,7 +79,10 @@ char f_mntfromname[MNAMELEN]; /* mounted filesystem */
#define MOUNT_UFS 1
#define MOUNT_NFS 2
#define MOUNT_MFS 3
-#define MOUNT_PC 4
+#define MOUNT_MSDOS 4
+#define MOUNT_ISOFS 5
+#define MOUNT_PROCFS 6
+#define MOUNT_DEVFS 7
.Ed
.Pp
Fields that are undefined for a particular file system are set to -1.
diff --git a/lib/libc/sys/sync.2 b/lib/libc/sys/sync.2
index dd945e528415..02be22148dbd 100644
--- a/lib/libc/sys/sync.2
+++ b/lib/libc/sys/sync.2
@@ -70,4 +70,5 @@ may return before the buffers are completely flushed.
.Sh HISTORY
A
.Nm
-function call appeared in Version 6 AT&T UNIX.
+function call appeared in
+.At v6 .
diff --git a/lib/libc/sys/uname.2 b/lib/libc/sys/uname.2
index 4097375188ed..bb4c7edcd41f 100644
--- a/lib/libc/sys/uname.2
+++ b/lib/libc/sys/uname.2
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)uname.2 6.6 (Berkeley) 3/10/91
-.\" $Id: uname.2,v 1.1 1993/10/08 01:06:55 jkh Exp $
+.\" $Id: uname.2,v 1.2 1994/02/03 00:51:14 wollman Exp $
.\"
.Dd March 29, 1993
.Dt UNAME 2
@@ -43,8 +43,10 @@
.Ft int
.Fn uname "struct utsname *name"
.Sh DESCRIPTION
-.Fn Uname
-returns the information identifying the current UNIX system
+The
+.Fn uname
+function
+returns the information identifying the current operating system
in the structure pointed to by
.Fa name.
.Pp
@@ -62,25 +64,33 @@ struct utsname {
};
.Ed
.Pp
-.Fn Uname
+The
+.Fn uname
+function
returns a null-terminated character string naming the
-current UNIX system in the character array
+current operating system in the character array
.Fa sysname .
Similarly,
.Fa nodename
contains the name that the system is known by on a
communication network.
-.Fa Release
+The
+.Fa release
and
.Fa version
+fields
further identify the operating system.
-.Fa Machine
+The
+.Fa machine
+field
contains the standard name that identifies the hardware
-that the UNIX system is running on.
+that the operating system is running on.
.Sn ERRORS
.Bl -tag -width ENAMETOOLONGAA
.It Bq Er EFAULT
-.Fn Uname
+The
+.Fn uname
+function
will fail if
.Fa name
points to an invalid address.
@@ -97,4 +107,4 @@ is set to indicate the error.
The
.Nm uname
function call appeared in
-System V.2 AT&T UNIX.
+.At V.2 .
diff --git a/lib/libc/sys/unlink.2 b/lib/libc/sys/unlink.2
index 304b284c1935..668c2814086b 100644
--- a/lib/libc/sys/unlink.2
+++ b/lib/libc/sys/unlink.2
@@ -108,4 +108,5 @@ points outside the process's allocated address space.
.Sh HISTORY
An
.Nm
-function call appeared in Version 6 AT&T UNIX.
+function call appeared in
+.At v6 .
diff --git a/lib/libc/sys/wait.2 b/lib/libc/sys/wait.2
index b5a2a7cd11c5..004872f9b2ab 100644
--- a/lib/libc/sys/wait.2
+++ b/lib/libc/sys/wait.2
@@ -39,7 +39,7 @@
.Nm waitpid ,
.Nm wait4 ,
.Nm wait3
-.Nd wait for process terminatation
+.Nd wait for process termination
.Sh SYNOPSIS
.Fd #include <sys/types.h>
.Fd #include <sys/wait.h>
@@ -72,7 +72,7 @@ The
.Fn wait4
call provides a more general interface for programs
that need to wait for certain child processes,
-that need resource utilization statistics accummulated by child processes,
+that need resource utilization statistics accumulated by child processes,
or that require options.
The other wait functions are implemented using
.Fn wait4 .
@@ -292,4 +292,5 @@ call are extensions to the POSIX interface.
.Sh HISTORY
A
.Nm
-function call appeared in Version 6 AT&T UNIX.
+function call appeared in
+.At v6 .
diff --git a/lib/libc/sys/write.2 b/lib/libc/sys/write.2
index f7d1f0533917..4b00e3d21079 100644
--- a/lib/libc/sys/write.2
+++ b/lib/libc/sys/write.2
@@ -200,4 +200,4 @@ A
.Nm write
function call
appeared in
-Version 6 AT&T UNIX.
+.At v6 .