Expand description
Unix double-fork into background for daemon process isolation.
The double-fork pattern detaches the daemon from the calling terminal:
- First fork: parent exits (shell regains control).
- setsid(): grandchild becomes session leader (no controlling TTY).
- Second fork: ensure the daemon can never reacquire a TTY.
- Redirect stdin/stdout/stderr to the daemon log file.
Functions§
- double_
fork_ into_ background - Double-fork into background and redirect stdio to
log_path.