[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 08:23:43 +0000 |
On 3 Dec 2009, at 08:04, Saso Kiselkov wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Sure it's unportable, which is why I always include a custom
> implementation of daemon() with my code which works on most *nixes :-).
Using NSTask works on ms-windows as well. Of course, you can implement your
own daemon using NSTask.
> After reading the message though I realize I misunderstood it.
>
> What's most likely screwing up is that the process doesn't de-register
> from the name server. Maybe a simple atexit() or signal() handler would
> do the trick.
That shouldn't really matter ... the nameserver code is designed to handle the
case where something kills a process and prevents it from deregistering its
name.
> German: you do try this as a test whether the name is being unregistered:
Unfortunately testing that is not useful ... what needs to be determined is why
the name can't be registered.
Normally the directory to look at is /tmp/GNUstepXXX/NSMessagePort where XXX is
your user ID
There is a subdirectory 'names' containing files for registered names ... the
name of each file is a base64 encoded port name. The content of each file is
the port identifier.
There is a subdirectory 'ports' containing named pipes for each port. The port
names are of the port pid.sequence where pid is a process id and sequence is a
sequence number for when a process uses multiple ports.
For registration to fail, the name file must point to a port file which has a
process listening on it (ie the port must still be in use).