From owner-freebsd-bugs Mon Dec 24 14:40:13 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 37CA137B41E for ; Mon, 24 Dec 2001 14:40:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id fBOMe1G41473; Mon, 24 Dec 2001 14:40:01 -0800 (PST) (envelope-from gnats) Received: from netau1.alcanet.com.au (ntp.alcanet.com.au [203.62.196.27]) by hub.freebsd.org (Postfix) with ESMTP id 4464337B419 for ; Mon, 24 Dec 2001 14:33:15 -0800 (PST) Received: from mfg1.cim.alcatel.com.au (mfg1.cim.alcatel.com.au [139.188.23.1]) by netau1.alcanet.com.au (8.9.3 (PHNE_22672)/8.9.3) with ESMTP id JAA05029 for ; Tue, 25 Dec 2001 09:33:13 +1100 (EDT) Received: from gsmx07.alcatel.com.au by cim.alcatel.com.au (PMDF V5.2-32 #37645) with ESMTP id <01KCA3VAP2U84M3TJZ@cim.alcatel.com.au> for FreeBSD-gnats-submit@freebsd.org; Tue, 25 Dec 2001 09:32:50 +1100 Received: (from jeremyp@localhost) by gsmx07.alcatel.com.au (8.11.6/8.11.6) id fBOMX7889200; Tue, 25 Dec 2001 09:33:07 +1100 (EST envelope-from jeremyp) Message-Id: <200112242233.fBOMX7889200@gsmx07.alcatel.com.au> Date: Tue, 25 Dec 2001 09:33:07 +1100 (EST) From: Peter Jeremy Reply-To: Peter Jeremy To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: kern/33156: [PATCH] fork(2) man page doesn't mention setitimer behaviour Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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