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

FreeBSD Manual Pages

  
 
  

home | help
OpenXPKI::Daemonize(3)User Contributed Perl DocumentatioOpenXPKI::Daemonize(3)

Name
       OpenXPKI::Daemonize - Helper functions to cleanly fork background
       processes

METHODS
   fork_child
       Tries to	fork a child process.

       Return value depends on who returns: parent will	get the	child PID and
       child will get 0.

       An exception will be thrown if the fork fails.

       Note on STDIN, STDOUT, STDERR

       All IO handles will be connected	to /dev/null with one exception: if
       "STDERR"	was already redirected to a file (and is not a terminal) then
       it is left untouched.  This is to make sure error messages still	go to
       the desired log files.

       Note on SIGCHLD

       For the parent process we set "$SIG{CHLD} = "IGNORE"" to	prevent	zombie
       child processes.

       But "IGNORE" can	lead to	problems with system calls e.g.	via
       Proc::SafeExec or system, see the Perl CookBook
       <https://docstore.mik.ua/orelly/perl/cookbook/ch16_20.htm> for details.

       Thus in the child process we set	"$SIG{CHLD} = "DEFAULT"" to prevent
       these problems.

       But in the parent process after forking you should manually set
       "$SIG{CHLD} = "DEFAULT""	if you want to do system calls.

perl v5.32.0			  2020-08-29		OpenXPKI::Daemonize(3)

Name | METHODS

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=OpenXPKI::Daemonize&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help