Update to My 'daemonize' Library
I have updated my tiny C library for writing Unix daemons.
In fact, the library's code itself remained intact. When the original version was released, I made a somewhat sinful thing: although the library's code was written with portability in mind, the only example which came with it was Linux specific because of usage of signalfd(2)
to redirect signal handling to the main event processing loop. This issue has been addressed recently: now, additionally to the original Linux specific example there is one which should be portable to the other Unix-like systems. It utilises the somewhat lesser-known self-pipe trick to redirect signal processing to the loop 1.
I advise you to use the new example as a template for your daemons, even though there is slightly more code involved in doing the same thing. Even though we seem to live in the world of Linux monoculture, losing portability to other Unixes would be a sad thing.
Categories: Update Programming