Date: Tue, 25 Dec 2001 09:33:07 +1100 (EST) From: Peter Jeremy <peter.jeremy@alcatel.com.au> To: FreeBSD-gnats-submit@freebsd.org Subject: kern/33156: [PATCH] fork(2) man page doesn't mention setitimer behaviour Message-ID: <200112242233.fBOMX7889200@gsmx07.alcatel.com.au>
next in thread | raw e-mail | index | archive | help
>Number: 33156
>Category: kern
>Synopsis: [PATCH] fork(2) man page doesn't mention setitimer behaviour
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: doc-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Dec 24 14:40:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Peter Jeremy
>Release: FreeBSD 4.5-PRERELEASE i386
>Organization:
Alcatel Australia Limited
>Environment:
System: FreeBSD cirb503493.alcatel.com.au 4.5-PRERELEASE FreeBSD 4.5-PRERELEASE #2: Sun Dec 23 07:00:19 EST 2001 root@cirb503493.alcatel.com.au:/usr/obj/usr/src/sys/pj1592 i386
>Description:
A child process created by fork(2) will not inherit any interval
timers created in the parent (eg alarm(3)). This is not clear
from the documentation.
It is possible that the actual behaviour is incorrect, but the
definition of struct proc implies that the behaviour is correct.
In any case, the documentation should match the actual behaviour.
>How-To-Repeat:
I found the problem using the procedure in bin/33155 and ktracing
the sshd daemon. The behaviour is demonstrated by executing the
following program:
main()
{
alarm(5);
if (fork() == 0)
pause();
}
Whilst the parent returns immediately , the child remains running
indefinitely.
>Fix:
.\" $FreeBSD: src/lib/libc/sys/fork.2,v 1.9.2.4 2001/12/14 18:34:00 ru Exp $
--- lib/libc/sys/fork.2 Sat Dec 22 07:55:05 2001
+++ /tmp/fork.2 Tue Dec 25 09:07:53 2001
@@ -74,6 +74,9 @@
The child process' resource utilizations
are set to 0; see
.Xr setrlimit 2 .
+.It
+All interval timers are cleared; see
+.Xr setitimer 2 .
.El
.Sh RETURN VALUES
Upon successful completion,
@@ -119,6 +122,7 @@
.Sh SEE ALSO
.Xr execve 2 ,
.Xr rfork 2 ,
+.Xr setitimer 2 ,
.Xr setrlimit 2 ,
.Xr vfork 2 ,
.Xr wait 2
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200112242233.fBOMX7889200>
