On Wed, 27 May 1998, Glynn Clements wrote:

> > > I would like to develop daemon applications for part of my final project. 
> > > So that I need to have any source code relate to daemon programming. 
> > > Could anybody let me know how to find the source code ? 
> 
> > (5) umask(0) so that we have complete control over the permissions of anything
> >    we write. We don't know what umask we may have inherited.
> 
> Hmm. That's debatable. It may be desirable to just use whatever umask
> has been set, rather than having to provide a separate configuration
> option for it.

As I mentioned, this was stolen from the old c.u.p faq I have . So it
isn't my advice. Maybe this would be a good thing to do if you're writing
a daemon that regular lusers will start.

> > (7) Create a new stdout, an example might be: open("/dev/console",O_RDWR).
> > (8) dup2() twice to duplicate the fd for standard out for standard in and
> >    standard error.
> Again, that's debatable.

Yes it is, but redirecting the output somewhere else is a good idea, imho.

> > NOTE:  If you're started from inetd some of this is a little different, you
> >    don't have to do the first fork, and fds 0, 1, and 2 are set up to be
> >    the connected socket.  That means you should probably skip steps 6, 7
> >    and 8.
> 
> If the program is being started from inetd, you shouldn't need to do
> any of this.

Maybe the author wanted to say that but didn't succeed. 

My version of the c.u.p. faq is about 2yrs old, I better get a later one.

* [EMAIL PROTECTED] - Power to the penguin!

Reply via email to