Added discussion of directory streams.

Removed "#include <sys/types>" from SYNOPSIS.
Changed authorship notice.
This commit is contained in:
Michael Kerrisk 2008-01-13 17:00:19 +00:00
parent 955f4c381a
commit f5e74ede79
1 changed files with 17 additions and 11 deletions

View File

@ -1,8 +1,8 @@
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
.\" and Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu),
.\" March 28, 1992
.\" A few fragments remain from an earlier (1992) page by
.\" Drew Eckhardt (drew@cs.colorado.edu),
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
@ -36,12 +36,10 @@
.\" Greatly expanded, to describe all attributes that differ
.\" parent and child.
.\"
.TH FORK 2 2006-09-04 "Linux" "Linux Programmer's Manual"
.TH FORK 2 2008-01-13 "Linux" "Linux Programmer's Manual"
.SH NAME
fork \- create a child process
.SH SYNOPSIS
.B #include <sys/types.h>
.br
.B #include <unistd.h>
.sp
.B pid_t fork(void);
@ -78,7 +76,7 @@ The child does not inherit record locks from its parent
.RB ( fcntl (2)).
.IP *
The child does not inherit timers from its parent
.RB ( setitimer (2)
.RB ( setitimer (2),
.BR alarm (2),
.BR timer_create (3)).
.IP *
@ -149,13 +147,21 @@ open message queue description
as the corresponding descriptor in the parent.
This means that the two descriptors share the same flags
.RI ( mq_flags ).
.IP *
The child inherits copies of the parent's set of open directory streams (see
.BR opendir (3)).
POSIX.1-2001 says that the correspoding directory streams
in the parent and child
.I may
share the directory stream positioning;
on Linux/glibc they do not.
.SH "RETURN VALUE"
On success, the PID of the child process is returned in the parent's thread
of execution, and a 0 is returned in the child's thread of execution.
On failure, a \-1 will be returned in the parent's context,
no child process will be created, and
On success, the PID of the child process is returned in the parent,
and 0 is returned in the child.
On failure, \-1 is returned in the parent,
no child process is created, and
.I errno
will be set appropriately.
is set appropriately.
.SH ERRORS
.TP
.B EAGAIN