Changeset 10316 in vbox for trunk/src/VBox/Additions/common
- Timestamp:
- Jul 7, 2008 12:54:31 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDaemonize.cpp
r10308 r10316 129 129 #else /* the unices */ 130 130 /* 131 * Fork the child process and quit the parent.131 * Fork the child process in a new session and quit the parent. 132 132 * 133 * This means:134 * - fork once and become session leader (using setsid(2)) in135 * order to detach from the controlling tty and make ourselves safe136 * from Ctrl-C. The fork is required because the call to setsid will137 * fail if we were already session leader.138 * - On Linux, fork again in order to become a non-leader member of the139 * session, as the leader will attach to any tty it opens, accidentally140 * or otherwise (Sys V sematics).141 * - The SIGHUP stuff is ignored because the parent may throw us one142 * 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. 143 143 */ 144 144 struct sigaction OldSigAct;
Note:
See TracChangeset
for help on using the changeset viewer.