Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
xt_daemonize(3) 	    Library Functions Manual		 xt_daemonize(3)

NAME
     xt_daemonize() - Detach process from terminal

LIBRARY
     #include <xtend/proc.h>
     -lxtend

SYNOPSIS
     int     xt_daemonize(int nochdir, int noclose)

ARGUMENTS
     nochdir:	 If true (non-zero), do not chdir("/")
     noclose:	 If true, do not redirect standard descriptors to /dev/null

DESCRIPTION
     Daemonize	a process, using the double-fork() method to ensure that it can-
     not 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 af-
     fected by signals from the keyboard.

     daemon(3) is deprecated on macOS as of this writing.

RETURN VALUES
     0 on success, -1 on failure

EXAMPLES
     xt_daemonize(0, 0);

SEE ALSO
     daemon(3), fork(2), setsid(2)

								 xt_daemonize(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=xt_daemonize&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help