2 ms·
For daemonization, daemon(3) is better (EDIT: assuming you only care about Linux). (It also chdirs to /, closes STD*, and detaches from the terminal.)
by colanderman 12y ago
For daemonization, daemon(3) is better (EDIT: assuming you only care about Linux). (It also chdirs to /, closes STD*, and detaches from the terminal.)
- cperciva 12y agoAlas, daemon(3) is not POSIX.
- mindajar 12y agodaemon(3) isn't part of POSIX, and the OS X man page says "the use of this API is discouraged in favor of using launchd(8)", so who knows what might happen here in the future. If you don't care about portability, it's an easier call to make.