diff --git a/lib/libc/sys/_exit.2 b/lib/libc/sys/_exit.2 index 65d99b099a13..0308bc62952a 100644 --- a/lib/libc/sys/_exit.2 +++ b/lib/libc/sys/_exit.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: _exit.2,v 1.8 1997/07/14 23:19:49 kleink Exp $ +.\" $NetBSD: _exit.2,v 1.9 1998/04/28 22:28:30 fair Exp $ .\" .\" Copyright (c) 1980, 1993 .\" The Regents of the University of California. All rights reserved. @@ -46,8 +46,7 @@ .Sh DESCRIPTION The .Fn _exit -function -terminates a process with the following consequences: +function terminates a process with the following consequences: .Bl -bullet .It All of the descriptors open in the calling process are closed. @@ -55,7 +54,7 @@ This may entail delays, for example, waiting for output to drain; a process in this state may not be killed, as it is already dying. .It If the parent process of the calling process has an outstanding -.Xr wait +.Xr wait 2 call or catches the .Dv SIGCHLD @@ -109,6 +108,6 @@ can never return. .Xr exit 3 .Sh STANDARDS The -.Nm _exit +.Fn _exit function conforms to .St -p1003.1-90 . diff --git a/lib/libc/sys/brk.2 b/lib/libc/sys/brk.2 index 0c9da0d824aa..281d8734af86 100644 --- a/lib/libc/sys/brk.2 +++ b/lib/libc/sys/brk.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: brk.2,v 1.10 1998/02/02 05:20:25 perry Exp $ +.\" $NetBSD: brk.2,v 1.11 1998/04/28 22:28:30 fair Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -54,9 +54,8 @@ left over from earlier days before the advent of virtual memory management. .Pp The .Fn brk -function -sets the break or lowest address -of a process's data segment (uninitialized data) to +function sets the break or lowest address of a process's data +segment (uninitialized data) to .Fa addr (immediately above bss). Data addressing is restricted between @@ -67,8 +66,8 @@ Memory is allocated by in page size pieces; if .Fa addr -is not evenly divisible by the system page size, it is -increased to the next page boundary. +is not evenly divisible by the system page size, it is increased +to the next page boundary. .Pp .\" The .\" .Nm sbrk @@ -85,7 +84,7 @@ increased to the next page boundary. .\" .Pp The current value of the program break is reliably returned by .Dq Li sbrk(0) -(see also +(see also .Xr end 3 ) . The .Xr getrlimit 2 @@ -97,7 +96,7 @@ it will not be possible to set the break beyond the .Em rlim_max value returned from a call to -.Xr getrlimit , +.Xr getrlimit 2 , e.g. .Dq etext + rlp\(->rlim_max. (see @@ -141,13 +140,12 @@ to support the expansion. .Xr malloc 3 , .Xr end 3 .Sh BUGS -Setting the break may fail due to a temporary lack of -swap space. It is not possible to distinguish this -from a failure caused by exceeding the maximum size of -the data segment without consulting -.Xr getrlimit . +Setting the break may fail due to a temporary lack of swap space. +It is not possible to distinguish this from a failure caused by +exceeding the maximum size of the data segment without consulting +.Xr getrlimit 2 . .Sh HISTORY A .Fn brk -function call appeared in +function call appeared in .At v7 . diff --git a/lib/libc/sys/close.2 b/lib/libc/sys/close.2 index a777f2298cee..f1c57bfd6433 100644 --- a/lib/libc/sys/close.2 +++ b/lib/libc/sys/close.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: close.2,v 1.6 1997/07/14 23:19:53 kleink Exp $ +.\" $NetBSD: close.2,v 1.7 1998/04/28 22:28:30 fair Exp $ .\" .\" Copyright (c) 1980, 1991, 1993, 1994 .\" The Regents of the University of California. All rights reserved. @@ -46,52 +46,63 @@ .Sh DESCRIPTION The .Fn close -call deletes a descriptor from the per-process object +system call deletes a descriptor from the per-process object reference table. If this is the last reference to the underlying object, the object will be deactivated. -For example, on the last close of a file -the current +For example, on the last close of a file the current .Em seek -pointer associated with the file is lost; -on the last close of a +pointer associated with the file is lost; on the last close of a .Xr socket 2 -associated naming information and queued data are discarded; -on the last close of a file holding an advisory lock -the lock is released (see further +associated naming information and queued data are discarded; on +the last close of a file holding an advisory lock the lock is +released (see .Xr flock 2 ) . .Pp -When a process exits, -all associated file descriptors are freed, but since there is -a limit on active descriptors per processes, the +When a process exits, all associated descriptors are freed, but +since there is a limit on active descriptors per processes, the .Fn close -function call +system call is useful when a large quantity of file descriptors are being handled. .Pp -When a process forks (see -.Xr fork 2 ) , +When a process calls +.Xr fork 2 , all descriptors for the new child process reference the same -objects as they did in the parent before the fork. +objects as they did in the parent before the +.Fn fork . If a new process is then to be run using .Xr execve 2 , -the process would normally inherit these descriptors. Most -of the descriptors can be rearranged with +the process would normally inherit these descriptors. +Most of the descriptors can be rearranged with .Xr dup2 2 or deleted with .Fn close before the -.Xr execve -is attempted, but if some of these descriptors will still -be needed if the execve fails, it is necessary to arrange for them -to be closed if the execve succeeds. -For this reason, the call -.Dq Li fcntl(d, F_SETFD, 1) +.Fn execve +is attempted, but if some of these descriptors will still be needed if the +.Fn execve +fails, it is necessary to arrange for them to be closed only if the +.Fn execve +succeeds. +For this reason, the system call +.Bl -item -offset indent +.It +.Fn fcntl d F_SETFD 1 ; +.El +.Pp is provided, -which arranges that a descriptor will be closed after a successful -execve; the call -.Dq Li fcntl(d, F_SETFD, 0) -restores the default, -which is to not close the descriptor. +which arranges that a descriptor +.Dq Fa d +will be closed after a successful +.Fn execve ; +the system call +.Bl -item -offset indent +.It +.Fn fcntl d F_SETFD 0 ; +.El +.Pp +restores the default, which is to not close descriptor +.Dq Fa d . .Sh RETURN VALUES Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and the global integer variable @@ -109,13 +120,13 @@ An interrupt was received. .El .Sh SEE ALSO .Xr accept 2 , +.Xr execve 2 , +.Xr fcntl 2 , .Xr flock 2 , .Xr open 2 , .Xr pipe 2 , .Xr socket 2 , -.Xr socketpair 2 , -.Xr execve 2 , -.Xr fcntl 2 +.Xr socketpair 2 .Sh STANDARDS The .Fn close diff --git a/lib/libc/sys/fcntl.2 b/lib/libc/sys/fcntl.2 index f5abcd687432..ba3700a3620c 100644 --- a/lib/libc/sys/fcntl.2 +++ b/lib/libc/sys/fcntl.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: fcntl.2,v 1.11 1997/11/06 10:44:09 fair Exp $ +.\" $NetBSD: fcntl.2,v 1.12 1998/04/28 22:28:30 fair Exp $ .\" .\" Copyright (c) 1983, 1993 .\" The Regents of the University of California. All rights reserved. @@ -38,7 +38,7 @@ .Os BSD 4.2 .Sh NAME .Nm fcntl -.Nd file control +.Nd file descriptor control .Sh SYNOPSIS .Fd #include .Ft int @@ -172,7 +172,7 @@ taken as a pointer to a .Fa "struct flock" (see above). The information retrieved overwrites the information passed to -.Nm fcntl +.Nm in the .Fa flock structure. @@ -195,7 +195,7 @@ or exclusive (or write) locks, as well as remove either type of lock .Dv (F_UNLCK) . If a shared or exclusive lock cannot be set, -.Nm fcntl +.Nm returns immediately with .Er EAGAIN . .It Dv F_SETLKW @@ -204,9 +204,9 @@ This command is the same as except that if a shared or exclusive lock is blocked by other locks, the process waits until the request can be satisfied. If a signal that is to be caught is received while -.Nm fcntl +.Nm is waiting for a region, the -.Nm fcntl +.Nm will be interrupted if the signal handler has not specified the .Dv SA_RESTART (see @@ -289,7 +289,9 @@ request fails or blocks respectively when another process has existing locks on bytes in the specified region and the type of any of those locks conflicts with the type specified in the request. .Pp -This interface follows the completely stupid semantics of System V and +This interface follows the completely stupid semantics of +.At V +and .St -p1003.1-88 that require that all locks associated with a file for a given process are removed when \fIany\fP file descriptor for that file is closed by that process. @@ -297,10 +299,10 @@ This semantic means that applications must be aware of any files that a subroutine library may access. For example if an application for updating the password file locks the password file database while making the update, and then calls -.Xr getpwname 3 +.Xr getpwnam 3 to retrieve a record, the lock will be lost because -.Xr getpwname 3 +.Xr getpwnam 3 opens, reads, and closes the password database. The database close will release all locks that the process has associated with the database, even if the library routine never @@ -313,7 +315,8 @@ The .Xr flock 2 interface has much more rational last close semantics and allows locks to be inherited by child processes. -.Xr Flock 2 +Calling +.Xr flock 2 is recommended for applications that want to ensure the integrity of their locks when using library routines or wish to pass locks to their children. @@ -475,7 +478,7 @@ the process ID given as argument is not in use. .Xr flock 2 , .Xr open 2 , .Xr getdtablesize 3 , -.Xr sigaction 3 +.Xr sigaction 2 .Sh STANDARDS The .Fn fcntl diff --git a/lib/libc/sys/fork.2 b/lib/libc/sys/fork.2 index 312a31bc41ee..844d5b3b71bc 100644 --- a/lib/libc/sys/fork.2 +++ b/lib/libc/sys/fork.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: fork.2,v 1.8 1997/07/14 23:19:57 kleink Exp $ +.\" $NetBSD: fork.2,v 1.9 1998/04/28 22:28:31 fair Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -62,9 +62,9 @@ for instance, file pointers in file objects are shared between the child and the parent, so that an .Xr lseek 2 on a descriptor in the child process can affect a subsequent -.Xr read +.Xr read 2 or -.Xr write +.Xr write 2 by the parent. This descriptor copying is also used by the shell to establish standard input and output for newly created processes @@ -79,9 +79,9 @@ Upon successful completion, .Fn fork returns a value of 0 to the child process and returns the process ID of the child -process to the parent process. Otherwise, a value of -1 is returned -to the parent process, no child process is created, and the global -variable +process to the parent process. +Otherwise, a value of -1 is returned to the parent process, no +child process is created, and the global variable .Va errno is set to indicate the error. .Sh ERRORS @@ -112,5 +112,5 @@ function conforms to .Sh HISTORY A .Fn fork -function call appeared in +system call appeared in .At v6 . diff --git a/lib/libc/sys/getrlimit.2 b/lib/libc/sys/getrlimit.2 index bb1e196bedc2..0874f9cdded9 100644 --- a/lib/libc/sys/getrlimit.2 +++ b/lib/libc/sys/getrlimit.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: getrlimit.2,v 1.10 1997/07/16 06:05:58 mikel Exp $ +.\" $NetBSD: getrlimit.2,v 1.11 1998/04/28 22:28:31 fair Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -62,7 +62,7 @@ parameter is one of the following: .Bl -tag -width RLIMIT_FSIZEAA .It Li RLIMIT_CORE The largest size (in bytes) -.Xr core +.Pa core file that may be created. .It Li RLIMIT_CPU The maximum amount of cpu time (in seconds) to be used by @@ -131,7 +131,7 @@ is thus a built-in command to .Pp The system refuses to extend the data or stack space when the limits would be exceeded in the normal way: a -.Xr break +.Xr brk 2 call fails if the data space limit is reached. When the stack limit is reached, the process receives a segmentation fault diff --git a/lib/libc/sys/getsockname.2 b/lib/libc/sys/getsockname.2 index ee0e914244a2..8387c6e99d10 100644 --- a/lib/libc/sys/getsockname.2 +++ b/lib/libc/sys/getsockname.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: getsockname.2,v 1.7 1998/04/28 06:00:53 fair Exp $ +.\" $NetBSD: getsockname.2,v 1.8 1998/04/28 22:28:31 fair Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -44,16 +44,18 @@ .Ft int .Fn getsockname "int s" "struct sockaddr *name" "int *namelen" .Sh DESCRIPTION -.Fn Getsockname -returns the current +The +.Fn getsockname +system call returns the current .Fa name -for the specified socket. The +for the specified socket. +The .Fa namelen -parameter should be initialized to indicate -the amount of space pointed to by +parameter should be initialized to indicate the amount of space +pointed to by .Fa name . -On return it contains the actual size of the name -returned (in bytes). +On return it contains the actual size of the name returned (in +bytes). .Sh DIAGNOSTICS A 0 is returned if the call succeeds, -1 if it fails. .Sh ERRORS @@ -68,13 +70,11 @@ The argument .Fa s is a file, not a socket. .It Bq Er ENOBUFS -Insufficient resources were available in the system -to perform the operation. +Insufficient resources were available in the system to perform the operation. .It Bq Er EFAULT The .Fa name -parameter points to memory not in a valid part of the -process address space. +parameter points to memory not in a valid part of the process address space. .El .Sh SEE ALSO .Xr bind 2 , @@ -83,7 +83,7 @@ process address space. Names bound to sockets in the .Ux domain are inaccessible; -.Xr getsockname +.Fn getsockname returns a zero length name. .Sh HISTORY The diff --git a/lib/libc/sys/getsockopt.2 b/lib/libc/sys/getsockopt.2 index e3a0daeb9b42..e64180373c1b 100644 --- a/lib/libc/sys/getsockopt.2 +++ b/lib/libc/sys/getsockopt.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: getsockopt.2,v 1.12 1998/02/02 05:20:29 perry Exp $ +.\" $NetBSD: getsockopt.2,v 1.13 1998/04/28 22:28:31 fair Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -186,24 +186,24 @@ of the destination address. .Pp .Dv SO_LINGER controls the action taken when unsent messages -are queued on socket and a +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, -the system will block the process on the -.Xr close +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 is unable to deliver the information (a timeout period, measured in seconds, termed the linger interval, is specified in the .Fn setsockopt call when .Dv SO_LINGER -is requested). +is requested). If .Dv SO_LINGER -is disabled and a -.Xr close +is disabled and a +.Xr close 2 is issued, the system will process the close in a manner that allows the process to continue as quickly as possible. .Pp @@ -217,9 +217,9 @@ With protocols that support out-of-band data, the option requests that out-of-band data be placed in the normal data input queue as received; it will then be accessible with -.Xr recv +.Xr recv 2 or -.Xr read +.Xr read 2 calls without the .Dv MSG_OOB flag. @@ -257,7 +257,7 @@ requested. The default value for .Dv SO_RCVLOWAT is 1. -If +If .Dv SO_RCVLOWAT is set to a larger value, blocking receive calls normally wait until they have received the smaller of the low water mark value @@ -301,7 +301,7 @@ If the option is enabled on a .Dv SOCK_DGRAM socket, the -.Xr recvmsg +.Xr recvmsg 2 call will return a timestamp corresponding to when the datagram was received. The msg_control field in the msghdr structure points to a buffer @@ -344,7 +344,7 @@ is a file, not a socket. .It Bq Er ENOPROTOOPT The option is unknown at the level indicated. .It Bq Er EFAULT -The address pointed to by +The address pointed to by .Fa optval is not in a valid part of the process address space. For diff --git a/lib/libc/sys/msgctl.2 b/lib/libc/sys/msgctl.2 index c3f8eccb3c2b..e9d8a491425a 100644 --- a/lib/libc/sys/msgctl.2 +++ b/lib/libc/sys/msgctl.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: msgctl.2,v 1.4 1997/11/27 10:24:44 mikel Exp $ +.\" $NetBSD: msgctl.2,v 1.5 1998/04/28 22:28:31 fair Exp $ .\" .\" Copyright (c) 1995 Frank van der Linden .\" All rights reserved. @@ -116,7 +116,7 @@ The values are taken from the corresponding fields in the structure pointed to by .Fa buf . This operation can only be executed by the super-user, or a process that -has an effective user id equal to either +has an effective user id equal to either .Va msg_perm.cuid or .Va msg_perm.uid @@ -125,7 +125,7 @@ The value of .Va msg_qbytes can only be increased by the super-user. Values for .Va msg_qbytes -that exceed the system limit +that exceed the system limit .Pf ( Dv MSGMNB from .Aq Pa sys/msg.h ) @@ -134,7 +134,7 @@ are silently truncated to that limit. Remove the message queue specified by .Fa msqid and destroy the data associated with it. Only the super-user or a process -with an effective uid equal to the +with an effective uid equal to the .Va msg_perm.cuid or .Va msg_perm.uid diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2 index 2ea80fb9a42d..0574b99ba0e4 100644 --- a/lib/libc/sys/open.2 +++ b/lib/libc/sys/open.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: open.2,v 1.12 1998/01/15 02:30:18 thorpej Exp $ +.\" $NetBSD: open.2,v 1.13 1998/04/28 22:28:31 fair Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -55,8 +55,9 @@ The .Fa flags are specified by .Em or Ns 'ing -the following values. Applications must specify exactly one -of the first three values (file access modes): +the following values. +Applications must specify exactly one of the first three values +(file access modes): .Bl -tag -offset indent -width O_NONBLOCK .It Dv O_RDONLY Open for reading only. @@ -92,7 +93,8 @@ Atomically obtain a shared lock. Atomically obtain an exclusive lock. .It Dv O_SYNC If set, each write will wait for both the file data and file status -to be committed to stable storage. This is an extension to +to be committed to stable storage. +This is an extension to .Fn open defined in .St -xpg4.2 . @@ -101,10 +103,12 @@ defined in Opening a file with .Dv O_APPEND set causes each write on the file -to be appended to the end. If +to be appended to the end. +If .Dv O_TRUNC is specified and the file exists, the file is truncated to zero length. +.Pp If .Dv O_EXCL is set with @@ -112,8 +116,8 @@ is set with and the file already exists, .Fn open -returns an error. This may be used to -implement a simple exclusive access locking mechanism. +returns an error. +This may be used to implement a simple exclusive access locking mechanism. If .Dv O_EXCL is set and the last component of the pathname is @@ -121,10 +125,12 @@ a symbolic link, .Fn open will fail even if the symbolic link points to a non-existent name. +.Pp If the .Dv O_NONBLOCK flag is specified, do not wait for the device or file to be ready or -available. If the +available. +If the .Fn open call would result in the process being blocked for some reason (e.g., waiting for @@ -156,7 +162,7 @@ When a new file is created it is given the group of the directory which contains it. .Pp The new descriptor is set to remain open across -.Xr execve +.Xr execve 2 system calls; see .Xr close 2 and @@ -164,7 +170,8 @@ and .Pp The system imposes a limit on the number of file descriptors open simultaneously by one process. -.Xr Getdtablesize 3 +Calling +.Xr getdtablesize 3 returns the current system limit. .Sh ERRORS The named file is opened unless: diff --git a/lib/libc/sys/semctl.2 b/lib/libc/sys/semctl.2 index b3ff343b284c..95cd22e76c7c 100644 --- a/lib/libc/sys/semctl.2 +++ b/lib/libc/sys/semctl.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: semctl.2,v 1.4 1997/11/27 10:25:04 mikel Exp $ +.\" $NetBSD: semctl.2,v 1.5 1998/04/28 22:28:31 fair Exp $ .\" .\" Copyright (c) 1995 Frank van der Linden .\" All rights reserved. @@ -119,7 +119,7 @@ Return the number of processes waiting to acquire the semaphore. Return the number of processes waiting for the value of the semaphore to reach 0. .It Dv GETALL -Return the values of all the semaphores associated with +Return the values of all the semaphores associated with .Fa semid . .It Dv SETALL Set the values of all the semaphores that are associated with the semaphore @@ -146,7 +146,7 @@ The values are taken from the corresponding fields in the structure pointed to by .Fa arg.buf . This operation can only be executed by the super-user, or a process that -has an effective user id equal to either +has an effective user id equal to either .Va sem_perm.cuid or .Va sem_perm.uid @@ -155,7 +155,7 @@ in the data structure associated with the message queue. Remove the semaphores associated with .Fa semid from the system and destroy the data structures associated with it. Only the -super-user or a process with an effective uid equal to the +super-user or a process with an effective uid equal to the .Va sem_perm.cuid or .Va sem_perm.uid diff --git a/lib/libc/sys/shmctl.2 b/lib/libc/sys/shmctl.2 index da000c391c4e..d8cc9391f5dd 100644 --- a/lib/libc/sys/shmctl.2 +++ b/lib/libc/sys/shmctl.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: shmctl.2,v 1.5 1997/11/27 10:25:18 mikel Exp $ +.\" $NetBSD: shmctl.2,v 1.6 1998/04/28 22:28:31 fair Exp $ .\" .\" Copyright (c) 1995 Frank van der Linden .\" All rights reserved. @@ -114,7 +114,7 @@ The values are taken from the corresponding fields in the structure pointed to by .Fa buf . This operation can only be executed by the super-user, or a process that -has an effective user id equal to either +has an effective user id equal to either .Va shm_perm.cuid or .Va shm_perm.uid @@ -122,8 +122,8 @@ in the data structure associated with the shared memory segment. .It Dv IPC_RMID Remove the shared memory segment specified by .Fa shmid -and destroy the data associated with it. Only the super-user or a process -with an effective uid equal to the +and destroy the data associated with it. +Only the super-user or a process with an effective uid equal to the .Va shm_perm.cuid or .Va shm_perm.uid @@ -146,8 +146,8 @@ effective gid can match either or .Va shm_perm.gid . .Sh RETURN VALUES -Upon successful completion, a value of 0 is returned. Otherwise, -1 is -returned and the global variable +Upon successful completion, a value of 0 is returned. +Otherwise, -1 is returned and the global variable .Va errno is set to indicate the error. .Sh ERRORS diff --git a/lib/libc/sys/sigaction.2 b/lib/libc/sys/sigaction.2 index 72f1acf46c42..1cadf38ce300 100644 --- a/lib/libc/sys/sigaction.2 +++ b/lib/libc/sys/sigaction.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: sigaction.2,v 1.14 1998/02/06 05:41:35 perry Exp $ +.\" $NetBSD: sigaction.2,v 1.15 1998/04/28 22:28:31 fair Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -53,10 +53,11 @@ struct sigaction { .Sh DESCRIPTION The system defines a set of signals that may be delivered to a process. 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 +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 -to which a signal is delivered, or specify that a signal is to be +to which a signal is delivered, or specify that a signal is to be .Em ignored . A process may also specify that a default action is to be taken by the system when a signal occurs. @@ -64,29 +65,30 @@ A signal may also be .Em blocked , in which case its delivery is postponed until it is .Em unblocked . -The action to be taken on delivery is determined at the time -of delivery. -Normally, signal handlers execute on the current stack -of the process. This may be changed, on a per-handler basis, -so that signals are taken on a special +The action to be taken on delivery is determined at the time of delivery. +Normally, signal handlers execute on the current stack of the process. +This may be changed, on a per-handler basis, so that signals are +taken on a special .Em "signal stack" . .Pp Signal routines execute with the signal that caused their invocation .Em blocked , but other signals may yet occur. -A global +A global .Em "signal mask" defines the set of signals currently blocked from delivery -to a process. The signal mask for a process is initialized -from that of its parent (normally empty). It -may be changed with a +to a process. +The signal mask for a process is initialized from that of its parent +(normally empty). +It may be changed with a .Xr sigprocmask 2 call, or when a signal is delivered to the process. .Pp When a signal condition arises for a process, the signal is added to a set of -signals pending for the process. If the signal is not currently +signals pending for the process. +If the signal is not currently .Em blocked by the process then it is delivered to the process. Signals may be delivered any time a process enters the operating system @@ -101,25 +103,26 @@ The set of pending signals is returned by the function. When a caught signal is delivered, the current state of the process is saved, -a new signal mask is calculated (as described below), -and the signal handler is invoked. The call to the handler -is arranged so that if the signal handling routine returns -normally the process will resume execution in the context -from before the signal's delivery. +a new signal mask is calculated (as described below), +and the signal handler is invoked. +The call to the handler is arranged so that if the signal handling +routine returns normally the process will resume execution in the +context from before the signal's delivery. If the process wishes to resume in a different context, then it must arrange to restore the previous context itself. .Pp When a signal is delivered to a process a new signal mask is installed for the duration of the process' signal handler (or until a -.Xr sigprocmask +.Xr sigprocmask 2 call is made). This mask is formed by taking the union of the current signal mask, -the signal to be delivered, and +the signal to be delivered, and the signal mask associated with the handler to be invoked. .Pp .Fn Sigaction -assigns an action for a specific signal. If +assigns an action for a specific signal. +If .Fa act is non-zero, it specifies an action @@ -127,7 +130,7 @@ specifies an action .Dv SIG_IGN , or a handler routine) and mask to be used when delivering the specified signal. -If +If .Fa oact is non-zero, the previous handling information for the signal is returned to the user. @@ -135,7 +138,7 @@ is returned to the user. Once a signal handler is installed, it remains installed until another .Fn sigaction -call is made, or an +call is made, or an .Xr execve 2 is performed. A signal-specific default action may be reset by @@ -235,7 +238,7 @@ with names as in the include file .It Dv SIGQUIT No " create core image" " quit program" .It Dv SIGILL No " create core image" " illegal instruction" .It Dv SIGTRAP No " create core image" " trace trap" -.It Dv SIGABRT No " create core image" Xr abort 2 +.It Dv SIGABRT No " create core image" Xr abort 3 call (formerly .Dv SIGIOT ) .It Dv SIGEMT No " create core image" " emulate instruction executed" @@ -271,7 +274,7 @@ is possible on a descriptor (see .It Dv SIGUSR2 No " terminate process" " user-defined signal 2" .El .Sh NOTE -The mask specified in +The mask specified in .Fa act is not allowed to block .Dv SIGKILL @@ -279,8 +282,8 @@ or .Dv SIGSTOP . This is enforced silently by the system. .Sh RETURN VALUES -A 0 value indicates that the call succeeded. A \-1 return value -indicates an error occurred and +A 0 value indicates that the call succeeded. +A \-1 return value indicates an error occurred and .Va errno is set to indicated the reason. .Sh EXAMPLE @@ -306,14 +309,15 @@ structure (defined in .Aq Pa signal.h ) , used to restore the context from before the signal. .Pp -For POSIX compliance, the +For POSIX compliance, the .Fa sa_handler is declared to be (void (*)(int)) and the above handler will need to be -casted to that type. Future versions of +casted to that type. +Future versions of .Nx will replace the .Fa sigcontext -interface with the +interface with the .Fa siginfo interface. .Sh ERRORS @@ -324,7 +328,7 @@ of the following occurs: .It Bq Er EFAULT Either .Fa act -or +or .Fa oact points to memory that is not a valid part of the process address space. diff --git a/lib/libc/sys/sigsuspend.2 b/lib/libc/sys/sigsuspend.2 index 9399c6012a0a..f062de2578a6 100644 --- a/lib/libc/sys/sigsuspend.2 +++ b/lib/libc/sys/sigsuspend.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: sigsuspend.2,v 1.6 1998/02/02 05:20:35 perry Exp $ +.\" $NetBSD: sigsuspend.2,v 1.7 1998/04/28 22:28:32 fair Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -61,7 +61,7 @@ of the signal are examined to determine that there is no work to be done, and the process pauses awaiting work by using .Fn sigsuspend with the previous mask returned by -.Xr sigprocmask . +.Xr sigprocmask 2 . .Sh RETURN VALUES The .Fn sigsuspend diff --git a/lib/libc/sys/vfork.2 b/lib/libc/sys/vfork.2 index 6a4e47d50c43..2a94f8c06d74 100644 --- a/lib/libc/sys/vfork.2 +++ b/lib/libc/sys/vfork.2 @@ -1,4 +1,4 @@ -.\" $NetBSD: vfork.2,v 1.10 1998/01/04 04:20:42 thorpej Exp $ +.\" $NetBSD: vfork.2,v 1.11 1998/04/28 22:28:32 fair Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -44,31 +44,36 @@ .Ft pid_t .Fn vfork void .Sh DESCRIPTION -.Fn Vfork -creates a new process that that does not have a new virtual address space, -but rather shares address space with the parent, thus avoiding potentially -expensive copy-on-write operations normally associated with creating a -new process. It is useful when the purpose of +The +.Nm +system call creates a new process that that does not have a new +virtual address space, but rather shares address space with the +parent, thus avoiding potentially expensive copy-on-write operations +normally associated with creating a new process. +It is useful when the purpose of .Xr fork 2 would have been to create a new system context for an .Xr execve 2 . -.Fn Vfork -differs from +The +.Nm +system call differs from .Xr fork 2 in that the child borrows the parent's memory and thread of control until a call to .Xr execve 2 or an exit (either by a call to .Xr _exit 2 -or abnormally.) +or abnormally). The parent process is suspended while the child is using its resources. .Pp -.Fn Vfork -returns 0 in the child's context and (later) the pid of the child in -the parent's context. +The +.Nm +system call returns 0 in the child's context and (later) the pid +of the child in the parent's context. .Pp -.Fn Vfork -can normally be used just like +The +.Nm +system call can normally be used just like .Xr fork 2 . It does not work, however, to return while running in the childs context from the procedure that called @@ -81,16 +86,15 @@ Be careful, also, to call rather than .Xr exit 3 if you can't -.Xr execve , +.Xr execve 2 , since .Xr exit 3 will flush and close standard I/O channels, and thereby mess up the -parent processes standard I/O data structures. -(Even with +parent processes standard I/O data structures (even with .Xr fork 2 it is wrong to call .Xr exit 3 -since buffered data would then be flushed twice.) +since buffered data would then be flushed twice). .Sh SEE ALSO .Xr fork 2 , .Xr execve 2 , @@ -103,26 +107,21 @@ Same as for .\" XXX We reintroduced the original semantics. .\" This system call will be eliminated when proper system sharing .\" mechanisms are implemented. -Users should not depend on the memory -sharing semantics of -.Xr vfork +Users should not depend on the memory sharing semantics of +.Xr vfork 2 as other ways of speeding up the fork process may be developed in the future. .Pp -To avoid a possible deadlock situation, -processes that are children in the middle -of a +To avoid a possible deadlock situation, processes that are children +in the middle of a .Fn vfork are never sent .Dv SIGTTOU or .Dv SIGTTIN -signals; rather, -output or +signals; rather, output or .Xr ioctl 2 -calls -are allowed -and input attempts result in an end-of-file indication. +calls are allowed and input attempts result in an end-of-file indication. .Sh HISTORY The .Fn vfork