The Daemon project needs to be created with the following elements:
- A proper .gitignore file.
- A README file with the name of the project and a basic description written in markdown.
- Have correct Cargo compilation
- Run as an executable
To properly create create a Daemon it needs to accomplish the following tasks.
- Fork the process and exit.
- Create a new session with a new process group and become the session leader and process group leader.
- Fork the process and exit again to no longer be the session leader and a TTY cannot accidentally be take control of it.
- Change the working directory of the program to the "/" directory, so it can not be unmounted.
- Adjust the umask settings to not depend on the callers settings.
- Close any inherited files if there are any like stdin, stdout, stderr.