0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

APUEの中に書いてあるdaemonの書き方

Posted at

Daemon Coding Rules

  1. call umask to set file mode creation mask.
  2. fork and have parent process exit.
  • When invoked as shell command, letting parent exit make the shell think the command is finished
  • ensure that the child process is not a process group leader. This is a prerequisite for setsid
  1. call setsid
  • The child process will be the leader of the new process group
  • The child process will be the leader of the new process session
  • The child process will be detached from its controlling terminal
  1. chdir
  2. close files inherited from its parent
  3. redirect stdin, stdout, stderr to /dev/null
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?