summaryrefslogtreecommitdiff
path: root/lib/libc/sys
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2013-03-31 08:37:01 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2013-03-31 08:37:01 +0000
commit856604e127e89337dfc86f8c06bc667f1cb9095b (patch)
tree237526c04f68eb5311dfe1ff281f99a278cab9a4 /lib/libc/sys
parent07ad9d0ce4a99f5e786388bfa091b6378e331e94 (diff)
Document more difference between parent and child.
Updates to ERRORS, and STANDARDS ok jmc@
Diffstat (limited to 'lib/libc/sys')
-rw-r--r--lib/libc/sys/fork.236
1 files changed, 27 insertions, 9 deletions
diff --git a/lib/libc/sys/fork.2 b/lib/libc/sys/fork.2
index 13d9638f82c..fab4fb8a539 100644
--- a/lib/libc/sys/fork.2
+++ b/lib/libc/sys/fork.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: fork.2,v 1.15 2011/11/06 17:22:20 schwarze Exp $
+.\" $OpenBSD: fork.2,v 1.16 2013/03/31 08:37:00 guenther Exp $
.\" $NetBSD: fork.2,v 1.6 1995/02/27 12:32:36 cgd Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)fork.2 8.1 (Berkeley) 6/4/93
.\"
-.Dd $Mdocdate: November 6 2011 $
+.Dd $Mdocdate: March 31 2013 $
.Dt FORK 2
.Os
.Sh NAME
@@ -48,11 +48,14 @@ The new process (child process) is an exact copy of the
calling process (parent process) except for the following:
.Bl -bullet -offset indent
.It
-The child process has a unique process ID.
+The child process has a unique process ID,
+which also does not match any existing process group ID.
.It
The child process has a different parent
process ID (i.e., the process ID of the parent process).
.It
+The child process has a single thread.
+.It
The child process has its own copy of the parent's descriptors.
These descriptors reference the same underlying objects, so that,
for instance, file pointers in file objects are shared between
@@ -67,12 +70,26 @@ This descriptor copying is also used by the shell to
establish standard input and output for newly created processes
as well as to set up pipes.
.It
+The child process has no
+.Xr fcntl 2 Ns -style
+file locks.
+.It
The child process' resource utilizations
are set to 0; see
-.Xr setrlimit 2 .
+.Xr getrusage 2 .
.It
All interval timers are cleared; see
.Xr setitimer 2 .
+.It
+The child process' semaphore undo values are set to 0; see
+.Xr semop 2 .
+.It
+The child process' pending signals set is empty.
+.It
+The child process has no memory locks; see
+.Xr mlock 2
+and
+.Xr mlockall 2 .
.El
.Pp
In general, the child process should call
@@ -101,9 +118,10 @@ is set to indicate the error.
will fail and no child process will be created if:
.Bl -tag -width [EAGAIN]
.It Bq Er EAGAIN
-The system-imposed limit on the total
-number of processes under execution would be exceeded.
-This limit is configuration-dependent.
+The system-imposed limits on the total
+number of processes or total number of threads
+under execution would be exceeded.
+These limits are configuration dependent.
.It Bq Er EAGAIN
The limit
.Dv RLIMIT_NPROC
@@ -114,13 +132,13 @@ There is insufficient swap space for the new process.
.El
.Sh SEE ALSO
.Xr execve 2 ,
-.Xr setrlimit 2 ,
+.Xr getrusage 2 ,
.Xr wait 2
.Sh STANDARDS
The
.Fn fork
function conforms to
-.St -p1003.1-90 .
+.St -p1003.1-2008 .
.Sh HISTORY
The
.Fn fork