OSDN Git Service

Update draft for LDP 3.67
[linuxjm/LDP_man-pages.git] / draft / man2 / fork.2
index d058317..1054354 100644 (file)
@@ -1,9 +1,8 @@
-.\" Hey Emacs! This file is -*- nroff -*- source.
-.\"
 .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
 .\" A few fragments remain from an earlier (1992) page by
 .\" Drew Eckhardt (drew@cs.colorado.edu),
 .\"
+.\" %%%LICENSE_START(VERBATIM)
 .\" Permission is granted to make and distribute verbatim copies of this
 .\" manual provided the copyright notice and this permission notice are
 .\" preserved on all copies.
@@ -23,6 +22,7 @@
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
 .\"
 .\" Modified by Michael Haardt (michael@moria.de)
 .\" Modified Sat Jul 24 13:22:07 1993 by Rik Faith (faith@cs.unc.edu)
 .\"     Greatly expanded, to describe all attributes that differ
 .\"    parent and child.
 .\"
+.\"*******************************************************************
+.\"
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
+.\"
 .\" Japanese Version Copyright (c) 1996 TABATA Tomohira
 .\"         all rights reserved.
 .\" Translated Thu Jun 27 20:35:06 JST 1996
 .\"         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
+.\" Updated 2012-05-29, Akihiro MOTOKI <amotoki@gmail.com>
+.\" Updated 2013-05-01, Akihiro MOTOKI <amotoki@gmail.com>
 .\"
-.TH FORK 2 2009-04-27 "Linux" "Linux Programmer's Manual"
-.\"O .SH NAME
-.SH Ì¾Á°
-.\"O fork \- create a child process
-fork \- »Ò¥×¥í¥»¥¹¤òÀ¸À®¤¹¤ë
-.\"O .SH SYNOPSIS
-.SH ½ñ¼°
-.B #include <unistd.h>
+.TH FORK 2 2014\-05\-12 Linux "Linux Programmer's Manual"
+.SH 名前
+fork \- 子プロセスを生成する
+.SH 書式
+\fB#include <unistd.h>\fP
 .sp
-.B pid_t fork(void);
-.\"O .SH DESCRIPTION
-.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 ¤Ç»²¾È¤µ¤ì¤ë¿·¤·¤¤¥×¥í¥»¥¹¤Ï¡¢°Ê²¼¤ÎÅÀ¤ò½ü¤­¡¢
-\fIparent\fP ¤Ç»²¾È¤µ¤ì¤ë¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î´°Á´¤ÊÊ£À½¤Ç¤¢¤ë:
+\fBpid_t fork(void);\fP
+.SH 説明
+\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 ¤ÈƱ¤¸¤Ç¤¢¤ë¡£
+子プロセスの親プロセス 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
-.\"O .RB ( see 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 ()
-¤Ë¤è¤Ã¤Æ°ú¤­·Ñ¤¬¤ì¤Ê¤¤¡£
+timer slack value のデフォルト値には、親プロセスの現在の timer slack value が設定される。 \fBprctl\fP(2)
+の \fBPR_SET_TIMERSLACK\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)
-¤ò»²¾È)¡£
+\fBmadvise\fP(2)  の \fBMADV_DONTFORK\fP フラグでマークされたメモリマッピングは、 \fBfork\fP()
+によって引き継がれない。
+.IP *
+子プロセスの終了シグナルは常に \fBSIGCHLD\fP である (\fBclone\fP(2)  を参照)。
+.IP *
+\fBioperm\fP(2) で設定されるポートアクセス許可ビットは、子プロセスには継承されない。子プロセスでは、 \fBioperm\fP(2)
+を使って必要なビットをセットしなければならない。
 .PP
-.\"O Note the following further points:
-¤µ¤é¤Ë°Ê²¼¤ÎÅÀ¤Ë¤Ä¤¤¤ÆÃí°Õ¤¹¤ë¤³¤È:
+以下の点についても注意すること:
 .IP * 3
-.\"O The child process is created with a single thread \(em the
-.\"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"
-.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
-.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"
-.SH ½àµò
-SVr4, 4.3BSD, POSIX.1-2001.
-.\"O .SH NOTES
-.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) ¤¬Àµ¤·¤¤ÃͤòÊÖ¤¹¤³¤È¤¬¤Ç¤­¤ë¤è¤¦¤Ë²¿¤é¤«¤Î½èÍý¤ò¹Ô¤¦¡£
+子プロセスは、親プロセスのオープン済みのディレクトリストリームの集合 (\fBopendir\fP(3)  参照) のコピーを継承する。
+POSIX.1\-2001 では、親プロセスと子プロセス間の対応するディレクトリストリーム はディレクトリストリームの位置 (positioning)
+を共有してもよいとされている。 Linux/glibc ではディレクトリストリームの位置の共有は行われていない。
+.SH 返り値
+成功した場合、親プロセスには子プロセスの PID が返され、 子プロセスには 0 が返される。 失敗した場合、親プロセスに \-1
+が返され、子プロセスは生成されず、 \fIerrno\fP が適切に設定される。
+.SH エラー
+.TP 
+\fBEAGAIN\fP
+親プロセスのページテーブルのコピーと 子プロセスのタスク構造に生成に必要なメモリを \fBfork\fP()  が割り当てることができなかった。
+.TP 
+\fBEAGAIN\fP
+呼び出し元の \fBRLIMIT_NPROC\fP 資源の制限 (resource limit) に達したために、新しいプロセスを生成できなかった。
+この制限を超えるには、プロセスは \fBCAP_SYS_ADMIN\fP または \fBCAP_SYS_RESOURCE\fP ケーパビリティ
+(capability) を持っていなくてはならない。
+.TP 
+\fBEAGAIN\fP
+The caller is operating under the \fBSCHED_DEADLINE\fP scheduling policy and
+does not have the reset\-on\-fork flag set.  See \fBsched\fP(7).
+.TP 
+\fBENOMEM\fP
+メモリが足りないために、 \fBfork\fP()  は必要なカーネル構造体を割り当てることができなかった。
+.TP 
+\fBENOSYS\fP
+.\" e.g., arm (optionally), blackfin, c6x, frv, h8300, microblaze, xtensa
+\fBfork\fP() はこのプラットフォームではサポートされていない
+(例えば、メモリ管理ユニット (MMU) がないハードウェア)。
+.SH 準拠
+SVr4, 4.3BSD, POSIX.1\-2001.
+.SH 注意
+.PP
+Linux では、 \fBfork\fP()  を 書き込み時コピー (copy\-on\-write) ページを用いて実装している。 したがって、fork
+を行うことの唯一のデメリットは、 親プロセスのページテーブルを複製と 子プロセス自身のタスク構造の作成のための時間とメモリが必要なことである。
 
-.\"O .SH EXAMPLE
-.SH Îã
-.\"O See
-.\"O .BR pipe (2)
-.\"O and
-.\"O .BR wait (2).
-.BR pipe (2)
-¤ª¤è¤Ó
-.BR wait (2)
-¤ò»²¾È¡£
-.\"O .SH "SEE ALSO"
-.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)
+.\" 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 例
+\fBpipe\fP(2)  および \fBwait\fP(2)  を参照。
+.SH 関連項目
+\fBclone\fP(2), \fBexecve\fP(2), \fBexit\fP(2), \fBsetrlimit\fP(2), \fBunshare\fP(2),
+\fBvfork\fP(2), \fBwait\fP(2), \fBdaemon\fP(3), \fBcapabilities\fP(7), \fBcredentials\fP(7)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.67 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。