Re: creating demon programs

From: Baard Ove Kopperud (baard.kopperud_at_bigfoot.com)
Date: 05/14/04

  • Next message: Vineet Joglekar: "Re: How to allocate few bytes to a file automatically after creating it?"
    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


  • Next message: Vineet Joglekar: "Re: How to allocate few bytes to a file automatically after creating it?"

    Relevant Pages

    • Re: creating demon programs
      ... you might consult with the devil. ... oh, wait, you meant "daemon", not DEMON:)) ... When all other means of communication fail, ...
      (comp.os.linux.questions)
    • Maxwells Daemon exists (?), Godels Theorem disproven (?)
      ... Maxwell's Daemon exists and Godel's Theorem disproven? ... The second law is also expressed as the assertion that in an isolated system, entropy never ... Could such a demon, as he describes it, actually violate the second law? ... it would take more effort to gauge the speed of the molecules and allow them ...
      (sci.research.careers)
    • Re: Maxwells Daemon exists (?), Godels Theorem disproven (?)
      ... Maxwell's Daemon exists and Godel's Theorem disproven? ... The second law is also expressed as the assertion that in an isolated system, entropy never ... Could such a demon, as he describes it, actually violate the second law? ... it would take more effort to gauge the speed of the molecules and allow them ...
      (sci.research.careers)
    • Daemon, Devil... woops!
      ... And here I am, looking at the logo, and thinking it's a ... it's a daemon. ... It looks a little bit like a little devil. ... BSD: Binding Souls, One At A Time... ...
      (freebsd-questions)
    • Re: [PATCH][RFC] Simple tamper-proof device filesystem.
      ... If the process is in the chroot() but the daemon is not in the chroot, ... How can the daemon know whether the request is trying to manipulate nodes ... using UNIX domain socket and checks filename/attribute pair and issue ...
      (Linux-Kernel)