OSDN Git Service

Convert release and draft pages to UTF-8.
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man3 / on_exit.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
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.
6 .\"
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.
11 .\"
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
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" References consulted:
24 .\"     Linux libc source code
25 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26 .\"     386BSD man pages
27 .\" Modified 1993-04-02, David Metcalfe
28 .\" Modified 1993-07-25, Rik Faith (faith@cs.unc.edu)
29 .\"
30 .\" Japanese Version Copyright (c) 1997 Seiichi Yoshida
31 .\"       all rights reserved.
32 .\" Translated 1997-02-14, Seiichi Yoshida <seiichi@muraoka.info.waseda.ac.jp>
33 .\" Updated 2002-09-27, Kentaro Shirakata <argrath@ub32.org>
34 .\" Updated 2005-02-26, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
35 .\" Updated 2008-12-26, Akihiro MOTOKI, LDP v3.15
36 .\"
37 .TH ON_EXIT 3  2008-12-05 "GNU" "Linux Programmer's Manual"
38 .\"O .SH NAME
39 .SH 名前
40 .\"O on_exit \- register a function to be called at normal process termination
41 on_exit \- プロセスが正常に終了した際に呼ばれる関数を登録する
42 .\"O .SH SYNOPSIS
43 .SH 書式
44 .nf
45 .B #include <stdlib.h>
46 .sp
47 .BI "int on_exit(void (*" function ")(int , void *), void *" arg );
48 .fi
49 .sp
50 .in -4n
51 .\"O Feature Test Macro Requirements for glibc (see
52 .\"O .BR feature_test_macros (7)):
53 glibc 向けの機能検査マクロの要件
54 .RB ( feature_test_macros (7)
55 参照):
56 .in
57 .sp
58 .BR on_exit ():
59 _BSD_SOURCE || _SVID_SOURCE
60 .\"O .SH DESCRIPTION
61 .SH 説明
62 .\"O The
63 .\"O .BR on_exit ()
64 .\"O function registers the given \fIfunction\fP to be
65 .\"O called at normal process termination, whether via
66 .\"O .BR exit (3)
67 .\"O or via return from the program's \fImain\fP().
68 .\"O The \fIfunction\fP is passed the status argument given to the last call to
69 .\"O .BR exit (3)
70 .\"O and the \fIarg\fP argument from
71 .\"O .BR on_exit ().
72 .BR on_exit ()
73 関数は、指定された関数 \fIfunction\fP を、プロセスが
74 正常に終了した際に呼ばれる関数として登録する。正常な終了とは、
75 .BR exit (3)
76 またはプログラムの \fImain\fP()
77 関数の中の return 命令による終了である。
78 関数 \fIfunction\fP には、直近の
79 .BR exit (3)
80 の呼び出しで渡された status 引数と
81 .BR on_exit ()
82 の \fIarg\fP 引数が渡される。
83
84 .\"O The same function may be registered multiple times:
85 .\"O it is called once for each registration.
86 同じ関数を複数回登録してもよい。
87 登録された関数は登録 1 回につき 1 回呼び出される。
88
89 .\"O When a child process is created via
90 .\"O .BR fork (2),
91 .\"O it inherits copies of its parent's registrations.
92 .\"O Upon a successful call to one of the
93 .\"O .BR exec (3)
94 .\"O functions, all registrations are removed.
95 .BR fork (2)
96 経由で作成された子プロセスは、親プロセスの登録のコピーを継承する。
97 .BR exec (3)
98 群の関数の呼び出しに成功すると、全ての登録が削除される。
99 .\"O .SH "RETURN VALUE"
100 .SH 返り値
101 .\"O The
102 .\"O .BR on_exit ()
103 .\"O function returns the value 0 if successful; otherwise
104 .\"O it returns a nonzero value.
105 .BR on_exit ()
106 関数は、成功したら 0 を、そうでなければ 0 以外を返す。
107 .\"O .SH "CONFORMING TO"
108 .SH 準拠
109 .\"O This function comes from SunOS 4, but is also present in
110 .\"O libc4, libc5 and glibc.
111 .\"O It no longer occurs in Solaris (SunOS 5).
112 .\"O Avoid this function, and use the standard
113 .\"O .BR atexit (3)
114 .\"O instead.
115 この関数は SunOS 4 由来であるが、libc4, libc5, glibc にも存在する。
116 Solaris (SunOS 5) にはもはや存在しない。
117 この関数の使用は避け、代わりに標準の
118 .BR atexit (3)
119 を使うこと。
120 .\"O .SH "SEE ALSO"
121 .SH 関連項目
122 .BR _exit (2),
123 .BR atexit (3),
124 .BR exit (3)