From <IMAP4.psuedo.sims> Wed Sep  2 09:23:37 2009
Date: Wed, 2 Sep 2009 09:23:37 -0700 (PDT)
From: Postmaster
Subject: Message from mail server       
Content-Length: 95
Mime-Version: 1.0
Status: RO
X-IMAP: 1251908617 32

Delete.
This is a system message.                                














--END+PSEUDO--

From dr146992@sac.sfbay.sun.com Mon Aug 17 15:33:15 2009
Received: from sunmail4.singapore.sun.com (sunmail4.Singapore.Sun.COM [129.158.71.19])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7HMXEHk009473
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 17 Aug 2009 15:33:15 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail4.singapore.sun.com (8.13.4+Sun/8.13.3/ENSMAIL,v2.2) with ESMTP id n7HMXDVX002466;
	Tue, 18 Aug 2009 06:33:13 +0800 (SGT)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOJ00401LBCP500@brm-avmta-1.central.sun.com>; Mon,
 17 Aug 2009 16:33:12 -0600 (MDT)
Received: from dm-sfbay-02.sfbay.sun.com ([129.146.11.31])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOJ00B9FLBCELC0@brm-avmta-1.central.sun.com>; Mon,
 17 Aug 2009 16:33:12 -0600 (MDT)
Received: from sac.sfbay.sun.com (sac.SFBay.Sun.COM [129.146.226.132])
	by dm-sfbay-02.sfbay.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2)
 with ESMTP id n7HMXCd4044057; Mon, 17 Aug 2009 15:33:12 -0700 (PDT)
Received: from sac.sfbay.sun.com (localhost [127.0.0.1])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7HMXAAV009468; Mon,
 17 Aug 2009 15:33:10 -0700 (PDT)
Received: (from dr146992@localhost)
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8/Submit) id n7HMXAaA009464; Mon,
 17 Aug 2009 15:33:10 -0700 (PDT)
Date: Mon, 17 Aug 2009 15:33:10 -0700 (PDT)
From: Darren Reed <dr146992@sac.sfbay.sun.com>
Subject: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
To: PSARC-ext@sun.com
Message-id: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
Content-Length: 4019
Status: RO
X-Status: $$$$
X-UID: 0000000001


Template Version: @(#)sac_nextcase 1.68 02/23/09 SMI
This information is Copyright 2009 Sun Microsystems
1. Introduction
    1.1. Project/Component Working Name:
	 daemon() in libc
    1.2. Name of Document Author/Supplier:
	 Author:  Vladimir Kotal
    1.3  Date of This Document:
	17 August, 2009
4. Technical Description

Release binding is Patch/Micro.

1. Introduction
   1.1. Project/Component Working Name:
   	Add daemon() to libc
   1.2. Name of Document Author/Supplier:
   	Author: Vladimir Kotal
   1.3. Date of This Document:
   	08/17/09

4. Technical Description

Background
----------

Since early 90's the libc library shipped with BSD systems contained the
daemon() function. It is still being used by daemons to go into background.
Now, late in the first decade it's time to add the function to Solaris' libc.

Proposal
--------

This case proposes to add the daemon() function to libc.

The goal of this case is to make it easier to port new software to OpenSolaris,
make it more compatible with BSD systems and last but not least make
OpenSolaris more approachable for Linux/BSD programmers.

Comments
--------

One could argue that the original daemon() does not offer much flexibility
and that this approach to daemonization is actually not sufficient in SMF
world. While this is true, it is out of scope of this case to provide modern
alternative.

Exported Interfaces
-------------------

This case delivers the following interfaces:

+----------------------------------------+----------------------+----------+
| Interfaces                             | Stability            | CR       |
+----------------------------------------+----------------------+----------+
 int daemon(int nochdir, int noclose)      Committed              4471189

Man page update
---------------

Standard C Library Functions                              daemon(3C)



NAME
     daemon - basic daemonization function

SYNOPSIS
     #include <stdlib.h>

     int daemon(int nochdir, int noclose);


DESCRIPTION
     The daemon() function provides a way for applications to go into
     background.

     The function will ensure that the process calling this function:
       - runs in the background
       - deatches from the controlling terminal
       - forms a new process group
       - is not a session group leader

     The options to the function are treated as boolean variables and are
     evaluted using negative logic.

     If the nochdir option is other than zero the working directory will
     not be changed to the root directory, otherwise it will be.

     If the noclose option is other than zero the descriptors 0,1,2
     (normally corresponding to standard input, output and error output,
     depending on the application) will not be redirected to /dev/null,
     otherwise they will be.

RETURN VALUES
     Upon successful completion, daemon() returns 0. Otherwise it returns -1.

EXAMPLES

     The main() function of a network server could look like this:

     int background;	/* background flag */

     /* Load and verify the configuration. */

     /* Go into background. */
     if (background && daemon(0, 0) < 0)
             err(1, "daemon");

     /* Process requests here. */

ATTRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:

     ____________________________________________________________
    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
    |_____________________________|_____________________________|
    | Interface Stability         | Committed                   |
    |_____________________________|_____________________________|
    | MT-Level                    | Async-Signal-Safe           |
    |_____________________________|_____________________________|


SEE ALSO
     attributes(5), fork(2), Intro(2), setsid(2)



6. Resources and Schedule
    6.4. Steering Committee requested information
   	6.4.1. Consolidation C-team Name:
		ON
    6.5. ARC review type: FastTrack
    6.6. ARC Exposure: open


From Alan.Coopersmith@sun.com Mon Aug 17 15:50:55 2009
Received: from sunmail4.singapore.sun.com (sunmail4.Singapore.Sun.COM [129.158.71.19])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7HMosi1009525
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 17 Aug 2009 15:50:55 -0700 (PDT)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by sunmail4.singapore.sun.com (8.13.4+Sun/8.13.3/ENSMAIL,v2.2) with ESMTP id n7HMopsg010668
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 06:50:53 +0800 (SGT)
Received: from pmxchannel-daemon.nwk-avmta-1.sfbay.Sun.COM by
 nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOJ00C01M4QKG00@nwk-avmta-1.sfbay.Sun.COM> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@Sun.Com); Mon, 17 Aug 2009 15:50:50 -0700 (PDT)
Received: from sca-es-mail-1.sun.com ([192.18.43.132])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOJ00MH5M4P7K40@nwk-avmta-1.sfbay.Sun.COM> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@Sun.Com); Mon,
 17 Aug 2009 15:50:49 -0700 (PDT)
Received: from fe-sfbay-09.sun.com ([192.18.43.129])
	by sca-es-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7HMon9T019881	for
 <PSARC-ext@Sun.Com>; Mon, 17 Aug 2009 15:50:49 -0700 (PDT)
Received: from conversion-daemon.fe-sfbay-09.sun.com by fe-sfbay-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KOJ00C00LYP1700@fe-sfbay-09.sun.com> for PSARC-ext@Sun.Com
 (ORCPT PSARC-ext@Sun.Com); Mon, 17 Aug 2009 15:50:49 -0700 (PDT)
Received: from [10.6.102.27] ([unknown] [10.6.102.27])
 by fe-sfbay-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit
 (built Jul  2 2009)) with ESMTPSA id <0KOJ00L46M4POD50@fe-sfbay-09.sun.com>;
 Mon, 17 Aug 2009 15:50:49 -0700 (PDT)
Date: Mon, 17 Aug 2009 15:50:49 -0700
From: Alan Coopersmith <Alan.Coopersmith@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
Sender: Alan.Coopersmith@sun.com
To: Darren Reed <dr146992@sac.sfbay.sun.com>
Cc: PSARC-ext@sun.com
Message-id: <4A89DEC9.10606@sun.com>
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
X-Enigmail-Version: 0.95.1
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
User-Agent: Thunderbird 2.0.0.21 (X11/20090323)
Content-Length: 628
Status: RO
X-Status: $$$$
X-UID: 0000000002

Darren Reed wrote:
> One could argue that the original daemon() does not offer much flexibility
> and that this approach to daemonization is actually not sufficient in SMF
> world. While this is true, it is out of scope of this case to provide modern
> alternative.

While providing an alternative interface is both out-of-scope, and missing
the point of providing a BSD/Linux compatible interface, have you discussed
with the SMF team whether daemon() should be putting the process into a new
process contract?

-- 
	-Alan Coopersmith-           alan.coopersmith@sun.com
	 Sun Microsystems, Inc. - X Window System Engineering


From glenn.skinner@sun.com Mon Aug 17 16:05:54 2009
Received: from sunmail4.singapore.sun.com (sunmail4.Singapore.Sun.COM [129.158.71.19])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7HN5r3v028133
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 17 Aug 2009 16:05:53 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail4.singapore.sun.com (8.13.4+Sun/8.13.3/ENSMAIL,v2.2) with ESMTP id n7HN5dZc017601
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 07:05:52 +0800 (SGT)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOJ00803MTQ9A00@brm-avmta-1.central.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Mon, 17 Aug 2009 17:05:50 -0600 (MDT)
Received: from dm-sfbay-02.sfbay.sun.com ([129.146.11.31])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOJ00BSAMTPEJC0@brm-avmta-1.central.sun.com> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Mon,
 17 Aug 2009 17:05:49 -0600 (MDT)
Received: from ivrel.sfbay.sun.com (ivrel.SFBay.Sun.COM [129.146.74.76])
	by dm-sfbay-02.sfbay.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2)
 with ESMTP id n7HN5mNr060417; Mon, 17 Aug 2009 16:05:48 -0700 (PDT)
Received: from ivrel (ivrel [129.146.74.76])
	by ivrel.sfbay.sun.com (8.14.3+Sun/8.14.3) with SMTP id n7HMwI8j008952; Mon,
 17 Aug 2009 15:58:18 -0700 (PDT)
Date: Mon, 17 Aug 2009 15:58:18 -0700 (PDT)
From: Glenn Skinner <glenn.skinner@sun.com>
Subject: Re: 2009/444 [daemon() in libc]
To: dr146992@sac.sfbay.sun.com
Cc: PSARC-ext@sun.com, vladimir.kotal@sun.com
Reply-to: Glenn Skinner <glenn.skinner@sun.com>
Message-id: <200908172258.n7HMwI8j008952@ivrel.sfbay.sun.com>
MIME-version: 1.0
X-Mailer: dtmail 1.3.0 @(#)CDE Version 1.6_36 SunOS 5.11 sun4u sparc
Content-type: TEXT/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-MD5: xymwB+m4QIkfS1L85TEDMA==
X-PMX-Version: 5.4.1.325704
Content-Length: 951
Status: RO
X-Status: $$$$
X-UID: 0000000003

    Date: Mon, 17 Aug 2009 15:50:49 -0700
    From: Alan Coopersmith <Alan.Coopersmith@sun.com>
    Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout
	    08/24/2009]

    Darren Reed wrote:
    > One could argue that the original daemon() does not offer much
    > flexibility and that this approach to daemonization is actually
    > not sufficient in SMF world.  While this is true, it is out of
    > scope of this case to provide modern alternative.

    While providing an alternative interface is both out-of-scope, and
    missing the point of providing a BSD/Linux compatible interface,
    have you discussed with the SMF team whether daemon() should be
    putting the process into a new process contract?

And while we're at it, please modify the man page to include mention
of (at least a SEE ALSO reference) the preferred way to accomplish
daemonization in Solaris.

Assuming you agree to do that, +1 from me.

		-- Glenn


From Nicolas.Williams@sun.com Mon Aug 17 16:06:11 2009
Received: from sunmail4.singapore.sun.com (sunmail4.Singapore.Sun.COM [129.158.71.19])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7HN6AOU000475
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 17 Aug 2009 16:06:11 -0700 (PDT)
Received: from nwk-avmta-2.sfbay.sun.com (nwk-avmta-2.SFBay.Sun.COM [129.145.155.6])
	by sunmail4.singapore.sun.com (8.13.4+Sun/8.13.3/ENSMAIL,v2.2) with ESMTP id n7HN5sdw017721;
	Tue, 18 Aug 2009 07:06:08 +0800 (SGT)
Received: from pmxchannel-daemon.nwk-avmta-2.sfbay.sun.com by
 nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOJ00507MU6PC00@nwk-avmta-2.sfbay.sun.com>; Mon,
 17 Aug 2009 16:06:06 -0700 (PDT)
Received: from binky.Central.Sun.COM ([129.153.128.104])
 by nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOJ002C9MU69E20@nwk-avmta-2.sfbay.sun.com>; Mon,
 17 Aug 2009 16:06:06 -0700 (PDT)
Received: from binky.Central.Sun.COM (localhost [127.0.0.1])
	by binky.Central.Sun.COM (8.14.3+Sun/8.14.3) with ESMTP id n7HN2r7O003258;
 Mon, 17 Aug 2009 18:02:53 -0500 (CDT)
Received: (from nw141292@localhost)
	by binky.Central.Sun.COM (8.14.3+Sun/8.14.3/Submit) id n7HN2rpS003257; Mon,
 17 Aug 2009 18:02:53 -0500 (CDT)
Date: Mon, 17 Aug 2009 18:02:53 -0500
From: Nicolas Williams <Nicolas.Williams@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <4A89DEC9.10606@sun.com>
To: Alan Coopersmith <Alan.Coopersmith@sun.com>
Cc: Darren Reed <dr146992@sac.sfbay.sun.com>, PSARC-ext@sun.com
Message-id: <20090817230253.GF1043@Sun.COM>
MIME-version: 1.0
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-disposition: inline
X-PMX-Version: 5.4.1.325704
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4A89DEC9.10606@sun.com>
X-Authentication-warning: binky.Central.Sun.COM: nw141292 set sender to
 Nicolas.Williams@sun.com using -f
User-Agent: Mutt/1.5.7i
Content-Length: 1100
Status: RO
X-Status: $$$$
X-UID: 0000000004

On Mon, Aug 17, 2009 at 03:50:49PM -0700, Alan Coopersmith wrote:
> Darren Reed wrote:
> > One could argue that the original daemon() does not offer much flexibility
> > and that this approach to daemonization is actually not sufficient in SMF
> > world. While this is true, it is out of scope of this case to provide modern
> > alternative.
> 
> While providing an alternative interface is both out-of-scope, and missing
> the point of providing a BSD/Linux compatible interface, have you discussed
> with the SMF team whether daemon() should be putting the process into a new
> process contract?

That would probably be a bad thing to do by default.  Much code calls
daemon() -- if you try to make a non-transient service out of a program
that does call daemon(), and daemon() does place it in a separate
process contract, then the daemon's original process contract will
empty, causing the restarter to restart the service, which is...
probably not what you want :)

A new flag for daemon() to cause the daemon to be placed in a new
process contract, might be OK, but what would use it?

Nico
-- 

From gdamore@sun.com Mon Aug 17 16:20:27 2009
Received: from sunmail5.uk.sun.com (sunmail5.UK.Sun.COM [129.156.85.165])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7HNKQoL014580
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 17 Aug 2009 16:20:27 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail5.uk.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2) with ESMTP id n7HNKOjX024785
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 00:20:26 +0100 (BST)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOJ00903NI1TN00@brm-avmta-1.central.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@Sun.Com); Mon, 17 Aug 2009 17:20:25 -0600 (MDT)
Received: from sca-es-mail-2.sun.com ([192.18.43.133])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOJ00BTRNI0EHE0@brm-avmta-1.central.sun.com> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@Sun.Com); Mon,
 17 Aug 2009 17:20:24 -0600 (MDT)
Received: from fe-sfbay-10.sun.com ([192.18.43.129])
	by sca-es-mail-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7HNKOOG007523	for
 <PSARC-ext@Sun.Com>; Mon, 17 Aug 2009 16:20:24 -0700 (PDT)
Received: from conversion-daemon.fe-sfbay-10.sun.com by fe-sfbay-10.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.02 64bit (built Apr 16 2009))
 id <0KOJ00F00NBNV400@fe-sfbay-10.sun.com> for PSARC-ext@Sun.Com
 (ORCPT PSARC-ext@Sun.Com); Mon, 17 Aug 2009 16:20:24 -0700 (PDT)
Received: from [192.168.251.11] ([unknown] [76.93.15.33])
 by fe-sfbay-10.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.02 64bit (built Apr 16 2009))
 with ESMTPSA id <0KOJ00DO5NHAAY90@fe-sfbay-10.sun.com>; Mon,
 17 Aug 2009 16:19:58 -0700 (PDT)
Date: Mon, 17 Aug 2009 16:19:58 -0700
From: "Garrett D'Amore" <gdamore@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
Sender: Garrett.Damore@sun.com
To: Darren Reed <dr146992@sac.sfbay.sun.com>
Cc: PSARC-ext@sun.com
Message-id: <4A89E59E.7070604@sun.com>
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
User-Agent: Thunderbird 2.0.0.18 (X11/20081201)
Content-Length: 1767
Status: RO
X-Status: $$$$
X-UID: 0000000005

Darren Reed wrote:
> Background
> ----------
>
> Since early 90's the libc library shipped with BSD systems contained the
> daemon() function. It is still being used by daemons to go into background.
> Now, late in the first decade it's time to add the function to Solaris' libc.
>
> Proposal
> --------
>
> This case proposes to add the daemon() function to libc.
>
> The goal of this case is to make it easier to port new software to OpenSolaris,
> make it more compatible with BSD systems and last but not least make
> OpenSolaris more approachable for Linux/BSD programmers.
>
> Comments
> --------
>
> One could argue that the original daemon() does not offer much flexibility
> and that this approach to daemonization is actually not sufficient in SMF
> world. While this is true, it is out of scope of this case to provide modern
> alternative.
>   

 From what I could tell, the daemon() function is not present on Linux 
(glibc).   In my opinion, if this is true, it greatly diminishes the 
"familiarity" argument in favor of adding this as a new interface.  
While its probably a bit unfortunate to equate "familiarity" to Linux, 
IMO this is the natural state of the ecosystem.  The number of 
developers targeting non-portable BSD-specific interfaces these days is 
almost vanishingly small.  (The same is not true of Linux.)

This is particularly true given that daemon() is, as noted, insufficient 
in the modern "Solaris" way of doing things.

I'm disinclined to support an interface that is substandard *and* which 
does not share widespread adoption in the FOSS community.

If I've misunderstood about the availability of daemon() in Linux, 
please feel free to correct me.  Otherwise I'd be punching the derail 
button on this case.

    - Garrett


From Alan.Coopersmith@sun.com Mon Aug 17 16:27:51 2009
Received: from sunmail5.uk.sun.com (sunmail5.UK.Sun.COM [129.156.85.165])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7HNRo0e014689
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 17 Aug 2009 16:27:51 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail5.uk.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2) with ESMTP id n7HNRlbT028756
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 00:27:49 +0100 (BST)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOJ00A05NUDMX00@brm-avmta-1.central.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Mon, 17 Aug 2009 17:27:49 -0600 (MDT)
Received: from sca-es-mail-1.sun.com ([192.18.43.132])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOJ00B79NUCEJF0@brm-avmta-1.central.sun.com> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Mon,
 17 Aug 2009 17:27:49 -0600 (MDT)
Received: from fe-sfbay-09.sun.com ([192.18.43.129])
	by sca-es-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7HNRmMF023154	for
 <PSARC-ext@sun.com>; Mon, 17 Aug 2009 16:27:48 -0700 (PDT)
Received: from conversion-daemon.fe-sfbay-09.sun.com by fe-sfbay-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KOJ00J00NP1KN00@fe-sfbay-09.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Mon, 17 Aug 2009 16:27:48 -0700 (PDT)
Received: from [10.6.102.27] ([unknown] [10.6.102.27])
 by fe-sfbay-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit
 (built Jul  2 2009)) with ESMTPSA id <0KOJ00LGTNU5ODF0@fe-sfbay-09.sun.com>;
 Mon, 17 Aug 2009 16:27:46 -0700 (PDT)
Date: Mon, 17 Aug 2009 16:27:41 -0700
From: Alan Coopersmith <Alan.Coopersmith@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <4A89E59E.7070604@sun.com>
Sender: Alan.Coopersmith@sun.com
To: "Garrett D'Amore" <gdamore@sun.com>
Cc: Darren Reed <dr146992@sac.sfbay.sun.com>, PSARC-ext@sun.com
Message-id: <4A89E76D.1010407@sun.com>
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
X-Enigmail-Version: 0.95.1
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4A89E59E.7070604@sun.com>
User-Agent: Thunderbird 2.0.0.21 (X11/20090323)
Content-Length: 294
Status: RO
X-Status: $$$$
X-UID: 0000000006

Garrett D'Amore wrote:
> From what I could tell, the daemon() function is not present on Linux
> (glibc).   

http://www.kernel.org/doc/man-pages/online/pages/man3/daemon.3.html

-- 
	-Alan Coopersmith-           alan.coopersmith@sun.com
	 Sun Microsystems, Inc. - X Window System Engineering


From Nicolas.Williams@sun.com Mon Aug 17 16:33:05 2009
Received: from sunmail4.singapore.sun.com (sunmail4.Singapore.Sun.COM [129.158.71.19])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7HNX4BC015066
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 17 Aug 2009 16:33:04 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail4.singapore.sun.com (8.13.4+Sun/8.13.3/ENSMAIL,v2.2) with ESMTP id n7HNWkMv000749;
	Tue, 18 Aug 2009 07:33:01 +0800 (SGT)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOJ00B07O319000@brm-avmta-1.central.sun.com>; Mon,
 17 Aug 2009 17:33:01 -0600 (MDT)
Received: from binky.Central.Sun.COM ([129.153.128.104])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOJ00A85O30R100@brm-avmta-1.central.sun.com>; Mon,
 17 Aug 2009 17:33:00 -0600 (MDT)
Received: from binky.Central.Sun.COM (localhost [127.0.0.1])
	by binky.Central.Sun.COM (8.14.3+Sun/8.14.3) with ESMTP id n7HNTmqQ003285;
 Mon, 17 Aug 2009 18:29:48 -0500 (CDT)
Received: (from nw141292@localhost)
	by binky.Central.Sun.COM (8.14.3+Sun/8.14.3/Submit) id n7HNTm43003284; Mon,
 17 Aug 2009 18:29:48 -0500 (CDT)
Date: Mon, 17 Aug 2009 18:29:48 -0500
From: Nicolas Williams <Nicolas.Williams@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <4A89E59E.7070604@sun.com>
To: "Garrett D'Amore" <gdamore@sun.com>
Cc: Darren Reed <dr146992@sac.sfbay.sun.com>, PSARC-ext@sun.com
Message-id: <20090817232947.GI1043@Sun.COM>
MIME-version: 1.0
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-disposition: inline
X-PMX-Version: 5.4.1.325704
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4A89E59E.7070604@sun.com>
X-Authentication-warning: binky.Central.Sun.COM: nw141292 set sender to
 Nicolas.Williams@sun.com using -f
User-Agent: Mutt/1.5.7i
Content-Length: 1451
Status: RO
X-Status: $$$$
X-UID: 0000000007

On Mon, Aug 17, 2009 at 04:19:58PM -0700, Garrett D'Amore wrote:
> This is particularly true given that daemon() is, as noted, insufficient 
> in the modern "Solaris" way of doing things.

The modern Solaris way of starting daemons does not care if you use
daemon() or not.

SMF's notion of process contracts exists in part to deal with the
existence of daemon() in the first place.  (Process contracts also deal
with detecting process death in multi-process services, ...)

More interesting are the __init_daemon_priv()/__fini_daemon_priv()
functions in libc.  But even then, services which don't need to drop
privs after initialization are OK as is, and ones that do can do it
without the help of those two helpers.

> I'm disinclined to support an interface that is substandard *and* which 
> does not share widespread adoption in the FOSS community.

In general daemon() is not powerful enough.  Often one wants the process
that calls it to not exit until the progeny forked by daemon() has
completed additional initialization, or perhaps one should not call
daemon() until sundry initialization is complete.

But daemon() is quite common.  Its absence is usually well-tolerated
(#ifndef HAVE_DAEMON ...).  But still, we should provide it.

> If I've misunderstood about the availability of daemon() in Linux, 
> please feel free to correct me.  Otherwise I'd be punching the derail 
> button on this case.

It's there in libc in RHEL5.

Nico
-- 

From gdamore@sun.com Mon Aug 17 16:37:10 2009
Received: from newsunmail1brm.central.sun.com (newsunmail1brm.Central.Sun.COM [129.147.62.245])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7HNbAmN015120
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 17 Aug 2009 16:37:10 -0700 (PDT)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by newsunmail1brm.central.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id n7HNb6c8011610
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Mon, 17 Aug 2009 17:37:09 -0600 (MDT)
Received: from pmxchannel-daemon.nwk-avmta-1.sfbay.Sun.COM by
 nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOJ00J0FO9W2600@nwk-avmta-1.sfbay.Sun.COM> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@Sun.Com); Mon, 17 Aug 2009 16:37:08 -0700 (PDT)
Received: from sca-es-mail-1.sun.com ([192.18.43.132])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOJ00M5GO9W7X60@nwk-avmta-1.sfbay.Sun.COM> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@Sun.Com); Mon,
 17 Aug 2009 16:37:08 -0700 (PDT)
Received: from fe-sfbay-10.sun.com ([192.18.43.129])
	by sca-es-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7HNb87J023979	for
 <PSARC-ext@Sun.Com>; Mon, 17 Aug 2009 16:37:08 -0700 (PDT)
Received: from conversion-daemon.fe-sfbay-10.sun.com by fe-sfbay-10.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.02 64bit (built Apr 16 2009))
 id <0KOJ00500O1NQ900@fe-sfbay-10.sun.com> for PSARC-ext@Sun.Com
 (ORCPT PSARC-ext@Sun.Com); Mon, 17 Aug 2009 16:37:08 -0700 (PDT)
Received: from [192.168.251.11] ([unknown] [76.93.15.33])
 by fe-sfbay-10.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.02 64bit (built Apr 16 2009))
 with ESMTPSA id <0KOJ00DC5O9VAYE0@fe-sfbay-10.sun.com>; Mon,
 17 Aug 2009 16:37:07 -0700 (PDT)
Date: Mon, 17 Aug 2009 16:37:07 -0700
From: "Garrett D'Amore" <gdamore@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <20090817232947.GI1043@Sun.COM>
Sender: Garrett.Damore@sun.com
To: Nicolas Williams <Nicolas.Williams@sun.com>
Cc: Darren Reed <dr146992@sac.sfbay.sun.com>, PSARC-ext@sun.com
Message-id: <4A89E9A3.5070507@sun.com>
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4A89E59E.7070604@sun.com> <20090817232947.GI1043@Sun.COM>
User-Agent: Thunderbird 2.0.0.18 (X11/20081201)
Content-Length: 1189
Status: RO
X-Status: $$$$
X-UID: 0000000008

Nicolas Williams wrote:
>
>
>   
>> I'm disinclined to support an interface that is substandard *and* which 
>> does not share widespread adoption in the FOSS community.
>>     
>
> In general daemon() is not powerful enough.  Often one wants the process
> that calls it to not exit until the progeny forked by daemon() has
> completed additional initialization, or perhaps one should not call
> daemon() until sundry initialization is complete.
>
> But daemon() is quite common.  Its absence is usually well-tolerated
> (#ifndef HAVE_DAEMON ...).  But still, we should provide it.
>
>   
>> If I've misunderstood about the availability of daemon() in Linux, 
>> please feel free to correct me.  Otherwise I'd be punching the derail 
>> button on this case.
>>     
>
> It's there in libc in RHEL5.
>   

If its there in RHEL5, then I'll withdraw my major concerns.  I think 
the documentation should point users to other, more robust ways of 
dealing with daemon startup. 

Last question: Is "Committed" the way to deal with this?  If we want to 
steer developers elsewhere, should we instead just list this interface 
with "Committed Obsolete" or perhaps "Uncommitted".

    -- Garrett


From gww@eng.sun.com Mon Aug 17 16:47:44 2009
Received: from sunmail4.singapore.sun.com (sunmail4.Singapore.Sun.COM [129.158.71.19])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7HNlhAM015331
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 17 Aug 2009 16:47:43 -0700 (PDT)
Received: from nwk-avmta-2.sfbay.sun.com (nwk-avmta-2.SFBay.Sun.COM [129.145.155.6])
	by sunmail4.singapore.sun.com (8.13.4+Sun/8.13.3/ENSMAIL,v2.2) with ESMTP id n7HNlduU007610
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 07:47:42 +0800 (SGT)
Received: from pmxchannel-daemon.nwk-avmta-2.sfbay.sun.com by
 nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOJ00801ORHR200@nwk-avmta-2.sfbay.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Mon, 17 Aug 2009 16:47:41 -0700 (PDT)
Received: from dm-eng-02.sfbay.sun.com ([129.146.11.32])
 by nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOJ002VRORH9E40@nwk-avmta-2.sfbay.sun.com> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Mon,
 17 Aug 2009 16:47:41 -0700 (PDT)
Received: from marduk.eng.sun.com (marduk.SFBay.Sun.COM [129.146.108.224])
	by dm-eng-02.sfbay.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2)
 with ESMTP id n7HNlZcR017043; Mon, 17 Aug 2009 16:47:39 -0700 (PDT)
Received: from marduk.eng.sun.com (localhost [127.0.0.1])
	by marduk.eng.sun.com (8.13.6+Sun/8.12.11) with ESMTP id n7HNjjtd028149; Mon,
 17 Aug 2009 16:45:45 -0700 (PDT)
Received: (from gww@localhost)
	by marduk.eng.sun.com (8.13.6+Sun/8.12.11/Submit) id n7HNjjb5028148; Mon,
 17 Aug 2009 16:45:45 -0700 (PDT)
Date: Mon, 17 Aug 2009 16:45:45 -0700 (PDT)
From: Gary Winiger <gww@eng.sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
To: PSARC-ext@sun.com, dr146992@sac.sfbay.sun.com
Message-id: <200908172345.n7HNjjb5028148@marduk.eng.sun.com>
Content-transfer-encoding: 7BIT
X-Sun-Charset: US-ASCII
X-PMX-Version: 5.4.1.325704
Content-Length: 380
Status: RO
X-Status: $$$$
X-UID: 0000000009

> DESCRIPTION

>      If the nochdir option is other than zero the working directory will
>      not be changed to the root directory, otherwise it will be.

	Is this / or ~root?

> RETURN VALUES
>      Upon successful completion, daemon() returns 0. Otherwise it returns -1.

	What are the failure modes?  Is errno set?

	Clarifications in the man page would be helpful.

Gary..

From Darren.Reed@sun.com Mon Aug 17 16:55:44 2009
Received: from sunmail4.singapore.sun.com (sunmail4.Singapore.Sun.COM [129.158.71.19])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7HNthHx015679
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 17 Aug 2009 16:55:44 -0700 (PDT)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by sunmail4.singapore.sun.com (8.13.4+Sun/8.13.3/ENSMAIL,v2.2) with ESMTP id n7HNtdAm010941
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 07:55:43 +0800 (SGT)
Received: from pmxchannel-daemon.nwk-avmta-1.sfbay.Sun.COM by
 nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOJ00L01P4TOW00@nwk-avmta-1.sfbay.Sun.COM> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Mon, 17 Aug 2009 16:55:41 -0700 (PDT)
Received: from gmp-eb-inf-1.sun.com ([192.18.6.21])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOJ00MHFP4S7Z70@nwk-avmta-1.sfbay.Sun.COM> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Mon,
 17 Aug 2009 16:55:40 -0700 (PDT)
Received: from fe-emea-09.sun.com
 (gmp-eb-lb-1-fe1.eu.sun.com [192.18.6.7] (may be forged))
	by gmp-eb-inf-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7HNtdpQ022051	for
 <PSARC-ext@sun.com>; Mon, 17 Aug 2009 23:55:39 +0000 (GMT)
Received: from conversion-daemon.fe-emea-09.sun.com by fe-emea-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KOJ00L00OY7BF00@fe-emea-09.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Tue, 18 Aug 2009 00:55:20 +0100 (BST)
Received: from [129.146.106.55] ([unknown] [129.146.106.55])
 by fe-emea-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 with ESMTPSA id <0KOJ009C8P46X610@fe-emea-09.sun.com>; Tue,
 18 Aug 2009 00:55:20 +0100 (BST)
Date: Mon, 17 Aug 2009 16:56:56 -0700
From: Darren Reed <Darren.Reed@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <4A89E9A3.5070507@sun.com>
Sender: Darren.Reed@sun.com
To: "Garrett D'Amore" <gdamore@sun.com>
Cc: Nicolas Williams <Nicolas.Williams@sun.com>,
        Darren Reed <dr146992@sac.sfbay.sun.com>, PSARC-ext@sun.com
Message-id: <4A89EE48.2070804@Sun.COM>
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4A89E59E.7070604@sun.com> <20090817232947.GI1043@Sun.COM>
 <4A89E9A3.5070507@sun.com>
User-Agent: Thunderbird 2.0.0.21 (X11/20090608)
Content-Length: 1663
Status: RO
X-Status: $$$$
X-UID: 0000000010

On 17/08/09 04:37 PM, Garrett D'Amore wrote:
> Nicolas Williams wrote:
>>
>>
>>  
>>> I'm disinclined to support an interface that is substandard *and* 
>>> which does not share widespread adoption in the FOSS community.
>>>     
>>
>> In general daemon() is not powerful enough.  Often one wants the process
>> that calls it to not exit until the progeny forked by daemon() has
>> completed additional initialization, or perhaps one should not call
>> daemon() until sundry initialization is complete.
>>
>> But daemon() is quite common.  Its absence is usually well-tolerated
>> (#ifndef HAVE_DAEMON ...).  But still, we should provide it.
>>
>>  
>>> If I've misunderstood about the availability of daemon() in Linux, 
>>> please feel free to correct me.  Otherwise I'd be punching the 
>>> derail button on this case.
>>>     
>>
>> It's there in libc in RHEL5.
>>   
>
> If its there in RHEL5, then I'll withdraw my major concerns.  I think 
> the documentation should point users to other, more robust ways of 
> dealing with daemon startup.
> Last question: Is "Committed" the way to deal with this?  If we want 
> to steer developers elsewhere, should we instead just list this 
> interface with "Committed Obsolete" or perhaps "Uncommitted".

Why?
Would we plan on removing daemon() in the future?

I can't see us replacing it with a function that does anything else...
I'm sure the discussion would be much more heated if someone
tried to ARC a daemon() that behaved any differently.

And whilst its functionality may be basic, sometimes that is
all that is wanted. I see no harm with this being Committed.

Where else can we steer developers?

Darren


From Nicolas.Williams@sun.com Mon Aug 17 17:00:09 2009
Received: from newsunmail1brm.central.sun.com (newsunmail1brm.Central.Sun.COM [129.147.62.245])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7I009q2015855
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 17 Aug 2009 17:00:09 -0700 (PDT)
Received: from nwk-avmta-2.sfbay.sun.com (nwk-avmta-2.SFBay.Sun.COM [129.145.155.6])
	by newsunmail1brm.central.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id n7I0031O020023;
	Mon, 17 Aug 2009 18:00:08 -0600 (MDT)
Received: from pmxchannel-daemon.nwk-avmta-2.sfbay.sun.com by
 nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOJ0091XPC7MM00@nwk-avmta-2.sfbay.sun.com>; Mon,
 17 Aug 2009 17:00:07 -0700 (PDT)
Received: from binky.Central.Sun.COM ([129.153.128.104])
 by nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOJ002OAPC79I30@nwk-avmta-2.sfbay.sun.com>; Mon,
 17 Aug 2009 17:00:07 -0700 (PDT)
Received: from binky.Central.Sun.COM (localhost [127.0.0.1])
	by binky.Central.Sun.COM (8.14.3+Sun/8.14.3) with ESMTP id n7HNusMW003335;
 Mon, 17 Aug 2009 18:56:54 -0500 (CDT)
Received: (from nw141292@localhost)
	by binky.Central.Sun.COM (8.14.3+Sun/8.14.3/Submit) id n7HNusIw003334; Mon,
 17 Aug 2009 18:56:54 -0500 (CDT)
Date: Mon, 17 Aug 2009 18:56:54 -0500
From: Nicolas Williams <Nicolas.Williams@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <4A89E9A3.5070507@sun.com>
To: "Garrett D'Amore" <gdamore@sun.com>
Cc: Darren Reed <dr146992@sac.sfbay.sun.com>, PSARC-ext@sun.com
Message-id: <20090817235654.GK1043@Sun.COM>
MIME-version: 1.0
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7BIT
Content-disposition: inline
X-PMX-Version: 5.4.1.325704
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4A89E59E.7070604@sun.com> <20090817232947.GI1043@Sun.COM>
 <4A89E9A3.5070507@sun.com>
X-Authentication-warning: binky.Central.Sun.COM: nw141292 set sender to
 Nicolas.Williams@sun.com using -f
User-Agent: Mutt/1.5.7i
Content-Length: 2819
Status: RO
X-Status: $$$$
X-UID: 0000000011

On Mon, Aug 17, 2009 at 04:37:07PM -0700, Garrett D'Amore wrote:
> >It's there in libc in RHEL5.
> 
> If its there in RHEL5, then I'll withdraw my major concerns.  I think 
> the documentation should point users to other, more robust ways of 
> dealing with daemon startup. 

Yes, that's true, but here daemon() does help: the start method of a
service whosea daemon that doesn't do any of what daemon() does and does
not call it... needs to start the daemon like so:

#!/bin/sh

. /lib/svc/share/smf_include.sh

/path/to/daemon &
sleep $some_time

# We don't know if it really did start.  If it didn't we'll get
# restarted until it does start or n-strikes-you're-done
exit $SMF_EXIT_OK

Whereas a daemon program that calls daemon() _after_ initializing can be
started like this:

#!/bin/sh

. /lib/svc/share/smf_include.sh

if ! /path/to/daemon
then
    # handle errors and map to suitable SMF error
    ...
fi

exit $SMF_EXIT_OK

In other words: daemon() is a Good Thing.

The only things to document are: a) the need to do something like
daemon(), b) make sure the parent exits _after_ initialization
completes, c), if you need to drop privs after initialization, then do
that too.

Ideally we'd have something like:

/*
 * Depending on flags daemon2() will fork(), setsid(), fork(),
 * chdir("/"), etcetera.  In the child daemon2() will call
 * templace_callback(); if that returns non-zero, then daemon2() will
 * exit(2) with that error.  In the grandchild daemon2() will call
 * init_callback(init_cb_data), and it that returns zero, then it will
 * call context_setup(context_setup_data), and the grandparent will
 * exit() with the first non-zero return value of those callbacks, else
 * it will exit(0).  (Internally daemon2() uses an IPC mechanism by
 * which the grandchild communicates its status to the grandparent.)
 *
 * Any and all three of templace_callback, init_callback, and
 * context_setup may be NULL.
 *
 * Pre-defined templace and context setup callback functions:
 *
 *  - daemon2_process_contract_template(...)
 *    (put the grandchild in its own process contract as described by
 *    template_cb_data.)
 *  - daemon2_process_context_setup(...)
 *    (initialize the ruid/suid/euid, rgid/sgid/egid, supplementary
 *    groups, privileges.)
 *
 * Flags: DAEMON2_CHDIR, DAEMON2_SETSID, ...
 */
void daemon2(
	int flags,
	int (*templace_callback)(void *arg),
	void *template_cb_data,
	int (*init_callback)(void *arg),
	void *init_cb_data,
	int (*context_setup)(void *arg),
	void *context_setup_data
);

Or something like that.

> Last question: Is "Committed" the way to deal with this?  If we want to 
> steer developers elsewhere, should we instead just list this interface 
> with "Committed Obsolete" or perhaps "Uncommitted".

daemon() won't go away.  Committed is fine, IMO.

Nico
-- 

From carlsonj@workingcode.com Mon Aug 17 18:14:04 2009
Received: from sunmail4.singapore.sun.com (sunmail4.Singapore.Sun.COM [129.158.71.19])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7I1E3Cn016860
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 17 Aug 2009 18:14:03 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail4.singapore.sun.com (8.13.4+Sun/8.13.3/ENSMAIL,v2.2) with ESMTP id n7I1DqFk019020;
	Tue, 18 Aug 2009 09:13:58 +0800 (SGT)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOJ00M01SR8C900@brm-avmta-1.central.sun.com>; Mon,
 17 Aug 2009 19:13:56 -0600 (MDT)
Received: from sca-ea-mail-1.sun.com ([192.18.43.24])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOJ00A6PSR8R150@brm-avmta-1.central.sun.com>; Mon,
 17 Aug 2009 19:13:56 -0600 (MDT)
Received: from relay43i.sun.com ([192.5.209.74])
	by sca-ea-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7I1BuIk003436;
 Tue, 18 Aug 2009 01:13:55 +0000 (GMT)
Received: from mmp41es.mmp.us.syntegra.com ([160.41.221.10] [160.41.221.10])
 by relay43i.sun.com with ESMTP id BT-MMP-2830650; Tue,
 18 Aug 2009 01:13:55 +0000 (Z)
Received: from relay44i.sun.com (relay44i.sun.com [192.5.209.118])
 by mmp41es.mmp.us.syntegra.com with ESMTP id BT-MMP-63169101; Tue,
 18 Aug 2009 01:13:55 +0000 (Z)
Received: from carlson.workingcode.com ([75.150.68.97] [75.150.68.97])
 by relay4i.sun.com with ESMTP id BT-MMP-7601844; Tue,
 18 Aug 2009 01:13:55 +0000 (Z)
Received: from [192.168.254.178] (dhcp-178 [192.168.254.178])
	(authenticated bits=0)	by carlson.workingcode.com (8.14.2+Sun/8.14.3)
 with ESMTP id n7I1Dpen021001
	(version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Mon,
 17 Aug 2009 21:13:52 -0400 (EDT)
Date: Mon, 17 Aug 2009 21:14:13 -0400
From: James Carlson <carlsonj@workingcode.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <20090817232947.GI1043@Sun.COM>
To: Nicolas Williams <Nicolas.Williams@sun.com>
Cc: "Garrett D'Amore" <gdamore@sun.com>,
        "PSARC-ext@sun.com" <PSARC-ext@sun.com>,
        Darren Reed <dr146992@sac.sfbay.sun.com>
Message-id: <152077DB-FFA8-4561-B513-35B237404C16@workingcode.com>
MIME-version: 1.0
X-Mailer: iPod Mail (5H11a)
Content-type: text/plain; charset=us-ascii; format=flowed; delsp=yes
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
X-Brightmail-Tracker: AAAAAA==
X-DCC-URT-Metrics: carlson 1060; Body=4 Fuz1=4 Fuz2=4
X-Antispam: No, score=0.0/5.0, scanned in 0.252sec at (localhost [127.0.0.1])
	by smf-spamd v1.3.1 - http://smfs.sf.net/
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4A89E59E.7070604@sun.com> <20090817232947.GI1043@Sun.COM>
Content-Length: 338
Status: RO
X-Status: $$$$
X-UID: 0000000012

On Aug 17, 2009, at 7:29 PM, Nicolas Williams  
<Nicolas.Williams@sun.com> wrote:
>> If I've misunderstood about the availability of daemon() in Linux,
>> please feel free to correct me.  Otherwise I'd be punching the derail
>> button on this case.
>
> It's there in libc in RHEL5.

It's older and more common than that. It's a BSD-ism.


From Sebastien.Roy@Sun.COM Mon Aug 17 19:23:39 2009
Received: from sunmail4.singapore.sun.com (sunmail4.Singapore.Sun.COM [129.158.71.19])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7I2NcnA017656
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 17 Aug 2009 19:23:38 -0700 (PDT)
Received: from nwk-avmta-2.sfbay.sun.com (nwk-avmta-2.SFBay.Sun.COM [129.145.155.6])
	by sunmail4.singapore.sun.com (8.13.4+Sun/8.13.3/ENSMAIL,v2.2) with ESMTP id n7I2NZmZ022430
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 10:23:37 +0800 (SGT)
Received: from pmxchannel-daemon.nwk-avmta-2.sfbay.sun.com by
 nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOJ00K01VZC8600@nwk-avmta-2.sfbay.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Mon, 17 Aug 2009 19:23:36 -0700 (PDT)
Received: from brmea-mail-2.sun.com ([192.18.98.43])
 by nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOJ002VDVZB9IA0@nwk-avmta-2.sfbay.sun.com> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Mon,
 17 Aug 2009 19:23:35 -0700 (PDT)
Received: from fe-amer-10.sun.com ([192.18.109.80])
	by brmea-mail-2.sun.com (8.13.6+Sun/8.12.9) with ESMTP id n7I2NZdw017790	for
 <PSARC-ext@sun.com>; Tue, 18 Aug 2009 02:23:35 +0000 (GMT)
Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.02 64bit (built Apr 16 2009))
 id <0KOJ00F00VULHI00@mail-amer.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Mon, 17 Aug 2009 20:23:35 -0600 (MDT)
Received: from [192.168.1.3] ([unknown] [173.76.19.212])
 by mail-amer.sun.com (Sun Java(tm) System Messaging Server 7u2-7.02 64bit
 (built Apr 16 2009)) with ESMTPSA id <0KOJ000VMVZA8E50@mail-amer.sun.com>; Mon,
 17 Aug 2009 20:23:35 -0600 (MDT)
Date: Mon, 17 Aug 2009 22:23:34 -0400
From: Sebastien Roy <Sebastien.Roy@Sun.COM>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <4A89DEC9.10606@sun.com>
Sender: Sebastien.Roy@Sun.COM
To: Alan Coopersmith <Alan.Coopersmith@Sun.COM>
Cc: Darren Reed <dr146992@sac.sfbay.sun.com>, PSARC-ext@Sun.COM
Message-id: <1250562214.111559.13.camel@seb>
Organization: Sun Microsystems
MIME-version: 1.0
X-Mailer: Evolution 2.26.2
Content-type: text/plain; CHARSET=US-ASCII
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4A89DEC9.10606@sun.com>
Content-Length: 713
Status: RO
X-Status: $$$$
X-UID: 0000000013


On Mon, 2009-08-17 at 15:50 -0700, Alan Coopersmith wrote:
> Darren Reed wrote:
> > One could argue that the original daemon() does not offer much flexibility
> > and that this approach to daemonization is actually not sufficient in SMF
> > world. While this is true, it is out of scope of this case to provide modern
> > alternative.
> 
> While providing an alternative interface is both out-of-scope, and missing
> the point of providing a BSD/Linux compatible interface, have you discussed
> with the SMF team whether daemon() should be putting the process into a new
> process contract?

It presumably should not be; otherwise no daemon started from an SMF
service would be restarted by the service.

-Seb



From Sebastien.Roy@sun.com Mon Aug 17 19:26:05 2009
Received: from newsunmail1brm.central.sun.com (newsunmail1brm.Central.Sun.COM [129.147.62.245])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7I2Q56k017685
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 17 Aug 2009 19:26:05 -0700 (PDT)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by newsunmail1brm.central.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id n7I2Q3BP012348
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Mon, 17 Aug 2009 20:26:04 -0600 (MDT)
Received: from pmxchannel-daemon.nwk-avmta-1.sfbay.Sun.COM by
 nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOJ00J07W3FXC00@nwk-avmta-1.sfbay.Sun.COM> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Mon, 17 Aug 2009 19:26:03 -0700 (PDT)
Received: from brmea-mail-1.sun.com ([192.18.98.31])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOJ00MJ2W3E7KD0@nwk-avmta-1.sfbay.Sun.COM> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Mon,
 17 Aug 2009 19:26:02 -0700 (PDT)
Received: from fe-amer-10.sun.com ([192.18.109.80])
	by brmea-mail-1.sun.com (8.13.6+Sun/8.12.9) with ESMTP id n7I2Q20j004292	for
 <PSARC-ext@sun.com>; Tue, 18 Aug 2009 02:26:02 +0000 (GMT)
Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.02 64bit (built Apr 16 2009))
 id <0KOJ00F00VULHH00@mail-amer.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Mon, 17 Aug 2009 20:26:02 -0600 (MDT)
Received: from [192.168.1.3] ([unknown] [173.76.19.212])
 by mail-amer.sun.com (Sun Java(tm) System Messaging Server 7u2-7.02 64bit
 (built Apr 16 2009)) with ESMTPSA id <0KOJ0009XW3D8E60@mail-amer.sun.com>; Mon,
 17 Aug 2009 20:26:01 -0600 (MDT)
Date: Mon, 17 Aug 2009 22:26:00 -0400
From: Sebastien Roy <Sebastien.Roy@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <20090817230253.GF1043@Sun.COM>
Sender: Sebastien.Roy@sun.com
To: Nicolas Williams <Nicolas.Williams@sun.com>
Cc: Alan Coopersmith <Alan.Coopersmith@sun.com>, PSARC-ext@sun.com,
        Darren Reed <dr146992@sac.sfbay.sun.com>
Message-id: <1250562360.111559.15.camel@seb>
Organization: Sun Microsystems
MIME-version: 1.0
X-Mailer: Evolution 2.26.2
Content-type: text/plain; CHARSET=US-ASCII
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4A89DEC9.10606@sun.com> <20090817230253.GF1043@Sun.COM>
Content-Length: 1361
Status: RO
X-Status: $$$$
X-UID: 0000000014


On Mon, 2009-08-17 at 18:02 -0500, Nicolas Williams wrote:
> On Mon, Aug 17, 2009 at 03:50:49PM -0700, Alan Coopersmith wrote:
> > Darren Reed wrote:
> > > One could argue that the original daemon() does not offer much flexibility
> > > and that this approach to daemonization is actually not sufficient in SMF
> > > world. While this is true, it is out of scope of this case to provide modern
> > > alternative.
> > 
> > While providing an alternative interface is both out-of-scope, and missing
> > the point of providing a BSD/Linux compatible interface, have you discussed
> > with the SMF team whether daemon() should be putting the process into a new
> > process contract?
> 
> That would probably be a bad thing to do by default.  Much code calls
> daemon() -- if you try to make a non-transient service out of a program
> that does call daemon(), and daemon() does place it in a separate
> process contract, then the daemon's original process contract will
> empty, causing the restarter to restart the service, which is...
> probably not what you want :)

Exactly.

> A new flag for daemon() to cause the daemon to be placed in a new
> process contract, might be OK, but what would use it?

It would have to be a separate function introduced by a separate
project.  This function must have the same signature and semantics as
the BSD version.

-Seb



From Alan.Coopersmith@sun.com Mon Aug 17 19:31:21 2009
Received: from sunmail5.uk.sun.com (sunmail5.UK.Sun.COM [129.156.85.165])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7I2VKBN017717
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 17 Aug 2009 19:31:21 -0700 (PDT)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by sunmail5.uk.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2) with ESMTP id n7I2V9LT008258
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 03:31:20 +0100 (BST)
Received: from pmxchannel-daemon.nwk-avmta-1.sfbay.Sun.COM by
 nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOJ00K01WC5N900@nwk-avmta-1.sfbay.Sun.COM> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Mon, 17 Aug 2009 19:31:18 -0700 (PDT)
Received: from sca-es-mail-2.sun.com ([192.18.43.133])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOJ00M6AWC57RC0@nwk-avmta-1.sfbay.Sun.COM> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Mon,
 17 Aug 2009 19:31:17 -0700 (PDT)
Received: from fe-sfbay-10.sun.com ([192.18.43.129])
	by sca-es-mail-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7I2VHeB016837	for
 <PSARC-ext@sun.com>; Mon, 17 Aug 2009 19:31:17 -0700 (PDT)
Received: from conversion-daemon.fe-sfbay-10.sun.com by fe-sfbay-10.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.02 64bit (built Apr 16 2009))
 id <0KOJ00500W2ZHM00@fe-sfbay-10.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Mon, 17 Aug 2009 19:31:17 -0700 (PDT)
Received: from [10.6.102.27] ([unknown] [10.6.102.27])
 by fe-sfbay-10.sun.com (Sun Java(tm) System Messaging Server 7u2-7.02 64bit
 (built Apr 16 2009)) with ESMTPSA id <0KOJ00E3FWC4XWF0@fe-sfbay-10.sun.com>;
 Mon, 17 Aug 2009 19:31:16 -0700 (PDT)
Date: Mon, 17 Aug 2009 19:31:16 -0700
From: Alan Coopersmith <Alan.Coopersmith@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <20090817230253.GF1043@Sun.COM>
Sender: Alan.Coopersmith@sun.com
To: Nicolas Williams <Nicolas.Williams@sun.com>
Cc: Darren Reed <dr146992@sac.sfbay.sun.com>, PSARC-ext@sun.com
Message-id: <4A8A1274.1060907@sun.com>
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
X-Enigmail-Version: 0.95.1
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4A89DEC9.10606@sun.com> <20090817230253.GF1043@Sun.COM>
User-Agent: Thunderbird 2.0.0.21 (X11/20090323)
Content-Length: 1648
Status: RO
X-Status: $$$$
X-UID: 0000000015

Nicolas Williams wrote:
> On Mon, Aug 17, 2009 at 03:50:49PM -0700, Alan Coopersmith wrote:
>> Darren Reed wrote:
>>> One could argue that the original daemon() does not offer much flexibility
>>> and that this approach to daemonization is actually not sufficient in SMF
>>> world. While this is true, it is out of scope of this case to provide modern
>>> alternative.
>> While providing an alternative interface is both out-of-scope, and missing
>> the point of providing a BSD/Linux compatible interface, have you discussed
>> with the SMF team whether daemon() should be putting the process into a new
>> process contract?
> 
> That would probably be a bad thing to do by default.  Much code calls
> daemon() -- if you try to make a non-transient service out of a program
> that does call daemon(), and daemon() does place it in a separate
> process contract, then the daemon's original process contract will
> empty, causing the restarter to restart the service, which is...
> probably not what you want :)

Okay - I was thinking in the context of when you manually start a daemon
from your login session, and the daemon() call is used to divorce it from
your process group so it doesn't get SIGHUP'ed when your shell dies.

As long as it's been thought about and determined to be doing something
reasonable, that's good enough for me.

+1 on this, as someone who has to maintain upstream code with autoconf
checks for daemon() that are pretty much only for Solaris these days,
as all other supported platforms already have it.

-- 
	-Alan Coopersmith-           alan.coopersmith@sun.com
	 Sun Microsystems, Inc. - X Window System Engineering


From gdamore@sun.com Mon Aug 17 19:37:26 2009
Received: from sunmail5.uk.sun.com (sunmail5.UK.Sun.COM [129.156.85.165])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7I2bQJN017758
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 17 Aug 2009 19:37:26 -0700 (PDT)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by sunmail5.uk.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2) with ESMTP id n7I2bEnR011446
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 03:37:25 +0100 (BST)
Received: from pmxchannel-daemon.nwk-avmta-1.sfbay.Sun.COM by
 nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOJ00L0RWMCI300@nwk-avmta-1.sfbay.Sun.COM> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Mon, 17 Aug 2009 19:37:24 -0700 (PDT)
Received: from sca-es-mail-2.sun.com ([192.18.43.133])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOJ00MV5WMC7VC0@nwk-avmta-1.sfbay.Sun.COM> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Mon,
 17 Aug 2009 19:37:24 -0700 (PDT)
Received: from fe-sfbay-09.sun.com ([192.18.43.129])
	by sca-es-mail-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7I2bOrw017050	for
 <PSARC-ext@sun.com>; Mon, 17 Aug 2009 19:37:24 -0700 (PDT)
Received: from conversion-daemon.fe-sfbay-09.sun.com by fe-sfbay-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KOJ00B00WH1WJ00@fe-sfbay-09.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Mon, 17 Aug 2009 19:37:24 -0700 (PDT)
Received: from [192.168.251.11] ([unknown] [76.93.15.33])
 by fe-sfbay-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 with ESMTPSA id <0KOJ00JG4WMBUX60@fe-sfbay-09.sun.com>; Mon,
 17 Aug 2009 19:37:24 -0700 (PDT)
Date: Mon, 17 Aug 2009 19:37:23 -0700
From: "Garrett D'Amore" <gdamore@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <4A89EE48.2070804@Sun.COM>
Sender: Garrett.Damore@sun.com
To: Darren Reed <Darren.Reed@sun.com>
Cc: Nicolas Williams <Nicolas.Williams@sun.com>,
        Darren Reed <dr146992@sac.sfbay.sun.com>, PSARC-ext@sun.com
Message-id: <4A8A13E3.1080301@sun.com>
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4A89E59E.7070604@sun.com> <20090817232947.GI1043@Sun.COM>
 <4A89E9A3.5070507@sun.com> <4A89EE48.2070804@Sun.COM>
User-Agent: Thunderbird 2.0.0.18 (X11/20081201)
Content-Length: 2176
Status: RO
X-Status: $$$$
X-UID: 0000000016

Darren Reed wrote:
> On 17/08/09 04:37 PM, Garrett D'Amore wrote:
>> Nicolas Williams wrote:
>>>
>>>
>>>  
>>>> I'm disinclined to support an interface that is substandard *and* 
>>>> which does not share widespread adoption in the FOSS community.
>>>>     
>>>
>>> In general daemon() is not powerful enough.  Often one wants the 
>>> process
>>> that calls it to not exit until the progeny forked by daemon() has
>>> completed additional initialization, or perhaps one should not call
>>> daemon() until sundry initialization is complete.
>>>
>>> But daemon() is quite common.  Its absence is usually well-tolerated
>>> (#ifndef HAVE_DAEMON ...).  But still, we should provide it.
>>>
>>>  
>>>> If I've misunderstood about the availability of daemon() in Linux, 
>>>> please feel free to correct me.  Otherwise I'd be punching the 
>>>> derail button on this case.
>>>>     
>>>
>>> It's there in libc in RHEL5.
>>>   
>>
>> If its there in RHEL5, then I'll withdraw my major concerns.  I think 
>> the documentation should point users to other, more robust ways of 
>> dealing with daemon startup.
>> Last question: Is "Committed" the way to deal with this?  If we want 
>> to steer developers elsewhere, should we instead just list this 
>> interface with "Committed Obsolete" or perhaps "Uncommitted".
>
> Why?
> Would we plan on removing daemon() in the future?
>
> I can't see us replacing it with a function that does anything else...
> I'm sure the discussion would be much more heated if someone
> tried to ARC a daemon() that behaved any differently.
>
> And whilst its functionality may be basic, sometimes that is
> all that is wanted. I see no harm with this being Committed.
>
> Where else can we steer developers?

If daemon() does all that is required, or rather, if we have nothing 
better to point developers towards, then I'm happy with the case as 
specified.

I got the impression that there were different things that should be 
done in the SMF world.  I've not developed any daemonized programs since 
Solaris 10 introduced SMF (I've been working in kernel space rather), so 
I apologize if I was a bit unclear on some of the details.

    - Garrett


From gdamore@sun.com Mon Aug 17 19:38:49 2009
Received: from sunmail4.singapore.sun.com (sunmail4.Singapore.Sun.COM [129.158.71.19])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7I2cmQj017773
	for <psarc-ext@sac.sfbay.sun.com>; Mon, 17 Aug 2009 19:38:49 -0700 (PDT)
Received: from nwk-avmta-2.sfbay.sun.com (nwk-avmta-2.SFBay.Sun.COM [129.145.155.6])
	by sunmail4.singapore.sun.com (8.13.4+Sun/8.13.3/ENSMAIL,v2.2) with ESMTP id n7I2cfNM029747
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 10:38:47 +0800 (SGT)
Received: from pmxchannel-daemon.nwk-avmta-2.sfbay.sun.com by
 nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOJ00L05WOLC400@nwk-avmta-2.sfbay.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Mon, 17 Aug 2009 19:38:45 -0700 (PDT)
Received: from sca-es-mail-2.sun.com ([192.18.43.133])
 by nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOJ002P9WOL9NB0@nwk-avmta-2.sfbay.sun.com> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Mon,
 17 Aug 2009 19:38:45 -0700 (PDT)
Received: from fe-sfbay-09.sun.com ([192.18.43.129])
	by sca-es-mail-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7I2cjBt017076	for
 <PSARC-ext@sun.com>; Mon, 17 Aug 2009 19:38:45 -0700 (PDT)
Received: from conversion-daemon.fe-sfbay-09.sun.com by fe-sfbay-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KOJ00B00WH1WJ00@fe-sfbay-09.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Mon, 17 Aug 2009 19:38:45 -0700 (PDT)
Received: from [192.168.251.11] ([unknown] [76.93.15.33])
 by fe-sfbay-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 with ESMTPSA id <0KOJ00JLSWOKUX60@fe-sfbay-09.sun.com>; Mon,
 17 Aug 2009 19:38:45 -0700 (PDT)
Date: Mon, 17 Aug 2009 19:38:43 -0700
From: "Garrett D'Amore" <gdamore@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <4A89E76D.1010407@sun.com>
Sender: Garrett.Damore@sun.com
To: Alan Coopersmith <Alan.Coopersmith@sun.com>
Cc: Darren Reed <dr146992@sac.sfbay.sun.com>, PSARC-ext@sun.com
Message-id: <4A8A1433.1090003@sun.com>
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4A89E59E.7070604@sun.com> <4A89E76D.1010407@sun.com>
User-Agent: Thunderbird 2.0.0.18 (X11/20081201)
Content-Length: 324
Status: RO
X-Status: $$$$
X-UID: 0000000017

Alan Coopersmith wrote:
> Garrett D'Amore wrote:
>   
>> From what I could tell, the daemon() function is not present on Linux
>> (glibc).   
>>     
>
> http://www.kernel.org/doc/man-pages/online/pages/man3/daemon.3.html
>
>   
Thanks.  I didn't see it when I looked in what I thought was the glibc 
manual.

    - Garrett

From Joerg.Schilling9ab33xy531fokus.fraunhofer.de@bounce.antispameurope.com Tue Aug 18 08:21:58 2009
Received: from newsunmail1brm.central.sun.com (newsunmail1brm.Central.Sun.COM [129.147.62.245])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7IFLwOk021563
	for <psarc-ext@sac.sfbay.sun.com>; Tue, 18 Aug 2009 08:21:58 -0700 (PDT)
Received: from nwk-avmta-2.sfbay.sun.com (nwk-avmta-2.SFBay.Sun.COM [129.145.155.6])
	by newsunmail1brm.central.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id n7IFLuvo044610
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 09:21:57 -0600 (MDT)
Received: from pmxchannel-daemon.nwk-avmta-2.sfbay.sun.com by
 nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOK0050NW0JKX00@nwk-avmta-2.sfbay.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Tue, 18 Aug 2009 08:21:55 -0700 (PDT)
Received: from brmea-mail-2.sun.com ([192.18.98.43])
 by nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOK003UQW0HK420@nwk-avmta-2.sfbay.sun.com> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Tue,
 18 Aug 2009 08:21:54 -0700 (PDT)
Received: from relay43i.sun.com ([192.5.209.74])
	by brmea-mail-2.sun.com (8.13.6+Sun/8.12.9) with ESMTP id n7IErPoL025928	for
 <PSARC-ext@sun.com>; Tue, 18 Aug 2009 15:21:53 +0000 (GMT)
Received: from mms49es.mms.us.syntegra.com ([160.41.221.232] [160.41.221.232])
 by relay43i.sun.com with ESMTP id BT-MMP-2881128 for PSARC-ext@sun.com; Tue,
 18 Aug 2009 15:21:52 +0000 (Z)
Received: from relay42i.sun.com (relay42i.sun.com [192.5.209.72])
 by mms49es.mms.us.syntegra.com with ESMTP id BT-MMP-61999175 for
 PSARC-ext@sun.com; Tue, 18 Aug 2009 15:21:34 +0000 (Z)
Received: from relay04-haj2.antispameurope.com ([83.246.65.54] [83.246.65.54])
 by relay4i.sun.com with ESMTP id BT-MMP-14715582 for PSARC-ext@sun.com; Tue,
 18 Aug 2009 15:21:33 +0000 (Z)
Received: by relay04-haj2.antispameurope.com (ASE-Secure-MTA, from userid 1000)
	id 6BEB85EC1AB; Tue, 18 Aug 2009 17:21:32 +0200 (CEST)
Received: from pluto.fokus.fraunhofer.de
 (pluto.fokus.fraunhofer.de [195.37.77.164])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)	by relay04-haj2.antispameurope.com
 (ASE-Secure-MTA) with ESMTP id 38F6B5EC1AB; Tue,
 18 Aug 2009 17:21:31 +0200 (CEST)
Received: from EXCHSRV.fokus.fraunhofer.de
 (bohr.fokus.fraunhofer.de [10.147.9.231])	by pluto.fokus.fraunhofer.de
 (8.14.2/8.14.2) with SMTP id n7IFLUOq004032; Tue,
 18 Aug 2009 17:21:31 +0200 (MEST)
Received: from rigel ([10.147.65.195]) by EXCHSRV.fokus.fraunhofer.de with
 Microsoft SMTPSVC(6.0.3790.3959); Tue, 18 Aug 2009 17:21:30 +0200
Date: Tue, 18 Aug 2009 17:20:52 +0200
From: Joerg.Schilling@fokus.fraunhofer.de (Joerg Schilling)
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
Sender: Joerg.Schilling9ab33xy531fokus.fraunhofer.de@bounce.antispameurope.com
To: PSARC-ext@sun.com, dr146992@sac.sfbay.sun.com
Message-id: <4a8ac6d4.WE3Vt1K5pysl7kJ2%Joerg.Schilling@fokus.fraunhofer.de>
MIME-version: 1.0
Content-type: text/plain; charset=ISO-8859-1
Content-transfer-encoding: 8BIT
X-PMX-Version: 5.4.1.325704
X-Brightmail-Tracker: AAAAAA==
X-Antispam: No, score=0.0/5.0, scanned in 3.170sec at (localhost [127.0.0.1])
	by smf-spamd v1.3.1 - http://smfs.sf.net/
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
User-Agent: nail 11.22 3/20/05
X-OriginalArrivalTime: 18 Aug 2009 15:21:30.0605 (UTC)
 FILETIME=[9004C9D0:01CA2017]
Content-Length: 728
Status: RO
X-Status: $$$$
X-UID: 0000000018

Darren Reed <dr146992@sac.sfbay.sun.com> wrote:

> EXAMPLES
>
>      The main() function of a network server could look like this:
>
>      int background;	/* background flag */
>
>      /* Load and verify the configuration. */
>
>      /* Go into background. */
>      if (background && daemon(0, 0) < 0)
>              err(1, "daemon");

Does libc include a function called err()?

AFAIK, this is specific to FreeBSD and similar.
Jörg

-- 
 EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js@cs.tu-berlin.de                (uni)  
       joerg.schilling@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily

From Darren.Moffat@sun.com Tue Aug 18 08:27:03 2009
Received: from sunmail4.singapore.sun.com (sunmail4.Singapore.Sun.COM [129.158.71.19])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7IFR2bx021600
	for <psarc-ext@sac.sfbay.sun.com>; Tue, 18 Aug 2009 08:27:02 -0700 (PDT)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by sunmail4.singapore.sun.com (8.13.4+Sun/8.13.3/ENSMAIL,v2.2) with ESMTP id n7IFQxi1028919
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 23:27:01 +0800 (SGT)
Received: from pmxchannel-daemon.nwk-avmta-1.sfbay.Sun.COM by
 nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOK00909W8ZP200@nwk-avmta-1.sfbay.Sun.COM> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Tue, 18 Aug 2009 08:26:59 -0700 (PDT)
Received: from gmp-eb-inf-2.sun.com ([192.18.6.24])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOK0058JW8XHB30@nwk-avmta-1.sfbay.Sun.COM> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Tue,
 18 Aug 2009 08:26:58 -0700 (PDT)
Received: from fe-emea-10.sun.com
 (gmp-eb-lb-1-fe1.eu.sun.com [192.18.6.7] (may be forged))
	by gmp-eb-inf-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7IFQu76022603	for
 <PSARC-ext@sun.com>; Tue, 18 Aug 2009 15:26:57 +0000 (GMT)
Received: from conversion-daemon.fe-emea-10.sun.com by fe-emea-10.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KOK00D00W32CW00@fe-emea-10.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Tue, 18 Aug 2009 16:26:49 +0100 (BST)
Received: from [192.168.1.105]
 (cpc2-rdng20-2-0-cust917.15-3.cable.virginmedia.com [86.28.167.150])
 by fe-emea-10.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 with ESMTPSA id <0KOK002YJW8M2XC0@fe-emea-10.sun.com>; Tue,
 18 Aug 2009 16:26:46 +0100 (BST)
Date: Tue, 18 Aug 2009 16:26:35 +0100
From: Darren J Moffat <Darren.Moffat@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <4a8ac6d4.WE3Vt1K5pysl7kJ2%Joerg.Schilling@fokus.fraunhofer.de>
Sender: Darren.Moffat@sun.com
To: Joerg Schilling <Joerg.Schilling@fokus.fraunhofer.de>
Cc: PSARC-ext@sun.com, dr146992@sac.sfbay.sun.com
Message-id: <4A8AC82B.1070601@Sun.COM>
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4a8ac6d4.WE3Vt1K5pysl7kJ2%Joerg.Schilling@fokus.fraunhofer.de>
User-Agent: Thunderbird 2.0.0.21 (X11/20090623)
Content-Length: 644
Status: RO
X-Status: $$$$
X-UID: 0000000019

Joerg Schilling wrote:
> Darren Reed <dr146992@sac.sfbay.sun.com> wrote:
> 
>> EXAMPLES
>>
>>      The main() function of a network server could look like this:
>>
>>      int background;	/* background flag */
>>
>>      /* Load and verify the configuration. */
>>
>>      /* Go into background. */
>>      if (background && daemon(0, 0) < 0)
>>              err(1, "daemon");
> 
> Does libc include a function called err()?

Yes:

changeset:   4891:f4f971e9574d
date:        Sat Aug 18 10:07:23 2007 -0700
description:
         PSARC/2006/662 Make err/warn part of Solaris's libc
         6495220 add err() et al. to libc

-- 
Darren J Moffat

From cyril.plisko@gmail.com Tue Aug 18 08:48:20 2009
Received: from sunmail5.uk.sun.com (sunmail5.UK.Sun.COM [129.156.85.165])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7IFmJVe023042
	for <psarc-ext@sac.sfbay.sun.com>; Tue, 18 Aug 2009 08:48:20 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail5.uk.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2) with ESMTP id n7IFmJ4C010799
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 16:48:19 +0100 (BST)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOK0000FX8I8700@brm-avmta-1.central.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Tue, 18 Aug 2009 09:48:18 -0600 (MDT)
Received: from sca-ea-mail-1.sun.com ([192.18.43.24])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOK00G0LX8HZK60@brm-avmta-1.central.sun.com> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Tue,
 18 Aug 2009 09:48:18 -0600 (MDT)
Received: from relay15i.sun.com
 (ip125.net129179-4.block1.us.syntegra.com [129.179.4.125])
	by sca-ea-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7IFgdof015077	for
 <PSARC-ext@sun.com>; Tue, 18 Aug 2009 15:48:17 +0000 (GMT)
Received: from mmp11es.mmp.us.syntegra.com ([160.41.208.11] [160.41.208.11])
 by relay15i.sun.com with ESMTP id BT-MMP-309570 for PSARC-ext@sun.com; Tue,
 18 Aug 2009 15:48:17 +0000 (Z)
Received: from relay15i.sun.com (relay15i.sun.com [129.179.4.125])
 by mmp11es.mmp.us.syntegra.com with ESMTP id BT-MMP-60920411 for
 PSARC-ext@sun.com; Tue, 18 Aug 2009 15:34:27 +0000 (Z)
Received: from ey-out-1920.google.com ([74.125.78.148] [74.125.78.148])
 by relay1i.sun.com with ESMTP id BT-MMP-11208571 for PSARC-ext@sun.com; Tue,
 18 Aug 2009 15:34:27 +0000 (Z)
Received: by ey-out-1920.google.com with SMTP id 13so683593eye.50 for
 <PSARC-ext@sun.com>; Tue, 18 Aug 2009 08:34:20 -0700 (PDT)
Received: by 10.216.39.80 with SMTP id c58mr1316641web.122.1250609659942; Tue,
 18 Aug 2009 08:34:19 -0700 (PDT)
Date: Tue, 18 Aug 2009 18:32:30 +0300
From: Cyril Plisko <cyril.plisko@mountall.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <4a8ac6d4.WE3Vt1K5pysl7kJ2%Joerg.Schilling@fokus.fraunhofer.de>
Sender: cyril.plisko@gmail.com
To: Joerg Schilling <Joerg.Schilling@fokus.fraunhofer.de>
Cc: PSARC-ext@sun.com, dr146992@sac.sfbay.sun.com
Message-id: <c7dddeaa0908180832q12953782s8a3d67756ada2597@mail.gmail.com>
MIME-version: 1.0
Content-type: text/plain; charset=ISO-8859-1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=gmail.com;
 s=gamma;        h=domainkey-signature:mime-version:sender:received:in-reply-to
         :references:from:date:x-google-sender-auth:message-id:subject:to:cc
 :content-type:content-transfer-encoding;
 bh=8JsPZFElvLCu0QXJlny79w/UkCewLjOPx3tXXPfsN+0=;
 b=AkqEPKNCHRPEj8XPcLBETytiz4ELlD2uEipawsSYpCvWhexfNccskEv6pIq3f2r2S0
 8YTHHxysyeANZvR0ZnHQE2bvSYGrPaWup5tjCaq51sF9N0PuzkmagHG6SoAywpCI4dPi
 zNK4vlcDi2vkQn8e1RjGhrOs+wp32D3Uh1Nf8=
DomainKey-Signature: a=rsa-sha1; c=nofws;        d=gmail.com; s=gamma;
 h=mime-version:sender:in-reply-to:references:from:date
 :x-google-sender-auth:message-id:subject:to:cc:content-type
 :content-transfer-encoding;
 b=Hh0t4N88+X3Nn8wvYJLFgsvjTbBN/rx2q1gJEhzLbDTqLDB986M+GMWLmPCW/5YjW2
 lfTrjkKeGLFnr1dGfvOCgtFewwAJp7vQW2eSwCKEsaWIZ3j20fN8p1vWjSmNDddqQm5x
 rQ62SXfKosLLAtN1AfgCFW8wkhKArBaVYJ9JA=
X-PMX-Version: 5.4.1.325704
X-Brightmail-Tracker: AAAAAA==
X-Google-Sender-Auth: fad8707c5fe2ebae
X-Antispam: No, score=0.0/5.0, scanned in 5.929sec at (localhost [127.0.0.1])
	by smf-spamd v1.3.1 - http://smfs.sf.net/
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4a8ac6d4.WE3Vt1K5pysl7kJ2%Joerg.Schilling@fokus.fraunhofer.de>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by sac.sfbay.sun.com id n7IFmJVe023042
Content-Length: 782
Status: RO
X-Status: $$$$
X-UID: 0000000020

On Tue, Aug 18, 2009 at 6:20 PM, Joerg
Schilling<Joerg.Schilling@fokus.fraunhofer.de> wrote:
> Darren Reed <dr146992@sac.sfbay.sun.com> wrote:
>
>> EXAMPLES
>>
>>      The main() function of a network server could look like this:
>>
>>      int background;  /* background flag */
>>
>>      /* Load and verify the configuration. */
>>
>>      /* Go into background. */
>>      if (background && daemon(0, 0) < 0)
>>              err(1, "daemon");
>
> Does libc include a function called err()?

Yup. It two integrated exactly two years ago.

changeset:   4891:f4f971e9574d
user:        vk199839
date:        Sat Aug 18 10:07:23 2007 -0700
description:
        PSARC/2006/662 Make err/warn part of Solaris's libc
        6495220 add err() et al. to libc

-- 
Regards,
        Cyril


From Vladimir.Kotal@sun.com Tue Aug 18 12:34:51 2009
Received: from sunmail2sca.sfbay.sun.com (sunmail2sca.SFBay.Sun.COM [129.145.155.234])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7IJYp3u007290
	for <psarc-ext@sac.sfbay.sun.com>; Tue, 18 Aug 2009 12:34:51 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail2sca.sfbay.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id n7IJYnbt028266
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 12:34:50 -0700 (PDT)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOL00M0T7Q0Y700@brm-avmta-1.central.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Tue, 18 Aug 2009 13:34:48 -0600 (MDT)
Received: from gmp-eb-inf-2.sun.com ([192.18.6.24])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOL00ADX7PY44A0@brm-avmta-1.central.sun.com> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Tue,
 18 Aug 2009 13:34:47 -0600 (MDT)
Received: from fe-emea-10.sun.com
 (gmp-eb-lb-1-fe1.eu.sun.com [192.18.6.7] (may be forged))
	by gmp-eb-inf-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7IJYkuc015909	for
 <PSARC-ext@sun.com>; Tue, 18 Aug 2009 19:34:46 +0000 (GMT)
Received: from conversion-daemon.fe-emea-10.sun.com by fe-emea-10.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KOL003007J0FY00@fe-emea-10.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Tue, 18 Aug 2009 20:34:23 +0100 (BST)
Received: from [10.0.1.57] ([unknown] [78.102.201.214])
 by fe-emea-10.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit
 (built Jul  2 2009)) with ESMTPSA id <0KOL002337PAMRB0@fe-emea-10.sun.com>;
 Tue, 18 Aug 2009 20:34:22 +0100 (BST)
Date: Tue, 18 Aug 2009 21:34:22 +0200
From: Vladimir Kotal <Vladimir.Kotal@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <152077DB-FFA8-4561-B513-35B237404C16@workingcode.com>
Sender: Vladimir.Kotal@sun.com
To: James Carlson <carlsonj@workingcode.com>
Cc: Nicolas Williams <Nicolas.Williams@sun.com>,
        "Garrett D'Amore" <gdamore@sun.com>,
        "PSARC-ext@sun.com" <PSARC-ext@sun.com>,
        Darren Reed <dr146992@sac.sfbay.sun.com>
Message-id: <4A8B023E.6050807@Sun.COM>
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4A89E59E.7070604@sun.com> <20090817232947.GI1043@Sun.COM>
 <152077DB-FFA8-4561-B513-35B237404C16@workingcode.com>
User-Agent: Thunderbird 2.0.0.21 (X11/20090623)
Content-Length: 1265
Status: RO
X-Status: $$$$
X-UID: 0000000021

James Carlson wrote:
> On Aug 17, 2009, at 7:29 PM, Nicolas Williams <Nicolas.Williams@sun.com> 
> wrote:
>>> If I've misunderstood about the availability of daemon() in Linux,
>>> please feel free to correct me.  Otherwise I'd be punching the derail
>>> button on this case.
>>
>> It's there in libc in RHEL5.
> 
> It's older and more common than that. It's a BSD-ism.

Yep, the beast is quite old. The daemon() function is present in libc 
sources of 4.4BSD-Lite with a date of 1993. It can be also found in 
4.3BSD-Reno with a date of 1990 but not in libc (in libutil).

As for the other OSes and their libc's I made couple of source code 
tours and this is what I found:

  OS              present in libc since
--------------+---------------------------
  OpenBSD         1.0 (1995)
  NetBSD          1.0 (1993)
  FreeBSD         2.0_ALPHA (1993)
  glibc           1.09.1 (1996, from BSD)

 From the Linux systems I have access to, it's present in Fedora 11 and 
Gentoo 1.12.11.1 and Ubuntu Dapper Drake.

As for the other OSes where source code is not generally available, I 
also found it in the documentation of:

  OS              documented in
--------------+--------------------------
  Mac OS X        10.4.11 (verified)
  QNX             6.3.0SP3


v.

From Vladimir.Kotal@sun.com Tue Aug 18 12:41:21 2009
Received: from sunmail5.uk.sun.com (sunmail5.UK.Sun.COM [129.156.85.165])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7IJfKmi007377
	for <psarc-ext@sac.sfbay.sun.com>; Tue, 18 Aug 2009 12:41:21 -0700 (PDT)
Received: from nwk-avmta-2.sfbay.sun.com (nwk-avmta-2.SFBay.Sun.COM [129.145.155.6])
	by sunmail5.uk.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2) with ESMTP id n7IJfJLh009659
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 20:41:20 +0100 (BST)
Received: from pmxchannel-daemon.nwk-avmta-2.sfbay.sun.com by
 nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOL00L0B80TUY00@nwk-avmta-2.sfbay.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Tue, 18 Aug 2009 12:41:17 -0700 (PDT)
Received: from gmp-eb-inf-1.sun.com ([192.18.6.21])
 by nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOL00DLR80STCC0@nwk-avmta-2.sfbay.sun.com> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Tue,
 18 Aug 2009 12:41:16 -0700 (PDT)
Received: from fe-emea-10.sun.com
 (gmp-eb-lb-1-fe1.eu.sun.com [192.18.6.7] (may be forged))
	by gmp-eb-inf-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7IJfFxq020710	for
 <PSARC-ext@sun.com>; Tue, 18 Aug 2009 19:41:15 +0000 (GMT)
Received: from conversion-daemon.fe-emea-10.sun.com by fe-emea-10.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KOL009007VOLA00@fe-emea-10.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Tue, 18 Aug 2009 20:41:15 +0100 (BST)
Received: from [10.0.1.57] ([unknown] [78.102.201.214])
 by fe-emea-10.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit
 (built Jul  2 2009)) with ESMTPSA id <0KOL002X280RMRC0@fe-emea-10.sun.com>;
 Tue, 18 Aug 2009 20:41:15 +0100 (BST)
Date: Tue, 18 Aug 2009 21:41:15 +0200
From: Vladimir Kotal <Vladimir.Kotal@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <200908172345.n7HNjjb5028148@marduk.eng.sun.com>
Sender: Vladimir.Kotal@sun.com
To: Gary Winiger <gww@eng.sun.com>
Cc: PSARC-ext@sun.com, dr146992@sac.sfbay.sun.com
Message-id: <4A8B03DB.9030208@Sun.COM>
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200908172345.n7HNjjb5028148@marduk.eng.sun.com>
User-Agent: Thunderbird 2.0.0.21 (X11/20090623)
Content-Length: 570
Status: RO
X-Status: $$$$
X-UID: 0000000022

Gary Winiger wrote:
>> DESCRIPTION
> 
>>      If the nochdir option is other than zero the working directory will
>>      not be changed to the root directory, otherwise it will be.
> 
> 	Is this / or ~root?

/

>> RETURN VALUES
>>      Upon successful completion, daemon() returns 0. Otherwise it returns -1.
> 
> 	What are the failure modes?  Is errno set?

daemon() returns -1 only if either fork() or setsid() fail. In that case 
errno will be set to the values specified in fork(2) and setsid(2).

> 	Clarifications in the man page would be helpful.

Will do.


v.

From Vladimir.Kotal@Sun.COM Tue Aug 18 13:23:57 2009
Received: from sunmail2sca.sfbay.sun.com (sunmail2sca.SFBay.Sun.COM [129.145.155.234])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7IKNvto009330
	for <psarc-ext@sac.sfbay.sun.com>; Tue, 18 Aug 2009 13:23:57 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail2sca.sfbay.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id n7IKNuZp017950
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 13:23:56 -0700 (PDT)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOL004199ZWXP00@brm-avmta-1.central.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Tue, 18 Aug 2009 14:23:56 -0600 (MDT)
Received: from gmp-eb-inf-2.sun.com ([192.18.6.24])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOL00AFX9ZV41C0@brm-avmta-1.central.sun.com> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Tue,
 18 Aug 2009 14:23:55 -0600 (MDT)
Received: from fe-emea-10.sun.com
 (gmp-eb-lb-1-fe1.eu.sun.com [192.18.6.7] (may be forged))
	by gmp-eb-inf-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7IKNsPu020070	for
 <PSARC-ext@sun.com>; Tue, 18 Aug 2009 20:23:54 +0000 (GMT)
Received: from conversion-daemon.fe-emea-10.sun.com by fe-emea-10.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KOL00D009SWC000@fe-emea-10.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Tue, 18 Aug 2009 21:23:29 +0100 (BST)
Received: from [10.0.1.57] ([unknown] [78.102.201.214])
 by fe-emea-10.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit
 (built Jul  2 2009)) with ESMTPSA id <0KOL00F0T9Z5U1A0@fe-emea-10.sun.com>;
 Tue, 18 Aug 2009 21:23:29 +0100 (BST)
Date: Tue, 18 Aug 2009 22:23:28 +0200
From: Vladimir Kotal <Vladimir.Kotal@Sun.COM>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <20090817235654.GK1043@Sun.COM>
Sender: Vladimir.Kotal@Sun.COM
To: Nicolas Williams <Nicolas.Williams@Sun.COM>
Cc: "Garrett D'Amore" <gdamore@Sun.COM>,
        Darren Reed <dr146992@sac.sfbay.sun.com>, PSARC-ext@Sun.COM
Message-id: <4A8B0DC0.7000000@Sun.COM>
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4A89E59E.7070604@sun.com> <20090817232947.GI1043@Sun.COM>
 <4A89E9A3.5070507@sun.com> <20090817235654.GK1043@Sun.COM>
User-Agent: Thunderbird 2.0.0.21 (X11/20090623)
Content-Length: 1248
Status: RO
X-Status: $$$$
X-UID: 0000000023

Nicolas Williams wrote:

<snip>

> Ideally we'd have something like:
> 
> /*
>  * Depending on flags daemon2() will fork(), setsid(), fork(),
>  * chdir("/"), etcetera.  In the child daemon2() will call
>  * templace_callback(); if that returns non-zero, then daemon2() will
>  * exit(2) with that error.  In the grandchild daemon2() will call
>  * init_callback(init_cb_data), and it that returns zero, then it will
>  * call context_setup(context_setup_data), and the grandparent will
>  * exit() with the first non-zero return value of those callbacks, else
>  * it will exit(0).  (Internally daemon2() uses an IPC mechanism by
>  * which the grandchild communicates its status to the grandparent.)

This is more generic version of the 2-phase/split daemonization approach 
outlined in:

5079306 contemplate a uu_daemonize_start()/_end()

This seems to be the ideal approach in SMF world where the grandparent 
would only exit if an error occurred or the service is ready to do it's job.

Given such thing does not exist yet, the man page can at most encourage 
the users of the function to process everything they could before 
calling it in order to foster the right behavior but this is already 
sort of present in the EXAMPLES section.


v.

From Darren.Reed@sun.com Tue Aug 18 13:26:47 2009
Received: from sunmail5.uk.sun.com (sunmail5.UK.Sun.COM [129.156.85.165])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7IKQkaX009445
	for <psarc-ext@sac.sfbay.sun.com>; Tue, 18 Aug 2009 13:26:47 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail5.uk.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2) with ESMTP id n7IKQeLl010855
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 21:26:46 +0100 (BST)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOL0050HA4K6I00@brm-avmta-1.central.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Tue, 18 Aug 2009 14:26:44 -0600 (MDT)
Received: from gmp-eb-inf-1.sun.com ([192.18.6.21])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOL00A75A4J3XC0@brm-avmta-1.central.sun.com> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Tue,
 18 Aug 2009 14:26:44 -0600 (MDT)
Received: from fe-emea-09.sun.com
 (gmp-eb-lb-1-fe1.eu.sun.com [192.18.6.7] (may be forged))
	by gmp-eb-inf-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7IKQhPQ024770	for
 <PSARC-ext@sun.com>; Tue, 18 Aug 2009 20:26:43 +0000 (GMT)
Received: from conversion-daemon.fe-emea-09.sun.com by fe-emea-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KOL00G009UUZW00@fe-emea-09.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Tue, 18 Aug 2009 21:26:29 +0100 (BST)
Received: from [129.146.106.55] ([unknown] [129.146.106.55])
 by fe-emea-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 with ESMTPSA id <0KOL003CEA43H420@fe-emea-09.sun.com>; Tue,
 18 Aug 2009 21:26:29 +0100 (BST)
Date: Tue, 18 Aug 2009 13:28:07 -0700
From: Darren Reed <Darren.Reed@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
Sender: Darren.Reed@sun.com
To: Darren Reed <dr146992@sac.sfbay.sun.com>
Cc: PSARC-ext@sun.com
Message-id: <4A8B0ED7.30001@Sun.COM>
MIME-version: 1.0
Content-type: multipart/mixed; boundary="Boundary_(ID_5ygL/r+UgGeHXGQDx8H1LA)"
X-PMX-Version: 5.4.1.325704
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
User-Agent: Thunderbird 2.0.0.21 (X11/20090608)
Content-Length: 2582
Status: RO
X-Status: $$$$
X-UID: 0000000024

This is a multi-part message in MIME format.

--Boundary_(ID_5ygL/r+UgGeHXGQDx8H1LA)
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT

The updated spec is attached below.

Darren


--Boundary_(ID_5ygL/r+UgGeHXGQDx8H1LA)
Content-type: text/plain; name=daemon-3C.manpage.txt
Content-transfer-encoding: 7BIT
Content-disposition: inline; filename=daemon-3C.manpage.txt


Standard C Library Functions                              daemon(3C)



NAME
     daemon - basic daemonization function

SYNOPSIS
     #include <stdlib.h>

     int daemon(int nochdir, int noclose);


DESCRIPTION
     The daemon() function provides a way for applications to go into
     background.

     The function will ensure that the process calling this function:
       - runs in the background
       - detaches from the controlling terminal
       - forms a new process group
       - is not a session group leader

     The options to the function are treated as boolean variables and are
     evaluated using negative logic.

     If the nochdir option is other than zero the working directory will
     not be changed to the root directory ("/"), otherwise it will be.

     If the noclose option is other than zero the descriptors 0,1,2
     (normally corresponding to standard input, output and error output,
     depending on the application) will not be redirected to /dev/null,
     otherwise they will be.

RETURN VALUES
     Upon successful completion, daemon() returns 0. Otherwise it returns -1
     in which case errno will be set to the values specified in fork(2) and
     setsid(2).

EXAMPLES

     The main() function of a network server could look like this:

     int background;	/* background flag */

     /* Load and verify the configuration. */

     /* Go into background. */
     if (background && daemon(0, 0) < 0)
             err(1, "daemon");

     /* Process requests here. */

ATTRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:

     ____________________________________________________________
    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
    |_____________________________|_____________________________|
    | Interface Stability         | Committed                   |
    |_____________________________|_____________________________|
    | MT-Level                    | Async-Signal-Safe           |
    |_____________________________|_____________________________|


SEE ALSO
     attributes(5), fork(2), Intro(2), setsid(2)



--Boundary_(ID_5ygL/r+UgGeHXGQDx8H1LA)--

From Joerg.Schilling9ab33xy531fokus.fraunhofer.de@bounce.antispameurope.com Tue Aug 18 14:33:59 2009
Received: from newsunmail1brm.central.sun.com (newsunmail1brm.Central.Sun.COM [129.147.62.245])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7ILXxAk012274
	for <psarc-ext@sac.sfbay.sun.com>; Tue, 18 Aug 2009 14:33:59 -0700 (PDT)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by newsunmail1brm.central.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id n7ILXtSH056477
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 15:33:59 -0600 (MDT)
Received: from pmxchannel-daemon.nwk-avmta-1.sfbay.Sun.COM by
 nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOL00A11D8MKI00@nwk-avmta-1.sfbay.Sun.COM> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Tue, 18 Aug 2009 14:33:58 -0700 (PDT)
Received: from sca-ea-mail-2.sun.com ([192.18.43.25])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOL0080ED8LQS60@nwk-avmta-1.sfbay.Sun.COM> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Tue,
 18 Aug 2009 14:33:58 -0700 (PDT)
Received: from relay42i.sun.com ([192.5.209.72])
	by sca-ea-mail-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7ILX9oF027729	for
 <PSARC-ext@sun.com>; Tue, 18 Aug 2009 21:33:57 +0000 (GMT)
Received: from mmp41es.mmp.us.syntegra.com ([160.41.221.10] [160.41.221.10])
 by relay42i.sun.com with ESMTP id BT-MMP-253 for PSARC-ext@sun.com; Tue,
 18 Aug 2009 21:33:25 +0000 (Z)
Received: from relay42i.sun.com (relay42i.sun.com [192.5.209.72])
 by mmp41es.mmp.us.syntegra.com with ESMTP id BT-MMP-64586914 for
 PSARC-ext@sun.com; Tue, 18 Aug 2009 21:33:20 +0000 (Z)
Received: from relay02-haj2.antispameurope.com ([83.246.65.52] [83.246.65.52])
 by relay4i.sun.com with ESMTP id BT-MMP-6616 for PSARC-ext@sun.com; Tue,
 18 Aug 2009 21:33:21 +0000 (Z)
Received: by relay02-haj2.antispameurope.com (ASE-Secure-MTA, from userid 1000)
	id 2D56C6F04A6; Tue, 18 Aug 2009 23:32:58 +0200 (CEST)
Received: from pluto.fokus.fraunhofer.de
 (pluto.fokus.fraunhofer.de [195.37.77.164])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)	by relay02-haj2.antispameurope.com
 (ASE-Secure-MTA) with ESMTP id D58976F048A; Tue,
 18 Aug 2009 23:32:56 +0200 (CEST)
Received: from EXCHSRV.fokus.fraunhofer.de
 (bohr.fokus.fraunhofer.de [10.147.9.231])	by pluto.fokus.fraunhofer.de
 (8.14.2/8.14.2) with SMTP id n7ILWu4l009712; Tue,
 18 Aug 2009 23:32:56 +0200 (MEST)
Received: from rigel ([10.147.65.195]) by EXCHSRV.fokus.fraunhofer.de with
 Microsoft SMTPSVC(6.0.3790.3959); Tue, 18 Aug 2009 23:32:56 +0200
Date: Tue, 18 Aug 2009 23:32:17 +0200
From: Joerg.Schilling@fokus.fraunhofer.de (Joerg Schilling)
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <4A8B023E.6050807@Sun.COM>
Sender: Joerg.Schilling9ab33xy531fokus.fraunhofer.de@bounce.antispameurope.com
To: Vladimir.Kotal@sun.com, carlsonj@workingcode.com
Cc: PSARC-ext@sun.com, gdamore@sun.com, dr146992@sac.sfbay.sun.com
Message-id: <4a8b1de1.YjLtKwrM/N5ID2hP%Joerg.Schilling@fokus.fraunhofer.de>
MIME-version: 1.0
Content-type: text/plain; charset=ISO-8859-1
Content-transfer-encoding: 8BIT
X-PMX-Version: 5.4.1.325704
X-Brightmail-Tracker: AAAAAA==
X-Antispam: No, score=0.0/5.0, scanned in 3.532sec at (localhost [127.0.0.1])
	by smf-spamd v1.3.1 - http://smfs.sf.net/
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4A89E59E.7070604@sun.com> <20090817232947.GI1043@Sun.COM>
 <152077DB-FFA8-4561-B513-35B237404C16@workingcode.com>
 <4A8B023E.6050807@Sun.COM>
User-Agent: nail 11.22 3/20/05
X-OriginalArrivalTime: 18 Aug 2009 21:32:56.0724 (UTC)
 FILETIME=[7394AD40:01CA204B]
Content-Length: 725
Status: RO
X-Status: $$$$
X-UID: 0000000025

Vladimir Kotal <Vladimir.Kotal@sun.com> wrote:

> > It's older and more common than that. It's a BSD-ism.
>
> Yep, the beast is quite old. The daemon() function is present in libc 
> sources of 4.4BSD-Lite with a date of 1993. It can be also found in 
> 4.3BSD-Reno with a date of 1990 but not in libc (in libutil).

SunOS was never "based" on 4.3 but on 4.2 + additions from 4.3

Did you check the SCCS when it appeared first?

Jörg

-- 
 EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js@cs.tu-berlin.de                (uni)  
       joerg.schilling@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily

From Alan.Coopersmith@sun.com Tue Aug 18 14:43:52 2009
Received: from sunmail5.uk.sun.com (sunmail5.UK.Sun.COM [129.156.85.165])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7ILhpTu012716
	for <psarc-ext@sac.sfbay.sun.com>; Tue, 18 Aug 2009 14:43:51 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail5.uk.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2) with ESMTP id n7ILhiBh000489
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Tue, 18 Aug 2009 22:43:50 +0100 (BST)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOL00D0TDP29700@brm-avmta-1.central.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Tue, 18 Aug 2009 15:43:50 -0600 (MDT)
Received: from sca-es-mail-2.sun.com ([192.18.43.133])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOL008E5DOXZM20@brm-avmta-1.central.sun.com> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Tue,
 18 Aug 2009 15:43:49 -0600 (MDT)
Received: from fe-sfbay-09.sun.com ([192.18.43.129])
	by sca-es-mail-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7ILhjQ7025896	for
 <PSARC-ext@sun.com>; Tue, 18 Aug 2009 14:43:45 -0700 (PDT)
Received: from conversion-daemon.fe-sfbay-09.sun.com by fe-sfbay-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KOL00F00DMV4X00@fe-sfbay-09.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Tue, 18 Aug 2009 14:43:45 -0700 (PDT)
Received: from [10.6.102.27] ([unknown] [10.6.102.27])
 by fe-sfbay-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit
 (built Jul  2 2009)) with ESMTPSA id <0KOL00HUVDOCS060@fe-sfbay-09.sun.com>;
 Tue, 18 Aug 2009 14:43:25 -0700 (PDT)
Date: Tue, 18 Aug 2009 14:43:24 -0700
From: Alan Coopersmith <Alan.Coopersmith@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <4a8b1de1.YjLtKwrM/N5ID2hP%Joerg.Schilling@fokus.fraunhofer.de>
Sender: Alan.Coopersmith@sun.com
To: Joerg Schilling <Joerg.Schilling@fokus.fraunhofer.de>
Cc: Vladimir.Kotal@sun.com, carlsonj@workingcode.com, PSARC-ext@sun.com,
        gdamore@sun.com, dr146992@sac.sfbay.sun.com
Message-id: <4A8B207C.4060900@sun.com>
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
X-Enigmail-Version: 0.95.1
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4A89E59E.7070604@sun.com> <20090817232947.GI1043@Sun.COM>
 <152077DB-FFA8-4561-B513-35B237404C16@workingcode.com>
 <4A8B023E.6050807@Sun.COM>
 <4a8b1de1.YjLtKwrM/N5ID2hP%Joerg.Schilling@fokus.fraunhofer.de>
User-Agent: Thunderbird 2.0.0.21 (X11/20090323)
Content-Length: 939
Status: RO
X-Status: $$$$
X-UID: 0000000026

Joerg Schilling wrote:
> Vladimir Kotal <Vladimir.Kotal@sun.com> wrote:
> 
>>> It's older and more common than that. It's a BSD-ism.
>> Yep, the beast is quite old. The daemon() function is present in libc 
>> sources of 4.4BSD-Lite with a date of 1993. It can be also found in 
>> 4.3BSD-Reno with a date of 1990 but not in libc (in libutil).
> 
> SunOS was never "based" on 4.3 but on 4.2 + additions from 4.3
> 
> Did you check the SCCS when it appeared first?

That is not relevant to this case.   It is sufficient to know that it has
been in BSD & Linux libc for many years.   Exact dates are historical trivia,
and don't affect whether it's a good idea to ship it now.   (What version
SunOS was based on is even more irrelevant, since we're not talking about
modifying SunOS, or using SunOS as historical precedent.)

-- 
	-Alan Coopersmith-           alan.coopersmith@sun.com
	 Sun Microsystems, Inc. - X Window System Engineering


From Darren.Reed@sun.com Wed Aug 19 10:18:41 2009
Received: from sunmail4.singapore.sun.com (sunmail4.Singapore.Sun.COM [129.158.71.19])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7JHIeqC009857
	for <psarc-ext@sac.sfbay.sun.com>; Wed, 19 Aug 2009 10:18:41 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail4.singapore.sun.com (8.13.4+Sun/8.13.3/ENSMAIL,v2.2) with ESMTP id n7JHIbnU001223
	for <@sunmail2sca.sfbay.sun.com:PSARC-ext@sun.com>; Thu, 20 Aug 2009 01:18:39 +0800 (SGT)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KOM00N01W324500@brm-avmta-1.central.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Wed, 19 Aug 2009 11:18:38 -0600 (MDT)
Received: from gmp-eb-inf-1.sun.com ([192.18.6.21])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KOM007IKW32U0C0@brm-avmta-1.central.sun.com> for
 PSARC-ext@sun.com (ORCPT PSARC-ext@sun.com); Wed,
 19 Aug 2009 11:18:38 -0600 (MDT)
Received: from fe-emea-09.sun.com
 (gmp-eb-lb-1-fe1.eu.sun.com [192.18.6.7] (may be forged))
	by gmp-eb-inf-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7JHIbWg022352	for
 <PSARC-ext@sun.com>; Wed, 19 Aug 2009 17:18:37 +0000 (GMT)
Received: from conversion-daemon.fe-emea-09.sun.com by fe-emea-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KOM00100W1NGU00@fe-emea-09.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Wed, 19 Aug 2009 18:18:14 +0100 (BST)
Received: from [129.146.106.55] ([unknown] [129.146.106.55])
 by fe-emea-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 with ESMTPSA id <0KOM007Y8W2CY810@fe-emea-09.sun.com> for PSARC-ext@sun.com
 (ORCPT PSARC-ext@sun.com); Wed, 19 Aug 2009 18:18:13 +0100 (BST)
Date: Wed, 19 Aug 2009 10:18:14 -0700
From: Darren Reed <Darren.Reed@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <4A8B0ED7.30001@Sun.COM>
Sender: Darren.Reed@sun.com
To: Vladimir Kotal <Vladimir.Kotal@sun.com>
Cc: PSARC-ext@sun.com
Message-id: <4A8C33D6.1000806@Sun.COM>
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4A8B0ED7.30001@Sun.COM>
User-Agent: Thunderbird 2.0.0.21 (X11/20090608)
Content-Length: 338
Status: RO
X-Status: $$$$
X-UID: 0000000027

Vladimir,

In discussion at PSARC this morning, there was a request for more
documentation changes to the man page. People would like to see
more cross references to other documentation for how to write
daemons and their options on Solaris. This should include at least
references to contracts, tasks and advanced privilege use.

Darren


From Vladimir.Kotal@Sun.COM Wed Aug 19 12:52:48 2009
Received: from newsunmail1brm.central.sun.com (newsunmail1brm.Central.Sun.COM [129.147.62.245])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7JJqm1k023854
	for <psarc-ext@sac.sfbay.sun.com>; Wed, 19 Aug 2009 12:52:48 -0700 (PDT)
Received: from nwk-avmta-2.sfbay.sun.com (nwk-avmta-2.SFBay.Sun.COM [129.145.155.6])
	by newsunmail1brm.central.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id n7JJqlO2026197
	for <@sunmail2sca.sfbay.sun.com:psarc-ext@sun.com>; Wed, 19 Aug 2009 13:52:48 -0600 (MDT)
Received: from pmxchannel-daemon.nwk-avmta-2.sfbay.sun.com by
 nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KON0060537ZH900@nwk-avmta-2.sfbay.sun.com> for psarc-ext@sun.com
 (ORCPT psarc-ext@sun.com); Wed, 19 Aug 2009 12:52:47 -0700 (PDT)
Received: from gmp-eb-inf-1.sun.com ([192.18.6.21])
 by nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KON006E937X5V20@nwk-avmta-2.sfbay.sun.com> for
 psarc-ext@sun.com (ORCPT psarc-ext@sun.com); Wed,
 19 Aug 2009 12:52:46 -0700 (PDT)
Received: from fe-emea-10.sun.com
 (gmp-eb-lb-1-fe1.eu.sun.com [192.18.6.7] (may be forged))
	by gmp-eb-inf-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7JJqjc1005840	for
 <psarc-ext@sun.com>; Wed, 19 Aug 2009 19:52:45 +0000 (GMT)
Received: from conversion-daemon.fe-emea-10.sun.com by fe-emea-10.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KON005003531C00@fe-emea-10.sun.com> for psarc-ext@sun.com
 (ORCPT psarc-ext@sun.com); Wed, 19 Aug 2009 20:52:29 +0100 (BST)
Received: from [10.0.1.57] ([unknown] [78.102.201.214])
 by fe-emea-10.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit
 (built Jul  2 2009)) with ESMTPSA id <0KON00FU937GRT50@fe-emea-10.sun.com> for
 psarc-ext@sun.com (ORCPT psarc-ext@sun.com); Wed,
 19 Aug 2009 20:52:29 +0100 (BST)
Date: Wed, 19 Aug 2009 21:52:28 +0200
From: Vladimir Kotal <Vladimir.Kotal@Sun.COM>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <4A8C33D6.1000806@Sun.COM>
Sender: Vladimir.Kotal@Sun.COM
To: Darren Reed <Darren.Reed@Sun.COM>
Cc: psarc-ext@Sun.COM
Message-id: <4A8C57FC.8050106@Sun.COM>
MIME-version: 1.0
Content-type: multipart/mixed; boundary="Boundary_(ID_94v4wsNMax1CflMXhzkYYQ)"
X-PMX-Version: 5.4.1.325704
References: <200908172233.n7HMXAaA009464@sac.sfbay.sun.com>
 <4A8B0ED7.30001@Sun.COM> <4A8C33D6.1000806@Sun.COM>
User-Agent: Thunderbird 2.0.0.21 (X11/20090623)
Content-Length: 4727
Status: RO
X-Status: $$$$
X-UID: 0000000028

This is a multi-part message in MIME format.

--Boundary_(ID_94v4wsNMax1CflMXhzkYYQ)
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT

Darren Reed wrote:
> Vladimir,
> 
> In discussion at PSARC this morning, there was a request for more
> documentation changes to the man page. People would like to see
> more cross references to other documentation for how to write
> daemons and their options on Solaris. This should include at least
> references to contracts, tasks and advanced privilege use.

Here's updated man page with new COMMENTS section giving high level 
overview of the options for daemon environment setup.

If there is a need for more specific references (to actual functions 
like priv_set(3C) and such) I can add them.


v.

--Boundary_(ID_94v4wsNMax1CflMXhzkYYQ)
Content-type: text/plain; name=daemon-3C.manpage.txt
Content-transfer-encoding: 7BIT
Content-disposition: inline; filename=daemon-3C.manpage.txt


Standard C Library Functions                              daemon(3C)



NAME
     daemon - basic daemonization function

SYNOPSIS
     #include <stdlib.h>

     int daemon(int nochdir, int noclose);


DESCRIPTION
     The daemon() function provides a way for applications to go into
     background.

     The function will ensure that the process calling this function:
       - runs in the background
       - detaches from the controlling terminal
       - forms a new process group
       - is not a session group leader

     The options to the function are treated as boolean variables and are
     evaluated using negative logic.

     If the nochdir option is other than zero the working directory will
     not be changed to the root directory ("/"), otherwise it will be.

     If the noclose option is other than zero the descriptors 0,1,2
     (normally corresponding to standard input, output and error output,
     depending on the application) will not be redirected to /dev/null,
     otherwise they will be.

COMMENTS
  Other options for setting up daemon environment
     The daemonized process might want to use the following:

       - contracts
       - tasks
       - privileges
       - umask setting

     Contracts are useful for providing fault separation, e.g.
     placing worker process groups started by the master listener process
     (the process calling daemon()) into a different contract(4) prevents
     them from being killed if the master process goes away.

     The daemon can be placed into a new task owned by a specific project(4)
     for better workload management.

     After going into background privileged daemons might want to permanently
     revoke some of the privileges(5) which they will not need anymore and
     drop some of the effective privileges until they are needed for
     specific action.

     Changing umask(2) is a good practice for daemons creating new
     files to ensure they are created with expected permissions. Since the file
     creation mask umask is inherited by child processes it is suitable to
     set it after calling daemon() and before forking child processes.

  Running daemon as a service
     If the process calling daemon() is running as a smf(5) service,
     it should call daemon() as late as possible in the process of initializing
     in order to ensure that the process returns on the brink of providing
     the service (e.g. waiting for requests) and to return as much
     information as possible about possible failures during initialization.

RETURN VALUES
     Upon successful completion, daemon() returns 0. Otherwise it returns -1
     in which case errno will be set to the values specified in fork(2) and
     setsid(2).

EXAMPLES

     The main() function of a network server could look like this:

     int background;	/* background flag */

     /* Load and verify the configuration. */

     /* Go into background. */
     if (background && daemon(0, 0) < 0)
             err(1, "daemon");

     /* Process requests here. */

ATTRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:

     ____________________________________________________________
    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
    |_____________________________|_____________________________|
    | Interface Stability         | Committed                   |
    |_____________________________|_____________________________|
    | MT-Level                    | Async-Signal-Safe           |
    |_____________________________|_____________________________|


SEE ALSO
     attributes(5), contract(4), fork(2), Intro(2), process(4),
     project(4), setsid(2), smf(5), umask(2)



--Boundary_(ID_94v4wsNMax1CflMXhzkYYQ)--

From gww@eng.sun.com Wed Aug 19 13:09:01 2009
Received: from sunmail5.uk.sun.com (sunmail5.UK.Sun.COM [129.156.85.165])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7JK91Oo024523
	for <psarc-ext@sac.sfbay.sun.com>; Wed, 19 Aug 2009 13:09:01 -0700 (PDT)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by sunmail5.uk.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2) with ESMTP id n7JK8wMu023326
	for <@sunmail2sca.sfbay.sun.com:psarc-ext@sun.com>; Wed, 19 Aug 2009 21:09:00 +0100 (BST)
Received: from pmxchannel-daemon.nwk-avmta-1.sfbay.Sun.COM by
 nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KON0070F3YZPD00@nwk-avmta-1.sfbay.Sun.COM> for psarc-ext@sun.com
 (ORCPT psarc-ext@sun.com); Wed, 19 Aug 2009 13:08:59 -0700 (PDT)
Received: from dm-eng-02.sfbay.sun.com ([129.146.11.32])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KON00IST3YXEK70@nwk-avmta-1.sfbay.Sun.COM> for
 psarc-ext@sun.com (ORCPT psarc-ext@sun.com); Wed,
 19 Aug 2009 13:08:57 -0700 (PDT)
Received: from marduk.eng.sun.com (marduk.SFBay.Sun.COM [129.146.108.224])
	by dm-eng-02.sfbay.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2)
 with ESMTP id n7JK8sW1020010; Wed, 19 Aug 2009 13:08:54 -0700 (PDT)
Received: from marduk.eng.sun.com (localhost [127.0.0.1])
	by marduk.eng.sun.com (8.13.6+Sun/8.12.11) with ESMTP id n7JK8lJV001198; Wed,
 19 Aug 2009 13:08:47 -0700 (PDT)
Received: (from gww@localhost)
	by marduk.eng.sun.com (8.13.6+Sun/8.12.11/Submit) id n7JK8lNJ001197; Wed,
 19 Aug 2009 13:08:47 -0700 (PDT)
Date: Wed, 19 Aug 2009 13:08:47 -0700 (PDT)
From: Gary Winiger <gww@eng.sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
To: Darren.Reed@sun.com, Vladimir.Kotal@sun.com
Cc: psarc-ext@sun.com
Message-id: <200908192008.n7JK8lNJ001197@marduk.eng.sun.com>
Content-transfer-encoding: 7BIT
X-Sun-Charset: US-ASCII
X-PMX-Version: 5.4.1.325704
Content-Length: 318
Status: RO
X-Status: $$$$
X-UID: 0000000029

> Here's updated man page with new COMMENTS section giving high level 
> overview of the options for daemon environment setup.
> 
> If there is a need for more specific references (to actual functions 
> like priv_set(3C) and such) I can add them.

	Probably not, but please add privileges(5) to the SEE ALSO.

Gary..

From Vladimir.Kotal@sun.com Wed Aug 19 13:25:45 2009
Received: from sunmail2sca.sfbay.sun.com (sunmail2sca.SFBay.Sun.COM [129.145.155.234])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7JKPjx1024985
	for <psarc-ext@sac.sfbay.sun.com>; Wed, 19 Aug 2009 13:25:45 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by sunmail2sca.sfbay.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id n7JKPisR004346
	for <@sunmail2sca.sfbay.sun.com:psarc-ext@sun.com>; Wed, 19 Aug 2009 13:25:45 -0700 (PDT)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KON00I0Z4QUCO00@brm-avmta-1.central.sun.com> for psarc-ext@sun.com
 (ORCPT psarc-ext@SUN.COM); Wed, 19 Aug 2009 14:25:42 -0600 (MDT)
Received: from gmp-eb-inf-1.sun.com ([192.18.6.21])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KON005CJ4QTJWA0@brm-avmta-1.central.sun.com> for
 psarc-ext@sun.com (ORCPT psarc-ext@SUN.COM); Wed,
 19 Aug 2009 14:25:42 -0600 (MDT)
Received: from fe-emea-09.sun.com
 (gmp-eb-lb-1-fe1.eu.sun.com [192.18.6.7] (may be forged))
	by gmp-eb-inf-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7JKPeYS008712	for
 <psarc-ext@SUN.COM>; Wed, 19 Aug 2009 20:25:41 +0000 (GMT)
Received: from conversion-daemon.fe-emea-09.sun.com by fe-emea-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KON00D004J0Z300@fe-emea-09.sun.com> for psarc-ext@SUN.COM
 (ORCPT psarc-ext@SUN.COM); Wed, 19 Aug 2009 21:25:35 +0100 (BST)
Received: from [10.0.1.57] ([unknown] [78.102.201.214])
 by fe-emea-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit
 (built Jul  2 2009)) with ESMTPSA id <0KON00MJE4QGUYA0@fe-emea-09.sun.com>;
 Wed, 19 Aug 2009 21:25:28 +0100 (BST)
Date: Wed, 19 Aug 2009 22:25:27 +0200
From: Vladimir Kotal <Vladimir.Kotal@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <200908192008.n7JK8lNJ001197@marduk.eng.sun.com>
Sender: Vladimir.Kotal@sun.com
To: Gary Winiger <gww@eng.sun.com>
Cc: Darren.Reed@sun.com, psarc-ext@sun.com
Message-id: <4A8C5FB7.5050906@Sun.COM>
MIME-version: 1.0
Content-type: multipart/mixed; boundary="Boundary_(ID_CSZhwl37gZZQ3MvjNYISPA)"
X-PMX-Version: 5.4.1.325704
References: <200908192008.n7JK8lNJ001197@marduk.eng.sun.com>
User-Agent: Thunderbird 2.0.0.21 (X11/20090623)
Content-Length: 4493
Status: RO
X-Status: $$$$
X-UID: 0000000030

This is a multi-part message in MIME format.

--Boundary_(ID_CSZhwl37gZZQ3MvjNYISPA)
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT

Gary Winiger wrote:
>> Here's updated man page with new COMMENTS section giving high level 
>> overview of the options for daemon environment setup.
>>
>> If there is a need for more specific references (to actual functions 
>> like priv_set(3C) and such) I can add them.
> 
> 	Probably not, but please add privileges(5) to the SEE ALSO.

Here you go.


v.

--Boundary_(ID_CSZhwl37gZZQ3MvjNYISPA)
Content-type: text/plain; name=daemon-3C.manpage.txt
Content-transfer-encoding: 7BIT
Content-disposition: inline; filename=daemon-3C.manpage.txt


Standard C Library Functions                              daemon(3C)



NAME
     daemon - basic daemonization function

SYNOPSIS
     #include <stdlib.h>

     int daemon(int nochdir, int noclose);


DESCRIPTION
     The daemon() function provides a way for applications to go into
     background.

     The function will ensure that the process calling this function:
       - runs in the background
       - detaches from the controlling terminal
       - forms a new process group
       - is not a session group leader

     The options to the function are treated as boolean variables and are
     evaluated using negative logic.

     If the nochdir option is other than zero the working directory will
     not be changed to the root directory ("/"), otherwise it will be.

     If the noclose option is other than zero the descriptors 0,1,2
     (normally corresponding to standard input, output and error output,
     depending on the application) will not be redirected to /dev/null,
     otherwise they will be.

COMMENTS
  Other options for setting up daemon environment
     The daemonized process might want to use the following:

       - contracts
       - tasks
       - privileges
       - umask setting

     Contracts are useful for providing fault separation, e.g.
     placing worker process groups started by the master listener process
     (the process calling daemon()) into a different contract(4) prevents
     them from being killed if the master process goes away.

     The daemon can be placed into a new task owned by a specific project(4)
     for better workload management.

     After going into background privileged daemons might want to permanently
     revoke some of the privileges(5) which they will not need anymore and
     drop some of the effective privileges until they are needed for
     specific action.

     Changing umask(2) is a good practice for daemons creating new
     files to ensure they are created with expected permissions. Since the file
     creation mask umask is inherited by child processes it is suitable to
     set it after calling daemon() and before forking child processes.

  Running daemon as a service
     If the process calling daemon() is running as a smf(5) service,
     it should call daemon() as late as possible in the process of initializing
     in order to ensure that the process returns on the brink of providing
     the service (e.g. waiting for requests) and to return as much
     information as possible about possible failures during initialization.

RETURN VALUES
     Upon successful completion, daemon() returns 0. Otherwise it returns -1
     in which case errno will be set to the values specified in fork(2) and
     setsid(2).

EXAMPLES

     The main() function of a network server could look like this:

     int background;	/* background flag */

     /* Load and verify the configuration. */

     /* Go into background. */
     if (background && daemon(0, 0) < 0)
             err(1, "daemon");

     /* Process requests here. */

ATTRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:

     ____________________________________________________________
    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
    |_____________________________|_____________________________|
    | Interface Stability         | Committed                   |
    |_____________________________|_____________________________|
    | MT-Level                    | Async-Signal-Safe           |
    |_____________________________|_____________________________|


SEE ALSO
     attributes(5), contract(4), fork(2), Intro(2), privileges(5),
     process(4), project(4), setsid(2), smf(5), umask(2)



--Boundary_(ID_CSZhwl37gZZQ3MvjNYISPA)--

From Vladimir.Kotal@sun.com Wed Aug 19 14:39:31 2009
Received: from sunmail3mpk.sfbay.sun.com (sunmail3mpk.SFBay.Sun.COM [129.146.11.52])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7JLdUM3027735
	for <psarc-ext@sac.sfbay.sun.com>; Wed, 19 Aug 2009 14:39:31 -0700 (PDT)
Received: from nwk-avmta-1.SFBay.Sun.COM (nwk-avmta-1.SFBay.Sun.COM [129.146.11.74])
	by sunmail3mpk.sfbay.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id n7JLdU5o027005
	for <@sunmail2sca.sfbay.sun.com:psarc-ext@sun.com>; Wed, 19 Aug 2009 14:39:30 -0700 (PDT)
Received: from pmxchannel-daemon.nwk-avmta-1.sfbay.Sun.COM by
 nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KON00J0D85UKZ00@nwk-avmta-1.sfbay.Sun.COM> for psarc-ext@sun.com
 (ORCPT psarc-ext@sun.com); Wed, 19 Aug 2009 14:39:30 -0700 (PDT)
Received: from gmp-eb-inf-1.sun.com ([192.18.6.21])
 by nwk-avmta-1.sfbay.Sun.COM
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KON00IB585TDZE0@nwk-avmta-1.sfbay.Sun.COM> for
 psarc-ext@sun.com (ORCPT psarc-ext@sun.com); Wed,
 19 Aug 2009 14:39:30 -0700 (PDT)
Received: from fe-emea-09.sun.com
 (gmp-eb-lb-1-fe1.eu.sun.com [192.18.6.7] (may be forged))
	by gmp-eb-inf-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7JLdTfr015452	for
 <psarc-ext@sun.com>; Wed, 19 Aug 2009 21:39:29 +0000 (GMT)
Received: from conversion-daemon.fe-emea-09.sun.com by fe-emea-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KON007007S5YL00@fe-emea-09.sun.com> for psarc-ext@sun.com
 (ORCPT psarc-ext@sun.com); Wed, 19 Aug 2009 22:39:17 +0100 (BST)
Received: from [10.0.1.57] ([unknown] [78.102.201.214])
 by fe-emea-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit
 (built Jul  2 2009)) with ESMTPSA id <0KON009TQ85GYCB0@fe-emea-09.sun.com> for
 psarc-ext@sun.com (ORCPT psarc-ext@sun.com); Wed,
 19 Aug 2009 22:39:17 +0100 (BST)
Date: Wed, 19 Aug 2009 23:39:16 +0200
From: Vladimir Kotal <Vladimir.Kotal@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <4A8C5FB7.5050906@Sun.COM>
Sender: Vladimir.Kotal@sun.com
To: psarc-ext@sun.com
Cc: Darren.Reed@sun.com
Message-id: <4A8C7104.7@Sun.COM>
MIME-version: 1.0
Content-type: multipart/mixed; boundary="Boundary_(ID_zVWGB1cDdXFBb9uES2kFdg)"
X-PMX-Version: 5.4.1.325704
References: <200908192008.n7JK8lNJ001197@marduk.eng.sun.com>
 <4A8C5FB7.5050906@Sun.COM>
User-Agent: Thunderbird 2.0.0.21 (X11/20090623)
Content-Length: 4895
Status: RO
X-Status: $$$$
X-UID: 0000000031

This is a multi-part message in MIME format.

--Boundary_(ID_zVWGB1cDdXFBb9uES2kFdg)
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT

Vladimir Kotal wrote:
> Gary Winiger wrote:
>>> Here's updated man page with new COMMENTS section giving high level 
>>> overview of the options for daemon environment setup.
>>>
>>> If there is a need for more specific references (to actual functions 
>>> like priv_set(3C) and such) I can add them.
>>
>>     Probably not, but please add privileges(5) to the SEE ALSO.
> 
> Here you go.

And here's one more update, this time with changes to satisfy Nico's 
off-line comments. Darren, could you update the materials, please ?


v.

--Boundary_(ID_zVWGB1cDdXFBb9uES2kFdg)
Content-type: text/plain; name=daemon-3C.manpage.txt
Content-transfer-encoding: 7BIT
Content-disposition: inline; filename=daemon-3C.manpage.txt


Standard C Library Functions                              daemon(3C)



NAME
     daemon - basic daemonization function

SYNOPSIS
     #include <stdlib.h>

     int daemon(int nochdir, int noclose);


DESCRIPTION
     The daemon() function provides a way for applications to go into
     background.

     The function will ensure that the process calling this function:
       - runs in the background
       - detaches from the controlling terminal
       - forms a new process group
       - is not a session group leader

     The options to the function are treated as boolean variables and are
     evaluated using negative logic.

     If the nochdir option is other than zero the working directory will
     not be changed to the root directory ("/"), otherwise it will be.

     If the noclose option is other than zero the descriptors 0,1,2
     (normally corresponding to standard input, output and error output,
     depending on the application) will not be redirected to /dev/null,
     otherwise they will be.

COMMENTS
  Running daemon as a service
     If the process calling daemon() is running as a smf(5) service,
     it should call daemon() as late as possible in the process of initializing
     in order to ensure that the process returns on the brink of providing
     the service (e.g. waiting for requests) and to return as much
     information as possible about eventual failures during initialization.

  Other options for setting up daemon environment
     The daemonized process might want to use the following:

       - contracts
       - tasks
       - privileges
       - umask setting

     If running under smf(5), process contracts, tasks and credential context
     are accounted for by smf(5) so this sort of daemon generally does not
     need to explicitly set them (unless being e.g. login application).

     Contracts are useful for providing fault separation, e.g.
     placing worker process groups started by the master listener process
     (the process calling daemon()) into a different contract(4) prevents
     them from being killed if the master process goes away.

     The daemon can be placed into a new task owned by a specific project(4)
     for better workload management.

     After going into background privileged daemons might want to permanently
     revoke some of the privileges(5) which they will not need anymore and
     drop some of the effective privileges until they are needed for
     specific action.

     Changing umask(2) is a good practice for daemons creating new
     files to ensure they are created with expected permissions. Since the file
     creation mask umask is inherited by child processes it is suitable to
     set it after calling daemon() and before forking child processes.

RETURN VALUES
     Upon successful completion, daemon() returns 0. Otherwise it returns -1
     in which case errno will be set to the values specified in fork(2) and
     setsid(2).

EXAMPLES

     The main() function of a network server could look like this:

     int background;	/* background flag */

     /* Load and verify the configuration. */

     /* Go into background. */
     if (background && daemon(0, 0) < 0)
             err(1, "daemon");

     /* Process requests here. */

ATTRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:

     ____________________________________________________________
    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
    |_____________________________|_____________________________|
    | Interface Stability         | Committed                   |
    |_____________________________|_____________________________|
    | MT-Level                    | Async-Signal-Safe           |
    |_____________________________|_____________________________|


SEE ALSO
     attributes(5), contract(4), fork(2), Intro(2), privileges(5),
     process(4), project(4), setsid(2), smf(5), umask(2)



--Boundary_(ID_zVWGB1cDdXFBb9uES2kFdg)--

From Darren.Reed@sun.com Wed Aug 19 14:54:18 2009
Received: from sunmail5.uk.sun.com (sunmail5.UK.Sun.COM [129.156.85.165])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n7JLsHMj028957
	for <psarc-ext@sac.sfbay.sun.com>; Wed, 19 Aug 2009 14:54:17 -0700 (PDT)
Received: from nwk-avmta-2.sfbay.sun.com (nwk-avmta-2.SFBay.Sun.COM [129.145.155.6])
	by sunmail5.uk.sun.com (8.13.8+Sun/8.13.8/ENSMAIL,v2.2) with ESMTP id n7JLsFMp028470
	for <@sunmail2sca.sfbay.sun.com:psarc-ext@sun.com>; Wed, 19 Aug 2009 22:54:16 +0100 (BST)
Received: from pmxchannel-daemon.nwk-avmta-2.sfbay.sun.com by
 nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KON00E0D8UFJ900@nwk-avmta-2.sfbay.sun.com> for psarc-ext@sun.com
 (ORCPT psarc-ext@sun.com); Wed, 19 Aug 2009 14:54:15 -0700 (PDT)
Received: from gmp-eb-inf-2.sun.com ([192.18.6.24])
 by nwk-avmta-2.sfbay.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KON007GE8UEYXC0@nwk-avmta-2.sfbay.sun.com> for
 psarc-ext@sun.com (ORCPT psarc-ext@sun.com); Wed,
 19 Aug 2009 14:54:14 -0700 (PDT)
Received: from fe-emea-09.sun.com
 (gmp-eb-lb-1-fe1.eu.sun.com [192.18.6.7] (may be forged))
	by gmp-eb-inf-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n7JLsDDV006316	for
 <psarc-ext@sun.com>; Wed, 19 Aug 2009 21:54:13 +0000 (GMT)
Received: from conversion-daemon.fe-emea-09.sun.com by fe-emea-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KON00H008RNWR00@fe-emea-09.sun.com> for psarc-ext@sun.com
 (ORCPT psarc-ext@sun.com); Wed, 19 Aug 2009 22:53:51 +0100 (BST)
Received: from [129.146.106.55] ([unknown] [129.146.106.55])
 by fe-emea-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 with ESMTPSA id <0KON007288TQY830@fe-emea-09.sun.com> for psarc-ext@sun.com
 (ORCPT psarc-ext@sun.com); Wed, 19 Aug 2009 22:53:51 +0100 (BST)
Date: Wed, 19 Aug 2009 14:53:52 -0700
From: Darren Reed <Darren.Reed@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <4A8C7104.7@Sun.COM>
Sender: Darren.Reed@sun.com
To: Vladimir Kotal <Vladimir.Kotal@sun.com>
Cc: psarc-ext@sun.com
Message-id: <4A8C7470.2080004@Sun.COM>
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200908192008.n7JK8lNJ001197@marduk.eng.sun.com>
 <4A8C5FB7.5050906@Sun.COM> <4A8C7104.7@Sun.COM>
User-Agent: Thunderbird 2.0.0.21 (X11/20090608)
Content-Length: 612
Status: RO
X-Status: $$$$
X-UID: 0000000032

On 19/08/09 02:39 PM, Vladimir Kotal wrote:
> Vladimir Kotal wrote:
>> Gary Winiger wrote:
>>>> Here's updated man page with new COMMENTS section giving high level 
>>>> overview of the options for daemon environment setup.
>>>>
>>>> If there is a need for more specific references (to actual 
>>>> functions like priv_set(3C) and such) I can add them.
>>>
>>>     Probably not, but please add privileges(5) to the SEE ALSO.
>>
>> Here you go.
>
> And here's one more update, this time with changes to satisfy Nico's 
> off-line comments. Darren, could you update the materials, please ?

I'll do that.

Darren


From Darren.Reed@sun.com Wed Sep  9 11:16:12 2009
Received: from newsunmail1brm.central.sun.com (newsunmail1brm.Central.Sun.COM [129.147.62.245])
	by sac.sfbay.sun.com (8.13.8+Sun/8.13.8) with ESMTP id n89IGCXO012049
	for <psarc-ext@sac.sfbay.sun.com>; Wed, 9 Sep 2009 11:16:12 -0700 (PDT)
Received: from brm-avmta-1.central.sun.com (brm-avmta-1.Central.Sun.COM [129.147.4.11])
	by newsunmail1brm.central.sun.com (8.13.7+Sun/8.13.7/ENSMAIL,v2.2) with ESMTP id n89IG9CS024466
	for <@sunmail2sca.sfbay.sun.com:psarc-ext@sun.com>; Wed, 9 Sep 2009 12:16:12 -0600 (MDT)
Received: from pmxchannel-daemon.brm-avmta-1.central.sun.com by
 brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 id <0KPP0032BUQZE300@brm-avmta-1.central.sun.com> for psarc-ext@sun.com
 (ORCPT psarc-ext@sun.com); Wed, 09 Sep 2009 12:16:11 -0600 (MDT)
Received: from gmp-eb-inf-2.sun.com ([192.18.6.24])
 by brm-avmta-1.central.sun.com
 (Sun Java System Messaging Server 6.2-3.04 (built Jul 15 2005))
 with ESMTP id <0KPP001XNUQXKE10@brm-avmta-1.central.sun.com> for
 psarc-ext@sun.com (ORCPT psarc-ext@sun.com); Wed,
 09 Sep 2009 12:16:09 -0600 (MDT)
Received: from fe-emea-09.sun.com
 (gmp-eb-lb-1-fe1.eu.sun.com [192.18.6.7] (may be forged))
	by gmp-eb-inf-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id n89IG8bD020565	for
 <psarc-ext@sun.com>; Wed, 09 Sep 2009 18:16:09 +0000 (GMT)
Received: from conversion-daemon.fe-emea-09.sun.com by fe-emea-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 id <0KPP00M00UOQ1N00@fe-emea-09.sun.com> for psarc-ext@sun.com
 (ORCPT psarc-ext@sun.com); Wed, 09 Sep 2009 19:16:06 +0100 (BST)
Received: from [129.146.106.55] ([unknown] [129.146.106.55])
 by fe-emea-09.sun.com
 (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul  2 2009))
 with ESMTPSA id <0KPP00G7EUQS6410@fe-emea-09.sun.com> for psarc-ext@sun.com
 (ORCPT psarc-ext@sun.com); Wed, 09 Sep 2009 19:16:06 +0100 (BST)
Date: Wed, 09 Sep 2009 11:16:58 -0700
From: Darren Reed <Darren.Reed@sun.com>
Subject: Re: daemon() in libc [PSARC/2009/444 FastTrack timeout 08/24/2009]
In-reply-to: <4A8C7104.7@Sun.COM>
Sender: Darren.Reed@sun.com
To: Vladimir Kotal <Vladimir.Kotal@sun.com>
Cc: PSARC-ext@sun.com
Message-id: <4AA7F11A.60809@Sun.COM>
MIME-version: 1.0
Content-type: text/plain; CHARSET=US-ASCII; format=flowed
Content-transfer-encoding: 7BIT
X-PMX-Version: 5.4.1.325704
References: <200908192008.n7JK8lNJ001197@marduk.eng.sun.com>
 <4A8C5FB7.5050906@Sun.COM> <4A8C7104.7@Sun.COM>
User-Agent: Thunderbird 2.0.0.21 (X11/20090608)
Status: RO
Content-Length: 72

This case was approved at PSARC on the 2nd of September, 2009.

Darren


