This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / In daemon programming, why use setsid() to create a new session? if not, what will happen? besides, If one process in a process group without a process leader, what will happen?
-guest:rain;
2001-7-2
(#117396@0)
-
setsid will make this process the session leader, which means it doesn't have any associated control terminal.If you don't call setsid(), you might endup with some control terminal attached to your process, and the process will possibly receive some signals, the default action for most signals are to terminate the process! It's okay for a process group to go without a leader. For example, the process who has forked child processes has terminated, the child processes can still live.
-numnum(numnum);
2001-7-2
{379}
(#117408@0)
-
Thank you so so much!!
-guest:rain;
2001-7-2
(#117447@0)
-
numnum,you are the expert!! but I remember you too has a fork() in deamon programming, what is purpose of the fork()
-guest:rainrain;
2001-7-3
(#118457@0)