Run a process in the background
#include <stdlib.h> int daemon( int nochdir, int noclose );
- If this argument is 0, the current working directory is changed to the root directory (/).
- If this argument is 0, standard input, standard output, and standard error are redirected to /dev/null.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The daemon() function allows programs to detach themselves from the controlling terminal and run in the background as system daemons.
Zero for success, or -1 if an error occurs (errno is set).
Currently, daemon() is supported only in single-threaded applications. If you create a thread and then call daemon(), the function returns -1 and sets errno to ENOSYS.
Last modified: 2013-09-30