daemon(3) Library Functions Manual daemon(3) daemon - LIBRARY Standard C library (libc, -lc) #include int daemon(int nochdir, int noclose); glibc (. feature_test_macros(7)): daemon(): glibc 2.21: _DEFAULT_SOURCE glibc 2.19 2.20: _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500) glibc 2.19, : _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500) daemon() , , . nochdir , daemon() (<>); . If noclose is zero, daemon() redirects standard input, standard output, and standard error to /dev/null; otherwise, no changes are made to these file descriptors. , fork(2) , _exit(2), . daemon() . , daemon() -1 errno , fork(2) setsid(2). attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |daemon() | | MT-Safe | +----------------------------+----------------------------------------------------------+--------------------------+ A similar function appears on the BSDs. glibc -1 , /dev/null , . errno. None. 4.4BSD. GNU C BSD, fork (. ., fork(2), setsid(2), fork(2)), , . . , System V (, Linux), , , , . fork(2), setsid(2), daemon(7), logrotate(8) Yuri Kozlov ; GNU (GNU General Public License - GPL, 3 ) , - . - , , <>. Linux man-pages 6.8 2 2024 . daemon(3)