This procedure performs the following actions in order to run as a daemon:
- Detach from the controlling terminal
- Redirecting standard input, standard output and standard error to /dev/null
- Changing the current working directory to the root directory (/)
If there are already any additional threads running, daemonizing is refused
and an error is signalled.
- The new session id from the setsid() invocation is returned as an exact integer.
> (daemonize) (sleep 10) (exit)