Submitted by: Akira Ikeuchi <a_ikeuchi@mic.mitsumi.co.jp> Reviewed by: Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
134 lines
4.2 KiB
Groff
134 lines
4.2 KiB
Groff
.\" Copyright (c) 1980, 1991, 1993
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
.\" must display the following acknowledgement:
|
|
.\" This product includes software developed by the University of
|
|
.\" California, Berkeley and its contributors.
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
.\" may be used to endorse or promote products derived from this software
|
|
.\" without specific prior written permission.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
.\" SUCH DAMAGE.
|
|
.\"
|
|
.\" @(#)fork.2 8.1 (Berkeley) 6/4/93
|
|
.\" %FreeBSD: src/lib/libc/sys/fork.2,v 1.19 2004/07/02 23:52:13 ru Exp %
|
|
.\"
|
|
.\" $FreeBSD$
|
|
.Dd June 4, 1993
|
|
.Dt FORK 2
|
|
.Os
|
|
.Sh ̾¾Î
|
|
.Nm fork
|
|
.Nd ¿·¤·¤¤¥×¥í¥»¥¹¤òºîÀ®¤¹¤ë
|
|
.Sh ¥é¥¤¥Ö¥é¥ê
|
|
.Lb libc
|
|
.Sh ½ñ¼°
|
|
.In sys/types.h
|
|
.In unistd.h
|
|
.Ft pid_t
|
|
.Fn fork void
|
|
.Sh ²òÀâ
|
|
.Fn fork
|
|
¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ë¤è¤Ã¤Æ¿·¤·¤¤¥×¥í¥»¥¹¤ÎºîÀ®¤¬¹Ô¤ï¤ì¤Þ¤¹¡£
|
|
¿·¤·¤¤¥×¥í¥»¥¹ (»Ò¥×¥í¥»¥¹)¤Ï¡¢
|
|
°Ê²¼¤Î¹àÌܤò½ü¤¤¤¿¸Æ¤Ó½Ð¤·¥×¥í¥»¥¹ (¿Æ¥×¥í¥»¥¹) ¤ÎÀµ³Î¤Ê¥³¥Ô¡¼¤Ç¤¹¡£
|
|
.Bl -bullet -offset indent
|
|
.It
|
|
»Ò¥×¥í¥»¥¹¤Ï¥æ¥Ë¡¼¥¯¤Ê¥×¥í¥»¥¹ ID ¤ò»ý¤Á¤Þ¤¹¡£
|
|
.It
|
|
»Ò¥×¥í¥»¥¹¤Ï°Û¤Ê¤ë¿Æ¥×¥í¥»¥¹ ID ¤ò»ý¤Á¤Þ¤¹
|
|
(¤¹¤Ê¤ï¤Á¡¢¿Æ¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹ ID ¤Ç¤¹)¡£
|
|
.It
|
|
»Ò¥×¥í¥»¥¹¤Ï¡¢ÀìÍѤΡ¢¿Æ¤Îµ½Ò»Ò¤Î¥³¥Ô¡¼¤ò»ý¤Á¤Þ¤¹¡£
|
|
¤½¤ì¤é¤Îµ½Ò»Ò¤Ï²¼ÁØ¤ÎÆ±¤¸¥ª¥Ö¥¸¥§¥¯¥È¤ò»²¾È¤·¤Þ¤¹¡£
|
|
¤Ä¤Þ¤ê»Ò¤È¿Æ¤Î´Ö¤Ç¡¢¤¿¤È¤¨¤Ð¥Õ¥¡¥¤¥ë¥ª¥Ö¥¸¥§¥¯¥ÈÆâ¤Î
|
|
¥Õ¥¡¥¤¥ë¥Ý¥¤¥ó¥¿¤¬¶¦Í¤µ¤ì¤Þ¤¹¡£
|
|
¤½¤Î¤¿¤á»Ò¥×¥í¥»¥¹¤Îµ½Ò»Ò¤Ø¤Î
|
|
.Xr lseek 2
|
|
¤¬¡¢¤½¤Î¸å¤Î¿Æ¤Ë¤è¤ë
|
|
.Xr read 2
|
|
¤Þ¤¿¤Ï
|
|
.Xr write 2
|
|
¤Ë±Æ¶Á¤òµÚ¤Ü¤·¤Þ¤¹¡£
|
|
¤³¤Îµ½Ò»Ò¥³¥Ô¡¼¤Ï¡¢¿·¤·¤¯ºîÀ®¤µ¤ì¤¿¥×¥í¥»¥¹ÍѤÎɸ½àÆþ½ÐÎϤò³ÎΩ¤¹¤ë¤¿¤á¤Ë¡¢
|
|
¤ª¤è¤Ó¥Ñ¥¤¥×¤ò¥»¥Ã¥È¥¢¥Ã¥×¤¹¤ë¤¿¤á¤Ë¡¢¥·¥§¥ë¤Ë¤è¤Ã¤Æ¤â»ÈÍѤµ¤ì¤Þ¤¹¡£
|
|
.It
|
|
»Ò¥×¥í¥»¥¹¤Î¥ê¥½¡¼¥¹»ÈÍѾõ¶·¤Ï 0 ¤ËÀßÄꤵ¤ì¤Þ¤¹¡£
|
|
.Xr setrlimit 2
|
|
¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
|
|
.It
|
|
¤¹¤Ù¤Æ¤Î¥¤¥ó¥¿¡¼¥Ð¥ë¥¿¥¤¥Þ¤¬¥¯¥ê¥¢¤µ¤ì¤Þ¤¹¡£
|
|
.Xr setitimer 2
|
|
¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
|
|
.El
|
|
.Sh Ìá¤êÃÍ
|
|
Àµ¾ï¤Ë´°Î»¤·¤¿¾ì¹ç¡¢
|
|
.Fn fork
|
|
¤Ï¡¢»Ò¥×¥í¥»¥¹¤ËÃÍ 0 ¤òÊÖ¤·¡¢»Ò¥×¥í¥»¥¹¤Î¥×¥í¥»¥¹ ID ¤ò¿Æ¥×¥í¥»¥¹¤ËÊÖ¤·¤Þ¤¹¡£
|
|
¤½¤¦¤Ç¤Ê¤¤¾ì¹ç¤Ï -1 ¤¬¿Æ¥×¥í¥»¥¹¤ËÊÖ¤µ¤ì¡¢»Ò¥×¥í¥»¥¹¤ÏºîÀ®¤µ¤ì¤º¤Ë¡¢
|
|
¥¨¥é¡¼¤ò¼¨¤¹¤¿¤á¤Ë¥°¥í¡¼¥Ð¥ëÊÑ¿ô
|
|
.Va errno
|
|
¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£
|
|
.Sh ¥¨¥é¡¼
|
|
¼¡¤Î¾ì¹ç¤Ë
|
|
.Fn fork
|
|
¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï½èÍý¤Ë¼ºÇÔ¤·¡¢»Ò¥×¥í¥»¥¹¤ÏºîÀ®¤µ¤ì¤Þ¤»¤ó:
|
|
.Bl -tag -width Er
|
|
.It Bq Er EAGAIN
|
|
¼Â¹ÔÃæ¤Î¥×¥í¥»¥¹¤Î¹ç·×¿ô¤¬¥·¥¹¥Æ¥à¤Î¸Â³¦¤òͤ¨¤Þ¤¹¡£
|
|
¸Â³¦ÃͤÏ
|
|
.Xr sysctl 3
|
|
¤Î MIB ÊÑ¿ô¤Î
|
|
.Dv KERN_MAXPROC
|
|
¤Ë¤è¤Ã¤Æ»ØÄꤵ¤ì¤Þ¤¹ (¥¹¡¼¥Ñ¥æ¡¼¥¶¤ò½ü¤¤¤Æ¡¢
|
|
¼ÂºÝ¤Ë¤Ï¸Â³¦¤Ï¤³¤ì¤è¤ê 10 ¸Ä¾¯¤Ê¤¯¤Ê¤ê¤Þ¤¹)¡£
|
|
.It Bq Er EAGAIN
|
|
¥æ¡¼¥¶¤¬¥¹¡¼¥Ñ¥æ¡¼¥¶¤Ç¤Ê¤¯¡¢
|
|
1 ¿Í¤Î¥æ¡¼¥¶¤Ë¤è¤Ã¤Æ¼Â¹ÔÃæ¤Î¥×¥í¥»¥¹¤Î¹ç·×¿ô¤¬¡¢¥·¥¹¥Æ¥à¤Î¸Â³¦¤ò±Û¤¨¤Þ¤¹¡£
|
|
¸Â³¦¤Ï
|
|
.Xr sysctl 3
|
|
¤Î MIB ÊÑ¿ô¤Î
|
|
.Dv KERN_MAXPROCPERUID
|
|
¤Ë¤è¤Ã¤Æ»ØÄꤵ¤ì¤Þ¤¹¡£
|
|
.It Bq Er EAGAIN
|
|
¥æ¡¼¥¶¤¬¥¹¡¼¥Ñ¥æ¡¼¥¶¤Ç¤Ê¤¯¡¢
|
|
.Fa resource
|
|
°ú¿ô¤Î
|
|
.Dv RLIMIT_NPROC
|
|
¤ËÂбþ¤¹¤ë¥½¥Õ¥È¥ê¥½¡¼¥¹¸Â³¦¤ò±Û¤¨¤Þ¤¹
|
|
.Pf ( Xr getrlimit 2
|
|
¤ò»²¾È)¡£
|
|
.It Bq Er ENOMEM
|
|
¿·¤·¤¤¥×¥í¥»¥¹ÍѤΥ¹¥ï¥Ã¥×¶õ´Ö¤¬ÉÔ½¼Ê¬¤Ç¤¹¡£
|
|
.El
|
|
.Sh ´ØÏ¢¹àÌÜ
|
|
.Xr execve 2 ,
|
|
.Xr rfork 2 ,
|
|
.Xr setitimer 2 ,
|
|
.Xr setrlimit 2 ,
|
|
.Xr vfork 2 ,
|
|
.Xr wait 2
|
|
.Sh Îò»Ë
|
|
.Fn fork
|
|
´Ø¿ô¤Ï
|
|
.At v6
|
|
¤ÇÅо줷¤Þ¤·¤¿¡£
|