use strict;
use warnings;
#use Proc::Daemon; # tried this also, with the same
# results as the snippet below
use threads; # Do I even need these since
use threads::shared; # Thread::Pool uses 'threads'?
use Thread::Pool;
use POSIX;
####
$SIG{CHLD} = sub { while ( POSIX::waitpid(-1,POSIX::WNOHANG) > 0 ) { } };
####
die "ERROR: unable to fork!! Dying." unless defined (my $child = fork);
exit 0 if $child;
POSIX::setsid();
open(STDIN, "/dev/null");
open(STDERR, ">&STDOUT");
chdir '/';
umask (0);
$ENV{PATH} = "/bin:/sbin:/usr/bin:/usr/sbin";
return $$;
####
1408 open("/usr/lib/perl/5.8.0/auto/Storable/_freeze.al", O_RDONLY|O_LARGEFILE) = 11
1408 fstat64(11, {st_mode=S_IFREG|0644, st_size=706, ...}) = 0
1408 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x402af000
1408 read(11, "# NOTE: Derived from ../../lib/S"..., 4096) = 706
1408 read(11, "", 4096) = 0
1408 close(11) = 0
1408 munmap(0x402af000, 4096) = 0
1408 brk(0x8ab5000) = 0x8ab5000
1408 brk(0x8abd000) = 0x8abd000
1408 kill(1405, SIGRTMIN) = -1 ESRCH (No such process)
1408 rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
1408 rt_sigsuspend([]