[AWS] *NIX daemons using AWS
Pascal Obry
pascal at obry.net
Sat Jul 23 09:03:55 CEST 2005
Peter,
> 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.
> > ---
> > 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.
> > * Open any logs for writing
This is easily done using Text_IO.
> > * Create a unique Session ID (SID)
What for ?
> > * Change the current working directory to a safe place
Using GNAT.OS_Lib.
> > * 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.
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.
Again, I'm no expert here so...
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
More information about the AWS
mailing list