📄 program-deamon.html
字号:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Author" content="Edward Fu">
<meta name="GENERATOR" content="Mozilla/4.05 [zh-CN] (X11; I; Linux 2.1.127 i686) [Netscape]">
<title>Freesoft Linux FAQ -- 如何写一个Deamon程序</title>
</head>
<body>
如何写一个deamon程序?
<br>
<br>发信站: BBS 水木清华站 (Fri Nov 27 01:22:52 1998)
<br>【 在 gjx (小侃帝) 的大作中提到: 】
<br>: as titile who can tell me !
<br>: thansks
<br>
<br>1> ignore the signals, SIGINT, SIGQUIT, SIGTRAP, SIGIOT, SIGTERM, etc
<br> signal(xxx,SIGIGN);
<br>2> close all the file descriptors
<br> for (i=32,i>=3,i--)
<br>
close(i);
<br>3> fork (maybe twice)
<br>4> chdir("/")
<br>5> umask(0)
<br>6> call setpgrp() to become the head of the new process group
<br>
<br>Some steps can be omitted.
<br>You can make it. Good luck!
<br>
<br>--
<br>注:另外在《Linux从入门到精通》书中也有讲解。
<br>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -