tail head cat sleep
QR code linking to this page

manページ  — DAEMON

名称

daemon – バックグラウンドで実行する

内容

ライブラリ

Standard C Library (libc, -lc)

書式

#include <stdlib.h>

int
daemon(int nochdir, int noclose);

解説

daemon() 関数は、制御端末から自分自身を切り離し、システムデーモンとして 動作することを望むプログラムのためのものです。

引数 nochdir が 0 の場合、 daemon() は現在の作業ディレクトリをルート (``/'') に変更します。

引数 noclose が 0 の場合、 daemon() は、標準入力、標準出力、および標準エラー出力を ``/dev/null'' に リダイレクトします。

エラー

エラーが発生すると、 daemon() は -1 を返し、ライブラリ関数 fork(2)setsid(2) 規定されているエラーをグローバル変数 errno に設定します。

関連項目

fork(2), setsid(2)

歴史

daemon() 関数は BSD 4.4 ではじめて登場しました。

DAEMON (3) June 9, 1993

tail head cat sleep
QR code linking to this page


このマニュアルページサービスについてのご意見は Ben Bullock にお知らせください。 Privacy policy.

"I liken starting one's computing career with Unix, say as an undergraduate, to being born in East Africa. It is intolerably hot, your body is covered with lice and flies, you are malnourished and you suffer from numerous curable diseases. But, as far as young East Africans can tell, this is simply the natural condition and they live within it. By the time they find out differently, it is too late. They already think that the writing of shell scripts is a natural act."
— Ken Pier, Xerox PARC