daemon.c
来自「穿越防火墙技术代码」· C语言 代码 · 共 42 行
C
42 行
/*port/daemon.cCopyright (C) 1999 Lars Brinkhoff. See COPYING for terms and conditions.*/#include "config.h"#ifndef HAVE_DAEMON#include <unistd_.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>intdaemon (int nochdir, int noclose){ if (fork () != 0) exit (0); if (!nochdir) chdir ("/"); close (0); close (1); close (2); if (noclose == 0) { open ("/dev/null", O_RDONLY); open ("/dev/null", O_WRONLY); open ("/dev/null", O_WRONLY); } /* FIXME: disassociate from controlling terminal. */ return 0;}#endif /* HAVE_DAEMON */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?