Function nix::unistd::daemon  
pub fn daemon(nochdir: bool, noclose: bool) -> Result<()>The portability is definied by: 
#[cfg(any(target_os = "android", target_os = "dragonfly", target_os =
"freebsd", target_os = "illumos", target_os = "linux", target_os = "netbsd",
target_os = "openbsd", target_os = "solaris"))]Documentation
Daemonize this process by detaching from the controlling terminal (see daemon(3)).
When a process is launched it is typically associated with a parent and it, in turn, by its controlling terminal/process. In order for a process to run in the “background” it must daemonize itself by detaching itself. Under posix, this is done by doing the following:
- Parent process (this one) forks
- Parent process exits
- Child process continues to run.
nochdir:
- nochdir = true: The current working directory after daemonizing will be the current working directory.
- nochdir = false: The current working directory after daemonizing will be the root direcory,- /.
noclose:
- noclose = true: The process’ current stdin, stdout, and stderr file descriptors will remain identical after daemonizing.
- noclose = false: The process’ stdin, stdout, and stderr will point to- /dev/nullafter daemonizing.