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 any additional threads running, daemonizing is refused and an error
- The new session id from the setsid() invocation is returned as an exact integer.
> (daemonize) (sleep 10) (exit)