Re: creating demon programs
From: Baard Ove Kopperud (baard.kopperud_at_bigfoot.com)
Date: 05/14/04
- Previous message: Suresh: "Moving multi threaded application to multi processing"
- In reply to: mjt: "Re: creating demon programs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 14 May 2004 04:39:59 -0700
mjt <mjtobler@removethis_mail.ru> wrote in message news:<FcToc.19045$V97.6601@newsread1.news.pas.earthlink.net>...
> R wrote:
>
> > Can i ask for a simple C code creating a demon?
>
> ... you might consult with the devil.
>
> oh, wait, you meant "daemon", not DEMON :))
If I remember correctly:
Disk
And
Execution
MONitor
Because they were originally mostly doing things
like flushing disk-buffers...
In any case, to write daemons, here is a few tips:
*Make sure it's working-directory is somewhere
_publical wriatble_ -- like one of the tmp-directories
(/var/tmp)... this way, it will be able to dump
it's core or write other debugging information.
Especially important if it's not running as
root (which it probably shouldn't be).
*Disconecting it from all TTY's and making it imune
to signals eminating from the terminal it was
started (FORKing and EXECing mostly).
*When a request is made, you usually want the daemon
to FORK itself and let the child handle the request,
while the parent listens for new request.
I've never written a daemon, but this is what I remember
about the subject from a book I read several years ago...
-Koppe
- Previous message: Suresh: "Moving multi threaded application to multi processing"
- In reply to: mjt: "Re: creating demon programs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|