1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>.
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" Japanese Version Copyright (c) 1997 HORIMOTO Masafumi
24 .\" all rights reserved.
25 .\" Translated 1997-09-10, HORIMOTO Masafumi
26 .\" Updated & Modified 2001-10-27, Yuichi SATO <ysato@h4.dion.ne.jp>
27 .\" Updated & Modified 2001-12-09, Yuichi SATO
28 .\" Updated & Modified 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
29 .\" Updated 2007-06-18, Akihiro MOTOKI, LDP v2.57
31 .TH EXIT 3 2009-09-20 "Linux" "Linux Programmer's Manual"
36 .B #include <stdlib.h>
38 .BI "void exit(int " status );
43 \fIstatus & 0377\fP という値を親プロセスへ返す
51 登録された全ての関数は、それらが登録された順番と逆順にコールされる。
57 exit 処理中に実行される追加の関数を登録することができる;
58 新規に登録された関数は、この後で実行される関数リストの先頭に
63 を呼び出したり、シグナルで自分自身を kill した場合)、
64 残りの関数はどれも呼び出されず、それ以降の exit 処理
67 ストリームのフラッシュなど) は中止される。
73 その関数は登録されたのと同じ回数だけ呼び出される。
77 ストリームは全てフラッシュされて、クローズされる。
86 定義されている。それぞれ正常終了と異常終了を示すもので、
93 SVr4, 4.3BSD, POSIX.1-2001, C89, C99.
109 を使うと、0 や (1 や \-1 といった) 0 以外の値を使うのに比べて
110 (UNIX 以外の環境に) 移植するのがいくらか簡単になる。
113 BSD は終了コードを標準化しようとしている;
118 の後、親プロセスに終了ステータスが渡されなければならない。
119 終了ステータスの渡し方には 3 つの場合がある。
129 親プロセスが子プロセスの終了を待っている場合、
131 どちらの場合でも exit のプロセスは直ちに終了する。
132 「終了ステータスを関知せず終了も待たない」
133 ということを親プロセスが指示していない場合、
134 exit プロセスは (終了ステータスを表す 1 バイトのみを保持する)
139 親プロセスは終了ステータスを知ることができる。
148 シグナルが送られるかどうかは定義されていない。
151 そのプロセスの制御端末がそのセッションの制御端末である場合、
152 この制御端末のフォアグラウンドプロセスグループにある
155 シグナルが送られ、端末がセッションから切り離される。
156 これにより新しい制御プロセスを取得することができる。
158 プロセスが終了することにより、プロセスグループが孤立して、
159 そのグループのメンバーのうちのどれかが停止した場合、
165 孤立した (orphaned) プロセスグループの説明は