From f5e74ede797114eb795a9be636a33d104aa328be Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Sun, 13 Jan 2008 17:00:19 +0000 Subject: [PATCH] Added discussion of directory streams. Removed "#include " from SYNOPSIS. Changed authorship notice. --- man2/fork.2 | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/man2/fork.2 b/man2/fork.2 index 010f16986..0e814557a 100644 --- a/man2/fork.2 +++ b/man2/fork.2 @@ -1,8 +1,8 @@ .\" Hey Emacs! This file is -*- nroff -*- source. .\" .\" Copyright (C) 2006 Michael Kerrisk -.\" 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 -.br .B #include .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