linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Graydon Smith <smithg@cogeco.ca>
To: linux-c-programming@vger.kernel.org
Subject: Re:How to make a program to run as a daemon
Date: Thu, 04 Jul 2002 08:10:05 -0400	[thread overview]
Message-ID: <3D243B1D.650C7E3B@cogeco.ca> (raw)

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



             reply	other threads:[~2002-07-04 12:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-04 12:10 Graydon Smith [this message]
2002-07-04 12:48 ` Re:How to make a program to run as a daemon Glynn Clements

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D243B1D.650C7E3B@cogeco.ca \
    --to=smithg@cogeco.ca \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).