OSDN Git Service

(split) LDP: draft snapshot generated from latest ja.po files.
[linuxjm/LDP_man-pages.git] / draft / man2 / fork.2
index 50fa882..b143d4c 100644 (file)
 .\"     Greatly expanded, to describe all attributes that differ
 .\"    parent and child.
 .\"
-.\" Japanese Version Copyright (c) 1996 TABATA Tomohira
-.\"         all rights reserved.
-.\" Translated Thu Jun 27 20:35:06 JST 1996
-.\"         by TABATA Tomohira <loba@k2.t.u-tokyo.ac.jp>
-.\" Modified Sun Dec 14 00:43:22 JST 1997
-.\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
-.\" Modified Tue Jul 10 05:36:22 JST 2001
-.\"         by Yuichi SATO <ysato@h4.dion.ne.jp>, LDP v1.38
-.\" Updated & Modified Wed Dec 29 12:33:12 JST 2004
-.\"         by Yuichi SATO <ysato444@yahoo.co.jp>, LDP v2.01
-.\" Updated & Modified Wed Jan  3 04:11:03 JST 2007 by Yuichi SATO, LDP v2.43
-.\" Updated 2008-08-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.05
+.\"*******************************************************************
 .\"
-.TH FORK 2 2009-04-27 "Linux" "Linux Programmer's Manual"
-.\"O .SH NAME
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
+.TH FORK 2 2012\-02\-27 Linux "Linux Programmer's Manual"
 .SH 名前
-.\"O fork \- create a child process
 fork \- 子プロセスを生成する
-.\"O .SH SYNOPSIS
 .SH 書式
-.B #include <unistd.h>
+\fB#include <unistd.h>\fP
 .sp
-.B pid_t fork(void);
-.\"O .SH DESCRIPTION
+\fBpid_t fork(void);\fP
 .SH 説明
-.\"O .BR fork ()
-.\"O creates a new process by duplicating the calling process.
-.\"O The new process, referred to as the \fIchild\fP,
-.\"O is an exact duplicate of the calling process,
-.\"O referred to as the \fIparent\fP, except for the following points:
-.BR fork ()
-は呼び出し元プロセスを複製して新しいプロセスを生成する。
-\fIchild\fP で参照される新しいプロセスは、以下の点を除き、
+\fBfork\fP()  は呼び出し元プロセスを複製して新しいプロセスを生成する。 \fIchild\fP で参照される新しいプロセスは、以下の点を除き、
 \fIparent\fP で参照される呼び出し元プロセスの完全な複製である:
 .IP * 3
-.\"O The child has its own unique process ID,
-.\"O and this PID does not match the ID of any existing process group
-.\"O .RB ( setpgid (2)).
-子プロセスは独自のプロセス ID を持ち、
-この PID は既存のどのプロセスグループ
-.RB ( setpgid (2))
-の ID とも一致しない。
+子プロセスは独自のプロセス ID を持ち、 この PID は既存のどのプロセスグループ (\fBsetpgid\fP(2))  の ID とも一致しない。
 .IP *
-.\"O The child's parent process ID is the same as the parent's process ID.
 子プロセスの親プロセス ID は、親プロセスのプロセス ID と同じである。
 .IP *
-.\"O The child does not inherit its parent's memory locks
-.\"O .RB ( mlock (2),
-.\"O .BR mlockall (2)).
-子プロセスは親プロセスのメモリロック
-.RB ( mlock (2),
-.BR mlockall (2))
-を引き継がない。
+子プロセスは親プロセスのメモリロック (\fBmlock\fP(2), \fBmlockall\fP(2))  を引き継がない。
 .IP *
-.\"O Process resource utilizations
-.\"O .RB ( getrusage (2))
-.\"O and CPU time counters
-.\"O .RB ( times (2))
-.\"O are reset to zero in the child.
-プロセスの資源利用量
-.RB ( getrusage (2))
-と CPU タイムカウンタ
-.RB ( times (2))
-が、子プロセスでは 0 にリセットされる。
+プロセスの資源利用量 (\fBgetrusage\fP(2))  と CPU タイムカウンタ (\fBtimes\fP(2))  が、子プロセスでは 0
+にリセットされる。
 .IP *
-.\"O The child's set of pending signals is initially empty
-.\"O .RB ( sigpending (2)).
-子プロセスの処理待ちのシグナルの集合
-.RB ( sigpending (2))
-は、初期状態では空になる。
+子プロセスの処理待ちのシグナルの集合 (\fBsigpending\fP(2))  は、初期状態では空になる。
 .IP *
-.\"O The child does not inherit semaphore adjustments from its parent
-.\"O .RB ( semop (2)).
-子プロセスは親プロセスからセマフォ調整
-.RB ( semop (2))
-を引き継がない。
+子プロセスは親プロセスからセマフォ調整 (\fBsemop\fP(2))  を引き継がない。
 .IP *
-.\"O The child does not inherit record locks from its parent
-.\"O .RB ( fcntl (2)).
-子プロセスは親プロセスからレコードロック
-.RB ( fcntl (2))
-を引き継がない。
+子プロセスは親プロセスからレコードロック (\fBfcntl\fP(2))  を引き継がない。
 .IP *
-.\"O The child does not inherit timers from its parent
-.\"O .RB ( setitimer (2),
-.\"O .BR alarm (2),
-.\"O .BR timer_create (2)).
-子プロセスは親プロセスからタイマー
-.RB ( setitimer (2),
-.BR alarm (2),
-.BR timer_create (2))
+子プロセスは親プロセスからタイマー (\fBsetitimer\fP(2), \fBalarm\fP(2), \fBtimer_create\fP(2))
 を引き継がない。
 .IP *
-.\"O The child does not inherit outstanding asynchronous I/O operations
-.\"O from its parent
-.\"O .RB ( aio_read (3),
-.\"O .BR aio_write (3)),
-.\"O nor does it inherit any asynchronous I/O contexts from its parent (see
-.\"O .BR io_setup (2)).
-子プロセスは親プロセスから主だった非同期 I/O 操作を引き継がない
-.RB ( aio_read (3),
-.BR aio_write (3)
-参照)。
-また、親プロセスから非同期 I/O コンテキストを引き継がない
-.RB ( io_setup (2)
-参照)。
+子プロセスは親プロセスから主だった非同期 I/O 操作を引き継がない (\fBaio_read\fP(3), \fBaio_write\fP(3)  参照)。
+また、親プロセスから非同期 I/O コンテキストを引き継がない (\fBio_setup\fP(2)  参照)。
 .PP
-.\"O The process attributes in the preceding list are all specified
-.\"O in POSIX.1-2001.
-.\"O The parent and child also differ with respect to the following
-.\"O Linux-specific process attributes:
-上記のリストにあるプロセス属性は、POSIX.1-2001 で全て指定されている。
-親プロセスと子プロセスは、以下の Linux 固有のプロセス属性も異なる:
+上記のリストにあるプロセス属性は、POSIX.1\-2001 で全て指定されている。 親プロセスと子プロセスは、以下の Linux
+固有のプロセス属性も異なる:
 .IP * 3
-.\"O The child does not inherit directory change notifications (dnotify)
-.\"O from its parent
-.\"O (see the description of
-.\"O .B F_NOTIFY
-.\"O in
-.\"O .BR fcntl (2)).
-子プロセスは親プロセスからディレクトリ変更通知 (dnotify)
-.RB ( fcntl (2)
-における
-.B F_NOTIFY
-の説明を参照) を引き継がない。
+子プロセスは親プロセスからディレクトリ変更通知 (dnotify)  (\fBfcntl\fP(2)  における \fBF_NOTIFY\fP の説明を参照)
+を引き継がない。
 .IP *
-.\"O The
-.\"O .BR prctl (2)
-.\"O .B PR_SET_PDEATHSIG
-.\"O setting is reset so that the child does not receive a signal
-.\"O when its parent terminates.
-.BR prctl (2)
-の
-.B PR_SET_PDEATHSIG
-の設定がリセットされ、子プロセスは親プロセスが終了したときに
+\fBprctl\fP(2)  の \fBPR_SET_PDEATHSIG\fP の設定がリセットされ、子プロセスは親プロセスが終了したときに
 シグナルを受信しない。
 .IP *
-.\"O Memory mappings that have been marked with the
-.\"O .BR madvise (2)
-.\"O .B MADV_DONTFORK
-.\"O flag are not inherited across a
-.\"O .BR fork ().
-.BR madvise (2)
-の
-.B MADV_DONTFORK
-フラグでマークされたメモリマッピングは、
-.BR fork ()
+\fBmadvise\fP(2)  の \fBMADV_DONTFORK\fP フラグでマークされたメモリマッピングは、 \fBfork\fP()
 によって引き継がれない。
 .IP *
-.\"O The termination signal of the child is always
-.\"O .B SIGCHLD
-.\"O (see
-.\"O .BR clone (2)).
-子プロセスの終了シグナルは常に
-.B SIGCHLD
-である
-.RB ( clone (2)
-を参照)。
+子プロセスの終了シグナルは常に \fBSIGCHLD\fP である (\fBclone\fP(2)  を参照)。
 .PP
-.\"O Note the following further points:
-さらに以下の点について注意すること:
+以下の点についても注意すること:
 .IP * 3
-.\"O The child process is created with a single thread\(emthe
-.\"O one that called
-.\"O .BR fork ().
-子プロセスはシングルスレッドで生成される。つまり、
-.BR fork ()
-を呼び出したスレッドとなる。
-.\"O The entire virtual address space of the parent is replicated in the child,
-.\"O including the states of mutexes, condition variables,
-.\"O and other pthreads objects; the use of
-.\"O .BR pthread_atfork (3)
-.\"O may be helpful for dealing with problems that this can cause.
-親プロセスの仮想アドレス空間全体が子プロセスに複製される。
-これにはミューテックス (mutex) の状態・条件変数・
-pthread オブジェクトが含まれる。
-これが引き起こす問題を扱うには、
-.BR pthread_atfork (3)
-を使うと良いだろう。
+子プロセスはシングルスレッドで生成される。つまり、 \fBfork\fP()  を呼び出したスレッドとなる。
+親プロセスの仮想アドレス空間全体が子プロセスに複製される。 これにはミューテックス (mutex) の状態・条件変数・ pthread
+オブジェクトが含まれる。 これが引き起こす問題を扱うには、 \fBpthread_atfork\fP(3)  を使うと良いだろう。
 .IP *
-.\"O The child inherits copies of the parent's set of open file descriptors.
-.\"O Each file descriptor in the child refers to the same
-.\"O open file description (see
-.\"O .BR open (2))
-.\"O as the corresponding file descriptor in the parent.
-子プロセスは親プロセスが持つ
-オープンファイルディスクリプタの集合のコピーを引き継ぐ。
-子プロセスの各ファイルディスクリプタは、
-親プロセスのファイルディスクリプタに対応する
-同じオープンファイル記述 (file description) を参照する
-.RB ( open (2)
-を参照)。
-.\"O This means that the two descriptors share open file status flags,
-.\"O current file offset,
-.\"O and signal-driven I/O attributes (see the description of
-.\"O .B F_SETOWN
-.\"O and
-.\"O .B F_SETSIG
-.\"O in
-.\"O .BR fcntl (2)).
-これは 2 つのディスクリプタが、ファイル状態フラグ・
-現在のファイルオフセット、シグナル駆動 (signal-driven) I/O 属性
-.RB ( fcntl (2)
-における
-.BR F_SETOWN ,
-.B F_SETSIG
-の説明を参照) を共有することを意味する。
+子プロセスは親プロセスが持つ オープンファイルディスクリプタの集合のコピーを引き継ぐ。 子プロセスの各ファイルディスクリプタは、
+親プロセスのファイルディスクリプタに対応する 同じオープンファイル記述 (file description) を参照する (\fBopen\fP(2)
+を参照)。 これは 2 つのディスクリプタが、ファイル状態フラグ・ 現在のファイルオフセット、シグナル駆動 (signal\-driven) I/O 属性
+(\fBfcntl\fP(2)  における \fBF_SETOWN\fP, \fBF_SETSIG\fP の説明を参照) を共有することを意味する。
 .IP *
-.\"O The child inherits copies of the parent's set of open message
-.\"O queue descriptors (see
-.\"O .BR mq_overview (7)).
-子プロセスは親プロセスが持つオープンメッセージキューディスクリプタ
-.RB ( mq_overview (7)
-を参照) の集合のコピーを引き継ぐ。
-.\"O Each descriptor in the child refers to the same
-.\"O open message queue description
-.\"O as the corresponding descriptor in the parent.
-子プロセスの各ディスクリプタは、
-親プロセスのディスクリプタに対応する
-同じオープンメッセージキューディスクリプタを参照する。
-.\"O This means that the two descriptors share the same flags
-.\"O .RI ( mq_flags ).
-これは 2 つのディスクリプタが同じフラグ
-.RI ( mq_flags )
-を共有することを意味する。
+子プロセスは親プロセスが持つオープンメッセージキューディスクリプタ (\fBmq_overview\fP(7)  を参照) の集合のコピーを引き継ぐ。
+子プロセスの各ディスクリプタは、 親プロセスのディスクリプタに対応する 同じオープンメッセージキューディスクリプタを参照する。 これは 2
+つのディスクリプタが同じフラグ (\fImq_flags\fP)  を共有することを意味する。
 .IP *
-.\"O The child inherits copies of the parent's set of open directory streams (see
-.\"O .BR opendir (3)).
-.\"O POSIX.1-2001 says that the corresponding directory streams
-.\"O in the parent and child
-.\"O .I may
-.\"O share the directory stream positioning;
-.\"O on Linux/glibc they do not.
-子プロセスは、親プロセスのオープン済みのディレクトリストリームの集合
-.RB ( opendir (3)
-参照) のコピーを継承する。
-POSIX.1-2001 では、親プロセスと子プロセス間の対応するディレクトリストリーム
-はディレクトリストリームの位置 (positioning) を共有してもよいとされている。
-Linux/glibc ではディレクトリストリームの位置の共有は行われていない。
-.\"O .SH "RETURN VALUE"
+子プロセスは、親プロセスのオープン済みのディレクトリストリームの集合 (\fBopendir\fP(3)  参照) のコピーを継承する。
+POSIX.1\-2001 では、親プロセスと子プロセス間の対応するディレクトリストリーム はディレクトリストリームの位置 (positioning)
+を共有してもよいとされている。 Linux/glibc ではディレクトリストリームの位置の共有は行われていない。
 .SH 返り値
-.\"O On success, the PID of the child process is returned in the parent,
-.\"O and 0 is returned in the child.
-.\"O On failure, \-1 is returned in the parent,
-.\"O no child process is created, and
-.\"O .I errno
-.\"O is set appropriately.
-成功した場合、親プロセスには子プロセスの PID が返され、
-子プロセスには 0 が返される。
-失敗した場合、親プロセスに \-1 が返され、子プロセスは生成されず、
-.I errno
-が適切に設定される。
-.\"O .SH ERRORS
+成功した場合、親プロセスには子プロセスの PID が返され、 子プロセスには 0 が返される。 失敗した場合、親プロセスに \-1
+が返され、子プロセスは生成されず、 \fIerrno\fP が適切に設定される。
 .SH エラー
-.TP
-.B EAGAIN
-.\"O .BR fork ()
-.\"O cannot allocate sufficient memory to copy the parent's page tables and
-.\"O allocate a task structure for the child.
-親プロセスのページ・テーブルのコピーと
-子プロセスのタスク構造に生成に必要なメモリを
-.BR fork ()
-が割り当てることができなかった。
-.TP
-.B EAGAIN
-.\"O It was not possible to create a new process because the caller's
-.\"O .B RLIMIT_NPROC
-.\"O resource limit was encountered.
-呼び出し元の
-.B RLIMIT_NPROC
-資源の制限 (resource limit) に達したために、新しいプロセスを生成できなかった。
-.\"O To exceed this limit, the process must have either the
-.\"O .B CAP_SYS_ADMIN
-.\"O or the
-.\"O .B CAP_SYS_RESOURCE
-.\"O capability.
-この制限を超えるには、プロセスは
-.B CAP_SYS_ADMIN
-または
-.B CAP_SYS_RESOURCE
-ケーパビリティ (capability) を持っていなくてはならない。
-.TP
-.B ENOMEM
-.\"O .BR fork ()
-.\"O failed to allocate the necessary kernel structures because memory is tight.
-メモリが足りないために、
-.BR fork ()
-は必要なカーネル構造体を割り当てることができなかった。
-.\"O .SH "CONFORMING TO"
+.TP 
+\fBEAGAIN\fP
+親プロセスのページ・テーブルのコピーと 子プロセスのタスク構造に生成に必要なメモリを \fBfork\fP()  が割り当てることができなかった。
+.TP 
+\fBEAGAIN\fP
+呼び出し元の \fBRLIMIT_NPROC\fP 資源の制限 (resource limit) に達したために、新しいプロセスを生成できなかった。
+この制限を超えるには、プロセスは \fBCAP_SYS_ADMIN\fP または \fBCAP_SYS_RESOURCE\fP ケーパビリティ
+(capability) を持っていなくてはならない。
+.TP 
+\fBENOMEM\fP
+メモリが足りないために、 \fBfork\fP()  は必要なカーネル構造体を割り当てることができなかった。
 .SH 準拠
-SVr4, 4.3BSD, POSIX.1-2001.
-.\"O .SH NOTES
+SVr4, 4.3BSD, POSIX.1\-2001.
 .SH 注意
-.\"O .PP
-.\"O Under Linux,
-.\"O .BR fork ()
-.\"O is implemented using copy-on-write pages, so the only penalty that it incurs
-.\"O is the time and memory required to duplicate the parent's page tables,
-.\"O and to create a unique task structure for the child.
-Linux では、
-.BR fork ()
-を 書き込み時コピー (copy-on-write)・ページを用いて実装している。
-したがって、fork を行うことの唯一のデメリットは、
-親プロセスのページ・テーブルを複製と
-子プロセス自身のタスク構造の作成のための時間とメモリが必要なことである。
-
-.\"O Since version 2.3.3,
-.\"O .\" nptl/sysdeps/unix/sysv/linux/fork.c
-.\"O rather than invoking the kernel's
-.\"O .BR fork ()
-.\"O system call,
-.\"O the glibc
-.\"O .BR fork ()
-.\"O wrapper that is provided as part of the
-.\"O NPTL threading implementation invokes
-.\"O .BR clone (2)
-.\"O with flags that provide the same effect as the traditional system call.
-.\"O The glibc wrapper invokes any fork handlers that have been
-.\"O established using
-.\"O .BR pthread_atfork (3).
-.\"O .\" and does some magic to ensure that getpid(2) returns the right value.
-glibc 2.3.3 以降では、
-NPTL スレッド実装の一部として提供されている glibc の
-.BR fork ()
-ラッパー関数は、
-カーネルの
-.BR fork ()
-システムコールを起動するのではなく、
-.BR clone (2)
-を起動する。
-.BR clone (2)
-に渡すフラグとして、伝統的な
-.BR fork ()
-システムコールと同じ効果が得られるようなフラグが指定される。
-glibc のラッパー関数は
-.BR pthread_atfork (3)
-を使って設定されている任意の fork ハンドラを起動する。
-.\" getpid(2) が正しい値を返すことができるように何らかの処理を行う。
+.PP
+Linux では、 \fBfork\fP()  を 書き込み時コピー (copy\-on\-write)・ページを用いて実装している。 したがって、fork
+を行うことの唯一のデメリットは、 親プロセスのページ・テーブルを複製と 子プロセス自身のタスク構造の作成のための時間とメモリが必要なことである。
 
-.\"O .SH EXAMPLE
+.\" nptl/sysdeps/unix/sysv/linux/fork.c
+.\" and does some magic to ensure that getpid(2) returns the right value.
+glibc 2.3.3 以降では、 NPTL スレッド実装の一部として提供されている
+glibc の\fBfork\fP() ラッパー関数は、 カーネルの \fBfork\fP() システムコール
+を起動するのではなく、\fBclone\fP(2) を起動する。
+\fBclone\fP(2) に渡すフラグとして、伝統的な \fBfork\fP() システムコールと
+同じ効果が得られるようなフラグが指定される (\fBfork\fP() の呼び出しは、
+\fIflags\fP に \fBSIGCHLD\fP だけを指定して \fBclone\fP(2) を呼び出すのと等価である)。
+glibc のラッパー関数は \fBpthread_atfork\fP(3) を使って設定されている
+任意の fork ハンドラを起動する。
 .SH 例
-.\"O See
-.\"O .BR pipe (2)
-.\"O and
-.\"O .BR wait (2).
-.BR pipe (2)
-および
-.BR wait (2)
-を参照。
-.\"O .SH "SEE ALSO"
+\fBpipe\fP(2)  および \fBwait\fP(2)  を参照。
 .SH 関連項目
-.BR clone (2),
-.BR execve (2),
-.BR setrlimit (2),
-.BR unshare (2),
-.BR vfork (2),
-.BR wait (2),
-.BR daemon (3),
-.BR capabilities (7),
-.BR credentials (7)
+\fBclone\fP(2), \fBexecve\fP(2), \fBsetrlimit\fP(2), \fBunshare\fP(2), \fBvfork\fP(2),
+\fBwait\fP(2), \fBdaemon\fP(3), \fBcapabilities\fP(7), \fBcredentials\fP(7)