int daemon(int nochdir, int noclose);

       #include <unistd.h>
       int daemon(int nochdir, int noclose);
   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

       daemon(): _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)

DESCRIPTION
       The  daemon()  function  is for programs wishing to detach themselves from the controlling terminal and run in
       the background as system daemons.

       If nochdir is zero, daemon() changes the calling process's current working directory  to  the  root  directory
       ("/"); otherwise, the current working directory is left unchanged.

       If noclose is zero, daemon() redirects standard input, standard output and standard error to /dev/null; other‐
       wise, no changes are made to these file descriptors.

RETURN VALUE
       (This function forks, and if the fork(2) succeeds, the parent calls _exit(2), so that further errors are  seen
       by the child only.)  On success daemon() returns zero.  If an error occurs, daemon() returns -1 and sets errno
       to any of the errors specified for the fork(2) and setsid(2).
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值