[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What is needed to run a tool like a daemon?
From: |
Richard Frith-Macdonald |
Subject: |
Re: What is needed to run a tool like a daemon? |
Date: |
Thu, 3 Dec 2009 07:55:17 +0000 |
On 3 Dec 2009, at 07:34, Saso Kiselkov wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> And what's stopping you from simply forking into the background? Like
> with the following:
>
> if (daemon (0, 0) == -1)
> {
> NSLog (@"Error daemonizing: %s", strerror (errno));
> exit (EXIT_FAILURE);
> }
I don't think that addresses the issue of registering a name.
Perhaps more importantly though, the code above has the problem of 'daemon()'
being severely unportable.
In GNUstep you should use NSTask to portably create a subprocess.
The gdnc tool (base/Tools/gdnc.m) provides an example of a process which makes
itsself be a daemon in a portable manner.