OSDN Git Service

(split) LDP: Update draft and release (from the previous commit)
[linuxjm/LDP_man-pages.git] / draft / man3 / exit.3
index 9f0e12d..4d10939 100644 (file)
@@ -1,5 +1,6 @@
 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>.
 .\"
+.\" %%%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.
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
+.\"
+.\" FIXME There are a lot of other process termination actions that
+.\" could be listed on this page. See, for example, the list in the
+.\" POSIX exit(3p) page.
+.\"
+.\"*******************************************************************
+.\"
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
 .\"
 .\" Japanese Version Copyright (c) 1997 HORIMOTO Masafumi
 .\"         all rights reserved.
 .\" Updated & Modified 2001-12-09, Yuichi SATO
 .\" Updated & Modified 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
 .\" Updated 2007-06-18, Akihiro MOTOKI, LDP v2.57
+.\" Updated 2013-05-01, Akihiro MOTOKI <amotoki@gmail.com>
 .\"
-.TH EXIT 3  2009-09-20 "Linux" "Linux Programmer's Manual"
-.\"O .SH NAME
-.SH Ì¾Á°
-.\"O exit \- cause normal process termination
-exit \- ¥×¥í¥»¥¹¤ÎÀµ¾ï½ªÎ»
-.\"O .SH SYNOPSIS
-.SH ½ñ¼°
+.TH EXIT 3 2014\-03\-25 Linux "Linux Programmer's Manual"
+.SH 名前
+exit \- プロセスの正常終了
+.SH 書式
 .nf
-.B #include <stdlib.h>
+\fB#include <stdlib.h>\fP
 .sp
-.BI "void exit(int " status );
+\fBvoid exit(int \fP\fIstatus\fP\fB);\fP
 .fi
-.\"O .SH DESCRIPTION
-.SH ÀâÌÀ
-.\"O The
-.\"O .BR exit ()
-.\"O function causes normal process termination and the
-.\"O value of \fIstatus & 0377\fP is returned to the parent
-.\"O (see
-.\"O .BR wait (2)).
-.BR exit ()
-´Ø¿ô¤Ï¡¢¥×¥í¥»¥¹¤òÀµ¾ï¤Ë½ªÎ»¤µ¤»¡¢
-\fIstatus & 0377\fP ¤È¤¤¤¦Ãͤò¿Æ¥×¥í¥»¥¹¤ØÊÖ¤¹
-.RB ( wait (2)
-¤ò»²¾È)¡£
+.SH 説明
+\fBexit\fP()  関数は、プロセスを正常に終了させ、 \fIstatus & 0377\fP という値を親プロセスへ返す (\fBwait\fP(2)
+を参照)。
 .LP
-.\"O All functions registered with
-.\"O .BR atexit (3)
-.\"O and
-.\"O .BR on_exit (3)
-.\"O are called, in the reverse order of their registration.
-.\"O (It is possible for one of these functions to use
-.\"O .BR atexit (3)
-.\"O or
-.\"O .BR on_exit (3)
-.\"O to register an additional
-.\"O function to be executed during exit processing;
-.\"O the new registration is added to the front of the list of functions
-.\"O that remain to be called.)
-.BR atexit (3)
-¤ä
-.BR on_exit (3)
-¤Ë¤è¤Ã¤Æ
-ÅÐÏ¿¤µ¤ì¤¿Á´¤Æ¤Î´Ø¿ô¤Ï¡¢¤½¤ì¤é¤¬ÅÐÏ¿¤µ¤ì¤¿½çÈ֤ȵսç¤Ë¥³¡¼¥ë¤µ¤ì¤ë¡£
-(ÅÐÏ¿¤µ¤ì¤¿´Ø¿ô¤ÎÃæ¤Ç
-.BR atexit (3)
-or
-.BR on_exit (3)
-¤ò»È¤Ã¤Æ
-exit ½èÍýÃæ¤Ë¼Â¹Ô¤µ¤ì¤ëÄɲäδؿô¤òÅÐÏ¿¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë;
-¿·µ¬¤ËÅÐÏ¿¤µ¤ì¤¿´Ø¿ô¤Ï¡¢¤³¤Î¸å¤Ç¼Â¹Ô¤µ¤ì¤ë´Ø¿ô¥ê¥¹¥È¤ÎÀèƬ¤Ë
-Äɲ䵤ì¤ë¡£)
-.\"O If one of these functions does not return
-.\"O (e.g., it calls
-.\"O .BR _exit (2),
-.\"O or kills itself with a signal),
-.\"O then none of the remaining functions is called,
-.\"O and further exit processing (in particular, flushing of
-.\"O .BR stdio (3)
-.\"O streams) is abandoned.
-.\"O If a function has been registered multiple times using
-.\"O .BR atexit (3)
-.\"O or
-.\"O .BR on_exit (3),
-.\"O then it is called as many times as it was registered.
-¤³¤ì¤é¤Î´Ø¿ô¤Î°ì¤Ä¤¬ÊÖ¤é¤Ê¤«¤Ã¤¿¾ì¹ç
-(Î㤨¤Ð¡¢¤½¤Î´Ø¿ô¤¬
-.BR _exit (2)
-¤ò¸Æ¤Ó½Ð¤·¤¿¤ê¡¢¥·¥°¥Ê¥ë¤Ç¼«Ê¬¼«¿È¤ò kill ¤·¤¿¾ì¹ç)¡¢
-»Ä¤ê¤Î´Ø¿ô¤Ï¤É¤ì¤â¸Æ¤Ó½Ð¤µ¤ì¤º¡¢¤½¤ì°Ê¹ß¤Î exit ½èÍý
-(ÆäË
-.BR stdio (3)
-¥¹¥È¥ê¡¼¥à¤Î¥Õ¥é¥Ã¥·¥å¤Ê¤É) ¤ÏÃæ»ß¤µ¤ì¤ë¡£
-¤¢¤ë´Ø¿ô¤¬
-.BR atexit (3)
-¤ä
-.BR on_exit (3)
-¤ò»È¤Ã¤ÆÊ£¿ô²óÅÐÏ¿¤µ¤ì¤Æ¤¤¤¿¾ì¹ç¡¢
-¤½¤Î´Ø¿ô¤ÏÅÐÏ¿¤µ¤ì¤¿¤Î¤ÈƱ¤¸²ó¿ô¤À¤±¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
+\fBatexit\fP(3)  や \fBon_exit\fP(3)  によって 登録された全ての関数は、それらが登録された順番と逆順にコールされる。
+(登録された関数の中で \fBatexit\fP(3)  or \fBon_exit\fP(3)  を使って exit
+処理中に実行される追加の関数を登録することができる; 新規に登録された関数は、この後で実行される関数リストの先頭に 追加される。)
+これらの関数の一つが返らなかった場合 (例えば、その関数が \fB_exit\fP(2)  を呼び出したり、シグナルで自分自身を kill した場合)、
+残りの関数はどれも呼び出されず、それ以降の exit 処理 (特に \fBstdio\fP(3)  ストリームのフラッシュなど) は中止される。 ある関数が
+\fBatexit\fP(3)  や \fBon_exit\fP(3)  を使って複数回登録されていた場合、 その関数は登録されたのと同じ回数だけ呼び出される。
 .LP
-.\"O All open
-.\"O .BR stdio (3)
-.\"O streams are flushed and closed.
-.\"O Files created by
-.\"O .BR tmpfile (3)
-.\"O are removed.
-¥ª¡¼¥×¥óÃæ¤Î
-.BR stdio (3)
-¥¹¥È¥ê¡¼¥à¤ÏÁ´¤Æ¥Õ¥é¥Ã¥·¥å¤µ¤ì¤Æ¡¢¥¯¥í¡¼¥º¤µ¤ì¤ë¡£
-.BR tmpfile (3)
-¤Ë¤è¤Ã¤ÆºîÀ®¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤Ïºï½ü¤µ¤ì¤ë¡£
+オープン中の \fBstdio\fP(3)  ストリームは全てフラッシュされて、クローズされる。 \fBtmpfile\fP(3)
+によって作成されたファイルは削除される。
 .LP
-.\"O The C standard specifies two constants,
-.\"O \fBEXIT_SUCCESS\fP and \fBEXIT_FAILURE\fP,
-.\"O that may be passed to
-.\"O .BR exit ()
-.\"O to indicate successful or unsuccessful
-.\"O termination, respectively.
-C É¸½à¤Ç¤Ï
-.B EXIT_SUCCESS
-¤È
-.B EXIT_FAILURE
-¤È¤¤¤¦ 2¤Ä¤ÎÄê¿ô¤¬
-ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£¤½¤ì¤¾¤ìÀµ¾ï½ªÎ»¤È°Û¾ï½ªÎ»¤ò¼¨¤¹¤â¤Î¤Ç¡¢
-.BR exit ()
-¤È¤·¤ÆÅϤ¹¤³¤È¤¬¤Ç¤­¤ë¡£
-.\"O .SH "RETURN VALUE"
-.SH ÊÖ¤êÃÍ
-.\"O The
-.\"O .BR exit ()
-.\"O function does not return.
-.BR exit ()
-´Ø¿ô¤ÏÊÖ¤é¤Ê¤¤¡£
-.\"O .SH "CONFORMING TO"
-.SH ½àµò
-SVr4, 4.3BSD, POSIX.1-2001, C89, C99.
-.\"O .SH NOTES
-.SH Ãí°Õ
+C 標準では \fBEXIT_SUCCESS\fP と \fBEXIT_FAILURE\fP という 2つの定数が
+定義されている。それぞれ正常終了と異常終了を示すもので、 \fBexit\fP()  として渡すことができる。
+.SH 返り値
+\fBexit\fP()  関数は返らない。
+.SH 属性
+.SS "マルチスレッディング (pthreads(7) 参照)"
+\fBexit\fP() 関数は保護されていないグローバル変数を使用しているため、スレッドセーフではない。
+.SH 準拠
+SVr4, 4.3BSD, POSIX.1\-2001, C89, C99.
+.SH 注意
 .LP
-.\"O It is undefined what happens if one of the
-.\"O functions registered using
-.\"O .BR atexit (3)
-.\"O and
-.\"O .BR on_exit (3)
-.\"O calls either
-.\"O .BR exit ()
-.\"O or
-.\"O .BR longjmp (3).
-.BR atexit (3)
-¤ä
-.BR on_exit (3)
-¤ò»È¤Ã¤ÆÅÐÏ¿¤µ¤ì¤¿´Ø¿ô¤ÎÃæ¤Ç
-.BR exit ()
-¤«
-.BR longjmp (3)
-¤¬¸Æ¤Ó½Ð¤µ¤ì¤¿¾ì¹ç¡¢
-²¿¤¬µ¯¤³¤ë¤«¤Ï̤ÄêµÁ¤Ç¤¢¤ë¡£
+\fBatexit\fP(3)  や \fBon_exit\fP(3)  を使って登録された関数の中で \fBexit\fP() か \fBlongjmp\fP(3)
+が呼び出された場合、 何が起こるかは未定義である。 \fBexecve\fP(2) を呼び出すと、 \fBatexit\fP(3) や \fBon_exit\fP(3)
+を使って登録された関数が削除される点に注意すること。
 .LP
-.\"O The use of
-.\"O .B EXIT_SUCCESS
-.\"O and
-.\"O .B EXIT_FAILURE
-.\"O is slightly more portable
-.\"O (to non-UNIX environments) than the use of 0 and some nonzero value
-.\"O like 1 or \-1.
-.\"O In particular, VMS uses a different convention.
-.B EXIT_SUCCESS
-¤È
-.B EXIT_FAILURE
-¤ò»È¤¦¤È¡¢0 ¤ä (1 ¤ä \-1 ¤È¤¤¤Ã¤¿) 0 °Ê³°¤ÎÃͤò»È¤¦¤Î¤ËÈæ¤Ù¤Æ
-(UNIX °Ê³°¤Î´Ä¶­¤Ë) °Ü¿¢¤¹¤ë¤Î¤¬¤¤¤¯¤é¤«´Êñ¤Ë¤Ê¤ë¡£
-ÆäˠVMS ¤ÏÊ̤ÎÊý¼°¤òÍѤ¤¤Æ¤¤¤ë¡£
+\fBEXIT_SUCCESS\fP と \fBEXIT_FAILURE\fP を使うと、0 や (1 や \-1 といった) 0 以外の値を使うのに比べて
+(UNIX 以外の環境に) 移植するのがいくらか簡単になる。 特に VMS は別の方式を用いている。
 .LP
-.\"O BSD has attempted to standardize exit codes; see the file
-.\"O .IR <sysexits.h> .
-BSD ¤Ï½ªÎ»¥³¡¼¥É¤òɸ½à²½¤·¤è¤¦¤È¤·¤Æ¤¤¤ë;
-.I <sysexits.h>
-¤ò»²¾È¤¹¤ë¤³¤È¡£
+BSD は終了コードを標準化しようとしている; \fI<sysexits.h>\fP を参照すること。
 .LP
-.\"O After
-.\"O .BR exit (),
-.\"O the exit status must be transmitted to the
-.\"O parent process.
-.\"O There are three cases.
-.\"O If the parent has set
-.\"O .BR SA_NOCLDWAIT ,
-.\"O or has set the
-.\"O .B SIGCHLD
-.\"O handler to
-.\"O .BR SIG_IGN ,
-.\"O the status is discarded.
-.\"O If the parent was waiting on the child
-.\"O it is notified of the exit status.
-.\"O In both cases the exiting
-.\"O process dies immediately.
-.\"O If the parent has not indicated that
-.\"O it is not interested in the exit status, but is not waiting,
-.\"O the exiting process turns into a "zombie" process
-.\"O (which is nothing but a container for the single byte representing
-.\"O the exit status) so that the parent can learn the exit status when
-.\"O it later calls one of the
-.\"O .BR wait (2)
-.\"O functions.
-.BR exit ()
-¤Î¸å¡¢¿Æ¥×¥í¥»¥¹¤Ë½ªÎ»¥¹¥Æ¡¼¥¿¥¹¤¬ÅϤµ¤ì¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
-½ªÎ»¥¹¥Æ¡¼¥¿¥¹¤ÎÅϤ·Êý¤Ë¤Ï 3 ¤Ä¤Î¾ì¹ç¤¬¤¢¤ë¡£
-¿Æ¥×¥í¥»¥¹¤¬
-.B SA_NOCLDWAIT
-¤òÀßÄꤷ¤¿¾ì¹ç¡¢
-¤Þ¤¿¤Ï
-.B SIGCHLD
-¥Ï¥ó¥É¥é¤ò
-.B SIG_IGN
-¤ËÀßÄꤷ¤¿¾ì¹ç¡¢
-¥¹¥Æ¡¼¥¿¥¹¤ÏÇË´þ¤µ¤ì¤ë¡£
-¿Æ¥×¥í¥»¥¹¤¬»Ò¥×¥í¥»¥¹¤Î½ªÎ»¤òÂԤäƤ¤¤ë¾ì¹ç¡¢
-¿Æ¥×¥í¥»¥¹¤Ë½ªÎ»¥¹¥Æ¡¼¥¿¥¹¤¬ÅÁ¤¨¤é¤ì¤ë¡£
-¤É¤Á¤é¤Î¾ì¹ç¤Ç¤â exit ¤Î¥×¥í¥»¥¹¤Ïľ¤Á¤Ë½ªÎ»¤¹¤ë¡£
-¡Ö½ªÎ»¥¹¥Æ¡¼¥¿¥¹¤ò´ØÃΤ»¤º½ªÎ»¤âÂÔ¤¿¤Ê¤¤¡×
-¤È¤¤¤¦¤³¤È¤ò¿Æ¥×¥í¥»¥¹¤¬»Ø¼¨¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢
-exit ¥×¥í¥»¥¹¤Ï (½ªÎ»¥¹¥Æ¡¼¥¿¥¹¤òɽ¤¹ 1 ¥Ð¥¤¥È¤Î¤ß¤òÊÝ»ý¤¹¤ë)
-¡Ö¥¾¥ó¥Ó¡×¥×¥í¥»¥¹¤Ë¤Ê¤ë¡£
-¤³¤ì¤Ë¤è¤ê¡¢¸å¤«¤é
-.BR wait (2)
-´Ø¿ô¤ò¸Æ¤Ó½Ð¤¹¤³¤È¤Ç¡¢
-¿Æ¥×¥í¥»¥¹¤Ï½ªÎ»¥¹¥Æ¡¼¥¿¥¹¤òÃΤ뤳¤È¤¬¤Ç¤­¤ë¡£
+\fBexit\fP()  の後、親プロセスに終了ステータスが渡されなければならない。 終了ステータスの渡し方には 3 つの場合がある。 親プロセスが
+\fBSA_NOCLDWAIT\fP を設定した場合、 または \fBSIGCHLD\fP ハンドラを \fBSIG_IGN\fP に設定した場合、
+ステータスは破棄される。 親プロセスが子プロセスの終了を待っている場合、 親プロセスに終了ステータスが伝えられる。 どちらの場合でも exit
+のプロセスは直ちに終了する。 「終了ステータスを関知せず終了も待たない」 ということを親プロセスが指示していない場合、 exit プロセスは
+(終了ステータスを表す 1 バイトのみを保持する)  「ゾンビ」プロセスになる。 これにより、後から \fBwait\fP(2)  関数を呼び出すことで、
+親プロセスは終了ステータスを知ることができる。
 .LP
-.\"O If the implementation supports the
-.\"O .B SIGCHLD
-.\"O signal, this signal
-.\"O is sent to the parent.
-.\"O If the parent has set
-.\"O .BR SA_NOCLDWAIT ,
-.\"O it is undefined whether a
-.\"O .B SIGCHLD
-.\"O signal is sent.
-.B SIGCHLD
-¥·¥°¥Ê¥ë¤Î¥µ¥Ý¡¼¥È¤¬¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢
-¤³¤Î¥·¥°¥Ê¥ë¤Ï¿Æ¥×¥í¥»¥¹¤ËÁ÷¤é¤ì¤ë¡£
-¿Æ¥×¥í¥»¥¹¤¬
-.B SA_NOCLDWAIT
-¤òÀßÄꤷ¤¿¾ì¹ç¡¢
-.B SIGCHLD
-¥·¥°¥Ê¥ë¤¬Á÷¤é¤ì¤ë¤«¤É¤¦¤«¤ÏÄêµÁ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
+\fBSIGCHLD\fP シグナルのサポートが実装されている場合、 このシグナルは親プロセスに送られる。 親プロセスが \fBSA_NOCLDWAIT\fP
+を設定した場合、 \fBSIGCHLD\fP シグナルが送られるかどうかは定義されていない。
 .LP
-.\"O If the process is a session leader and its controlling terminal
-.\"O is the controlling terminal of the session, then each process in
-.\"O the foreground process group of this controlling terminal
-.\"O is sent a
-.\"O .B SIGHUP
-.\"O signal, and the terminal is disassociated
-.\"O from this session, allowing it to be acquired by a new controlling
-.\"O process.
-¤½¤Î¥×¥í¥»¥¹¤¬¥»¥Ã¥·¥ç¥ó¤Î¥ê¡¼¥À¡¼¤Ç¡¢
-¤½¤Î¥×¥í¥»¥¹¤ÎÀ©¸æüËö¤¬¤½¤Î¥»¥Ã¥·¥ç¥ó¤ÎÀ©¸æüËö¤Ç¤¢¤ë¾ì¹ç¡¢
-¤³¤ÎÀ©¸æüËö¤Î¥Õ¥©¥¢¥°¥é¥¦¥ó¥É¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Ë¤¢¤ë
-³Æ¥×¥í¥»¥¹¤Ë
-.B SIGHUP
-¥·¥°¥Ê¥ë¤¬Á÷¤é¤ì¡¢Ã¼Ëö¤¬¥»¥Ã¥·¥ç¥ó¤«¤éÀÚ¤êÎ¥¤µ¤ì¤ë¡£
-¤³¤ì¤Ë¤è¤ê¿·¤·¤¤À©¸æ¥×¥í¥»¥¹¤ò¼èÆÀ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
+そのプロセスがセッションのリーダーで、 そのプロセスの制御端末がそのセッションの制御端末である場合、
+この制御端末のフォアグラウンドプロセスグループにある 各プロセスに \fBSIGHUP\fP シグナルが送られ、端末がセッションから切り離される。
+これにより新しい制御プロセスを取得することができる。
 .LP
-.\"O If the exit of the process causes a process group to become orphaned,
-.\"O and if any member of the newly orphaned process group is stopped,
-.\"O then a
-.\"O .B SIGHUP
-.\"O signal followed by a
-.\"O .B SIGCONT
-.\"O signal will be
-.\"O sent to each process in this process group.
-¥×¥í¥»¥¹¤¬½ªÎ»¤¹¤ë¤³¤È¤Ë¤è¤ê¡¢¥×¥í¥»¥¹¥°¥ë¡¼¥×¤¬¸ÉΩ¤·¤Æ¡¢
-¤½¤Î¥°¥ë¡¼¥×¤Î¥á¥ó¥Ð¡¼¤Î¤¦¤Á¤Î¤É¤ì¤«¤¬Ää»ß¤·¤¿¾ì¹ç¡¢
-¥×¥í¥»¥¹¥°¥ë¡¼¥×¤Î³Æ¥×¥í¥»¥¹¤ËÂФ·¤Æ
-.B SIGHUP
-¥·¥°¥Ê¥ë¤¬Á÷¤é¤ì¡¢Â³¤¤¤Æ
-.B SIGCONT
-¥·¥°¥Ê¥ë¤¬Á÷¤é¤ì¤ë¡£
-.\"O See
-.\"O .BR setpgid (2)
-.\"O for an explanation of orphaned process groups.
-¸ÉΩ¤·¤¿ (orphaned) ¥×¥í¥»¥¹¥°¥ë¡¼¥×¤ÎÀâÌÀ¤Ï
-.BR setpgid (2)
-¤ò»²¾È¡£
-.\"O .SH "SEE ALSO"
-.SH ´ØÏ¢¹àÌÜ
-.BR _exit (2),
-.BR setpgid (2),
-.BR wait (2),
-.BR atexit (3),
-.BR on_exit (3),
-.BR tmpfile (3)
+プロセスが終了することにより、プロセスグループが孤立して、 そのグループのメンバーのうちのどれかが停止した場合、 プロセスグループの各プロセスに対して
+\fBSIGHUP\fP シグナルが送られ、続いて \fBSIGCONT\fP シグナルが送られる。 孤立した (orphaned) プロセスグループの説明は
+\fBsetpgid\fP(2)  を参照。
+.SH 関連項目
+\fB_exit\fP(2), \fBsetpgid\fP(2), \fBwait\fP(2), \fBatexit\fP(3), \fBon_exit\fP(3),
+\fBtmpfile\fP(3)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.64 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。