Daemon Example in C

(lloydrochester.com)

23 points | by smartmic 2 days ago ago

5 comments

  • Joker_vD a day ago ago

    > We’ll go into the SysV recommendation of “double forking”

    SysV init can not handle daemons that double-fork. Neither could BSDs up until somewhat recently. Just let your systems "service manager" deal with that on your own, seriously: don't reimplement this functionality; one program to do one thing, etc.

  • rurban 14 hours ago ago

    Nowadays I just use systemd. I can still write to stdout, and it repairs itself. No need for syslog.

    The tricky part are still signals.

  • nesarkvechnep a day ago ago

    These days I've been using the `daemon` utility in FreeBSD whenever I need to run some long running program as a daemon. This allows me to not even bother with flags, double forks and so on.

  • evanjrowley a day ago ago

    After taking Intro to C many years ago at university, it's lessons like this I wish they had followed up with.

  • smw a day ago ago

    RIP Richard Stevens! I owe most of my early career to APUE