* Re:How to make a program to run as a daemon
@ 2002-07-04 12:10 Graydon Smith
2002-07-04 12:48 ` Glynn Clements
0 siblings, 1 reply; 2+ messages in thread
From: Graydon Smith @ 2002-07-04 12:10 UTC (permalink / raw)
To: linux-c-programming
Bubulac Angela Tatiana wrote:
>
>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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Re:How to make a program to run as a daemon
2002-07-04 12:10 Re:How to make a program to run as a daemon Graydon Smith
@ 2002-07-04 12:48 ` Glynn Clements
0 siblings, 0 replies; 2+ messages in thread
From: Glynn Clements @ 2002-07-04 12:48 UTC (permalink / raw)
To: linux-c-programming
Graydon Smith wrote:
> > 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).
--
Glynn Clements <glynn.clements@virgin.net>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-07-04 12:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-04 12:10 Re:How to make a program to run as a daemon Graydon Smith
2002-07-04 12:48 ` Glynn Clements
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).