OSDN Git Service

7e759ad4800517f76eaeefd76eb31c967450fac9
[linuxjm/LDP_man-pages.git] / draft / man3 / on_exit.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" References consulted:
26 .\"     Linux libc source code
27 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28 .\"     386BSD man pages
29 .\" Modified 1993-04-02, David Metcalfe
30 .\" Modified 1993-07-25, Rik Faith (faith@cs.unc.edu)
31 .\"*******************************************************************
32 .\"
33 .\" This file was generated with po4a. Translate the source file.
34 .\"
35 .\"*******************************************************************
36 .TH ON_EXIT 3 2008\-12\-05 GNU "Linux Programmer's Manual"
37 .SH 名前
38 on_exit \- プロセスが正常に終了した際に呼ばれる関数を登録する
39 .SH 書式
40 .nf
41 \fB#include <stdlib.h>\fP
42 .sp
43 \fBint on_exit(void (*\fP\fIfunction\fP\fB)(int , void *), void *\fP\fIarg\fP\fB);\fP
44 .fi
45 .sp
46 .in -4n
47 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
48 .in
49 .sp
50 \fBon_exit\fP(): _BSD_SOURCE || _SVID_SOURCE
51 .SH 説明
52 \fBon_exit\fP()  関数は、指定された関数 \fIfunction\fP を、プロセスが
53 正常に終了した際に呼ばれる関数として登録する。正常な終了とは、 \fBexit\fP(3)  またはプログラムの \fImain\fP()  関数の中の
54 return 命令による終了である。 関数 \fIfunction\fP には、直近の \fBexit\fP(3)  の呼び出しで渡された status 引数と
55 \fBon_exit\fP()  の \fIarg\fP 引数が渡される。
56
57 同じ関数を複数回登録してもよい。 登録された関数は登録 1 回につき 1 回呼び出される。
58
59 \fBfork\fP(2) で作成された場合、子プロセスは親プロセスの登録のコピーを継承する。
60 \fBexec\fP(3) ファミリーの関数の場合、呼び出しに成功すると、 全ての登録が削除される。
61 .SH 返り値
62 \fBon_exit\fP()  関数は、成功したら 0 を、そうでなければ 0 以外を返す。
63 .SH 準拠
64 この関数は SunOS 4 由来であるが、libc4, libc5, glibc にも存在する。 Solaris (SunOS 5)
65 にはもはや存在しない。 この関数の使用は避け、代わりに標準の \fBatexit\fP(3)  を使うこと。
66 .SH 関連項目
67 \fB_exit\fP(2), \fBatexit\fP(3), \fBexit\fP(3)
68 .SH この文書について
69 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.52 の一部
70 である。プロジェクトの説明とバグ報告に関する情報は
71 http://www.kernel.org/doc/man\-pages/ に書かれている。