BSD 4_2 development
[unix-history] / usr / man / man3 / fork.3f
CommitLineData
3b9e8f30
C
1.TH FORK 3F "13 June 1983"
2.UC 4
3.SH NAME
4fork \- create a copy of this process
5.SH SYNOPSIS
6.B integer function fork()
7.SH DESCRIPTION
8.I Fork
9creates a copy of the calling process.
10The only distinction between the 2 processes is that the value
11returned to one of them (referred to as the 'parent' process)
12will be the process id if the copy.
13The copy is usually referred to as the 'child' process.
14The value returned to the 'child' process will be zero.
15.PP
16All logical units open for writing are flushed before the fork to avoid
17duplication of the contents of I/O buffers in the external file(s).
18.PP
19If the returned value is negative, it indicates an error and will be
20the negation of the system error code.
21See perror(3F).
22.PP
23A corresponding
24.I exec
25routine has not been provided because there is no satisfactory way to
26retain open logical units across the exec.
27However, the usual function of
28.I fork/exec
29can be performed using
30.IR system (3F).
31.if 0 \{
32A pipe can be opened to another process using the f77
33.B open
34statement with
35.sp 1
36.ti +5
37.B "file=\(fm\fIprocess\fB\(fm, status=\(fmpipe\(fm, access=\(fmread\(fm"
38.br
39or
40.br
41.ti +5
42.B "file=\(fm\fIprocess\fB\(fm, status=\(fmpipe\(fm, access=\(fmwrite\(fm"
43\}
44.SH FILES
45.ie \nM /usr/ucb/lib/libU77.a
46.el /usr/lib/libU77.a
47.SH "SEE ALSO"
48fork(2), wait(3F), kill(3F), system(3F), perror(3F)