.\" @(#)fork.3f 1.3 86/01/02 SMI; from UCB 4.2 .TH FORK 3F "98/09/16" .SH NAME fork \- create a copy of this process .SH SYNOPSIS .\" .IX fork "" fork .IX "copy process via fork" "" "copy process via \fLfork\fP" .IX process "copy via fork" process "copy via \fLfork\fP" .\" .B integer*4 function fork() .SH DESCRIPTION The .B fork function creates a copy of the calling process. The only distinction between the two processes is that the value returned to one of them, referred to as the 'parent' process, is the process id of the copy. The copy is usually referred to as the `child' process. The value returned to the `child' process is zero. .PP All logical units open for writing are flushed before the fork to avoid duplication of the contents of I/O buffers in the external files. .PP If the returned value is negative, it indicates an error and is the negation of the system error code. See .BR perror (3F). .PP A corresponding .B exec routine has not been provided because there is no satisfactory way to retain open logical units across the exec. However, the usual function of .B fork/exec can be performed using .BR system (3F). .if 0 \{ A pipe can be opened to another process using the f77 .B open statement with .sp 1 .ti +5 .B "file=\(fm\fIprocess\fB\(fm, status=\(fmpipe\(fm, access=\(fmread\(fm" .br or .br .ti +5 .B "file=\(fm\fIprocess\fB\(fm, status=\(fmpipe\(fm, access=\(fmwrite\(fm" \} .SH FILES .B libF77.a .SH "SEE ALSO" .BR fork (2), .BR wait (3F), .BR kill (3F), .BR system (3F), .BR perror (3F)