[AWS] *NIX daemons using AWS

Peter Fedorow fedorowp at gmail.com
Sat Jul 23 09:57:54 CEST 2005


On 7/23/05, Pascal Obry <pascal at obry.net> wrote:
>  > How should a process written in Ada fork?
> I'm not expert in UNIX demons but I really don't see why should a fork occurs.

I'm not a UNIX expert either.  As far as I understand, the reason for
forking is because the process is responsible for placing itself in
the background.


>  > > When a daemon starts up, it has to do some low-level housework to get
>  > > itself ready for its real job. This involves a few steps:
>  > >
>  > >     * Fork off the parent process
> 
> I would say not needed.
> 
>  > >     * Change file mode mask (umask)
> 
> Don't know about this one. This is probably possible by binding to the C
> umask() routine, another solution is to use a complete POSIX binding like
> florist.

Hmm, florist, I'll check it out. It probably even has fork.


>  > >     * Create a unique Session ID (SID)
> 
> What for ?

No idea, I'll try asking a UNIX expert about that.



>  > >     * Close standard file descriptors
> 
> What for ? If the process is launched in backgroud there is no valid
> stdin/stdout/stderr anyway. As there was not fork then there is no file
> descriptor inherited anyway.

That makes sense.  When forked though, I think the reason they are
closed is for security reasons.  I don't know the details of why doing
so aids security.


> I would just write my program in Ada, place it in a cron table or into one of
> the /etc/rc?.d/ directory, that's all.

I'm using Debian, and I think Debian expects processes to be self
daemonizing.  I'm not sure, so I'll also check into that too.


Thank you for your help.


More information about the AWS mailing list