manual page distributed with 4.1BSD
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Fri, 10 May 1985 07:04:03 +0000 (23:04 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Fri, 10 May 1985 07:04:03 +0000 (23:04 -0800)
SCCS-vsn: lib/libc/sys/fork.2 4.1

usr/src/lib/libc/sys/fork.2 [new file with mode: 0644]

diff --git a/usr/src/lib/libc/sys/fork.2 b/usr/src/lib/libc/sys/fork.2
new file mode 100644 (file)
index 0000000..5861a64
--- /dev/null
@@ -0,0 +1,65 @@
+.\" Copyright (c) 1980 Regents of the University of California.
+.\" All rights reserved.  The Berkeley software License Agreement
+.\" specifies the terms and conditions for redistribution.
+.\"
+.\"    @(#)fork.2      4.1 (Berkeley) %G%
+.\"
+.TH FORK 2 
+.UC
+.SH NAME
+fork \- spawn new process
+.SH SYNOPSIS
+.B fork()
+.SH DESCRIPTION
+.I Fork
+and
+.IR vfork (2)
+are the only ways new processes are created.
+With
+.I fork ,
+the new process's core image is a copy of
+that of the caller of
+.IR fork .
+The only distinction
+is the fact
+that the value returned in the old (parent) process
+contains the process ID
+of the new (child) process,
+while the value returned in the child is 0.
+Process ID's range from 1 to 30,000.
+This process ID is used by
+.IR wait (2).
+.PP
+Files open before the fork
+are shared, and have a common read-write pointer.
+In particular,
+this is the way that standard input and output
+files are passed and also how
+pipes are set up.
+.PP
+.I Vfork
+is the most efficient way of creating a new process
+when the fork is to be followed shortly by an exec,
+but is not suitable when the fork is not to be followed
+by an exec.
+.SH "SEE ALSO"
+wait(2), exec(2), vfork(2)
+.SH DIAGNOSTICS
+Returns \-1 and fails to create a process if:
+there is inadequate swap space,
+the user is not super-user and has too many processes,
+or the system's process table is full.
+Only the super-user can take the last process-table slot.
+.SH "ASSEMBLER (PDP-11)"
+(fork = 2.)
+.br
+.B sys fork
+.br
+(new process return)
+.br
+(old process return, new process ID in r0)
+.PP
+The return locations in the old and new process
+differ by one word.
+The C-bit is set in the old process if a new
+process could not be created.