VirtualBox

Changeset 10308

Show
Ignore:
Timestamp:
07/07/08 13:24:50 (5 months ago)
Author:
vboxsync
Message:

Additions/common: update comments in VbglR3Daemonize

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDaemonize.cpp

    r8155 r10308  
    131131     * Fork the child process and quit the parent. 
    132132     * 
    133      * On Linux we'll fork once more at the end of it all just to be sure that 
    134      * we're not leaving any zombies behind. The SIGHUP stuff is ignored because 
    135      * the parent may throw us one before we get to the setsid stuff one some 
    136      * systems (BSD). 
     133     * This means: 
     134     * - fork once and become session leader (using setsid(2)) in 
     135     * order to detach from the controlling tty and make ourselves safe 
     136     * from Ctrl-C.  The fork is required because the call to setsid will 
     137     * fail if we were already session leader. 
     138     * - On Linux, fork again in order to become a non-leader member of the 
     139     * session, as the leader will attach to any tty it opens, accidentally 
     140     * or otherwise (Sys V sematics). 
     141     * - The SIGHUP stuff is ignored because the parent may throw us one 
     142     * before we get to the setsid stuff one some systems (BSD). 
    137143     */ 
    138144    struct sigaction OldSigAct; 
     
    191197# ifdef RT_OS_LINUX 
    192198    /* 
    193      * And fork again to avoid zomibies and stuff (non-standard daemon() behaviour). 
     199     * And fork again to lose session leader status (non-standard daemon() 
     200     * behaviour). 
    194201     */ 
    195202    pid = fork(); 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy