VirtualBox

Changeset 10316 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Jul 7, 2008 12:54:31 PM (17 years ago)
Author:
vboxsync
Message:

Clearified.

File:
1 edited

Legend:

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

    r10308 r10316  
    129129#else /* the unices */
    130130    /*
    131      * Fork the child process and quit the parent.
     131     * Fork the child process in a new session and quit the parent.
    132132     *
    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).
     133     * - fork once and create a new session (setsid). This will detach us
     134     *   from the controlling tty meaning that we won't receive the SIGHUP
     135     *   (or any other signal) sent to that session.
     136     * - The SIGHUP signal is ignored because the session/parent may throw
     137     *   us one before we get to the setsid.
     138     * - When the parent exit(0) we will become an orphan and re-parented to
     139     *   the init process.
     140     * - Because of the Linux / System V sematics of assigning the controlling
     141     *   tty automagically when a session leader first opens a tty, we will
     142     *   fork() once more on Linux to get rid of the session leadership role.
    143143     */
    144144    struct sigaction OldSigAct;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette