![]() |
![]()
| ![]() |
![]()
NAMExt_daemonize() - Detach process from terminal LIBRARY#include <xtend/proc.h> -lxtend SYNOPSISint xt_daemonize(int nochdir, int noclose) ARGUMENTSnochdir: If true (non-zero), do not chdir("/") noclose: If true, do not redirect standard descriptors to /dev/null DESCRIPTIONDaemonize a process, using the double-fork() method to ensure that it cannot attach to a controlling tty (terminal). The interface is identical to the BSD daemon(3) function, but daemon(3) only performs a single fork, so there is a risk that the resulting process could attach to a termimal. The double-fork() entails additional overhead compared to daemon(3), but ensures that the process cannot aquire a controlling terminal and be affected by signals from the keyboard. daemon(3) is deprecated on macOS as of this writing. RETURN VALUES0 on success, -1 on failure EXAMPLESxt_daemonize(0, 0); SEE ALSOdaemon(3), fork(2), setsid(2)
|