How to make a program to run as a daemon
Quoted 3 lines · Bubulac Angela Tatiana
How can I make a program writen in C to run as a daemon?
Some systems supply a daemon function for running a process in the background.
#include <unistd.h>
int daemon (int nochdir, int noclose);
If the parameter nochdir is zero, the function changes the directory to "/", otherwise it stays in the current working directory.
The noclose parameter, if zero, directs stdin, stdout, and stderr to /dev/null.
When in doubt, search your man pages for this function.
--
Graydon Smith
"I never let my schooling interfere with my education."
- Mark Twain
Quoted 6 lines · Graydon Smith
Quoted 1 line
How can I make a program writen in C to run as a daemon?
Some systems supply a daemon function for running a process in the background.
#include <
unistd.h>
int daemon (int nochdir, int noclose);
Hmm. GNU libc 2.1 provides this function (declared in unistd.h), but doesn't document it in either a man page or the Info file.
For a portable solution, refer to chapter 13 of Stevens, or see the archives for this list (this is the third time this question has been asked in about a month).
Signature · 1 line
Glynn Clements <[email protected]>