Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Daemon Example in C (lloydrochester.com)
22 points by smartmic 1 day ago | hide | past | favorite | 4 comments




> 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.


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.

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

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



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: