OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / release / man3 / atexit.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-03-29, David Metcalfe
28 .\" Modified 1993-07-24, Rik Faith (faith@cs.unc.edu)
29 .\" Modified 2003-10-25, Walter Harms
30 .\"
31 .\" Japanese Version Copyright (c) 1996 Kentaro OGAWA
32 .\"         all rights reserved.
33 .\" Translated 2006-07-14, Kentaro OGAWA <k_ogawa@oyna.cc.muroran-it.ac.jp>
34 .\" Updated & Modified 2004-05-23, Yuichi SATO <ysato444@yahoo.co.jp>
35 .\" Updated 2008-12-26, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.15
36 .\"
37 .TH ATEXIT 3  2008-12-05 "Linux" "Linux Programmer's Manual"
38 .SH Ì¾Á°
39 atexit \- ¥×¥í¥»¥¹¤¬Àµ¾ï½ªÎ»¤·¤¿»þ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë´Ø¿ô¤òÅÐÏ¿¤¹¤ë
40 .SH ½ñ¼°
41 .nf
42 .B #include <stdlib.h>
43 .sp
44 .BI "int atexit(void (*" function )(void));
45 .fi
46 .SH ÀâÌÀ
47 .BR atexit ()
48 ´Ø¿ô¤Ï¡¢Í¿¤¨¤é¤ì¤¿ \fIfunction\fP ¤ò¡¢
49 .BR exit (3)
50 ¤ä¥×¥í¥°¥é¥à¤Î \fImain\fP()
51 ´Ø¿ô¤«¤é¤ÎÊÖ¤ê¤òÄ̤¸¤Æ¡¢¥×¥í¥»¥¹¤¬Àµ¾ï½ªÎ»¤·¤¿»þ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë
52 ´Ø¿ô¤È¤·¤ÆÅÐÏ¿¤¹¤ë¡£
53 ¤³¤³¤ÇÄêµÁ¤µ¤ì¤¿´Ø¿ô¤Ï¡¢ÅÐÏ¿¤·¤¿½çÈ֤ȤϵդνçÈ֤ǸƤӽФµ¤ì¤ë¡£
54 ÅÐÏ¿¤·¤¿´Ø¿ô¤Ë°ú¤­¿ô¤ÏÅϤµ¤ì¤Ê¤¤¡£
55
56 Ʊ¤¸´Ø¿ô¤òÊ£¿ô²óÅÐÏ¿¤·¤Æ¤â¤è¤¤¡£
57 ÅÐÏ¿¤µ¤ì¤¿´Ø¿ô¤ÏÅÐÏ¿ 1 ²ó¤Ë¤Ä¤­ 1 ²ó¸Æ¤Ó½Ð¤µ¤ì¤ë¡£
58 .LP
59 POSIX.1-2001 ¤Ç¤Ï¡¢¤³¤Î¤è¤¦¤Ê´Ø¿ô¤ò¾¯¤Ê¤¯¤È¤â
60 .B ATEXIT_MAX
61 ¸Ä (32¸Ä) ÅÐÏ¿¤Ç¤­¤ë¤³¤È¤òÍ׵ᤷ¤Æ¤¤¤ë¡£
62 ¤½¤Î¼ÂÁõ¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¼ÂºÝ¤Î¾å¸Â¤Ï
63 .BR sysconf (3)
64 ¤ò»È¤Ã¤Æ¼èÆÀ¤Ç¤­¤ë¡£
65 .LP
66 .BR fork (2)
67 ¤ÇºîÀ®¤µ¤ì¤¿¾ì¹ç¡¢»Ò¥×¥í¥»¥¹¤Ï¿Æ¥×¥í¥»¥¹¤ÎÅÐÏ¿¤Î¥³¥Ô¡¼¤ò·Ñ¾µ¤¹¤ë¡£
68 .BR exec (3)
69 ¥Õ¥¡¥ß¥ê¡¼¤Î´Ø¿ô¤Î¤¤¤º¤ì¤«¤Î¸Æ¤Ó½Ð¤·¤ËÀ®¸ù¤¹¤ë¤È¡¢
70 Á´¤Æ¤ÎÅÐÏ¿¤¬ºï½ü¤µ¤ì¤ë¡£
71 .SH ÊÖ¤êÃÍ
72 .BR atexit ()
73 ´Ø¿ô¤Ï¡¢´Ø¿ôÅÐÏ¿¤¬À®¸ù¤·¤¿»þ¤Ë¤Ï 0 ¤òÊÖ¤¹¡£
74 ¤½¤Î¾¤Î¾ì¹ç¤Ë¤Ï 0 °Ê³°¤ÎÃͤòÊÖ¤¹¡£
75 .SH ½àµò
76 SVr4, 4.3BSD, C89, C99, POSIX.1-2001.
77 .SH Ãí°Õ
78 .BR atexit ()
79 (¤È
80 .BR on_exit (3))
81 ¤ò»È¤Ã¤ÆÅÐÏ¿¤µ¤ì¤¿´Ø¿ô¤Ï¡¢
82 ¥·¥°¥Ê¥ë¤ÎÇÛÁ÷¤Ë¤è¤ê¥×¥í¥»¥¹¤¬°Û¾ï½ªÎ»¤·¤¿¾ì¹ç¤Ë¤Ï¸Æ¤Ó½Ð¤µ¤ì¤Ê¤¤¡£
83
84 ÅÐÏ¿¤µ¤ì¤¿´Ø¿ô¤Î°ì¤Ä¤¬
85 .BR _exit (2)
86 ¤ò¸Æ¤Ó½Ð¤·¤¿¾ì¹ç¡¢»Ä¤ê¤Î´Ø¿ô¤Ï¤É¤ì¤âµ¯Æ°¤µ¤ì¤º¡¢
87 .BR exit (3)
88 ¤Ë¤è¤ê¼Â¹Ô¤µ¤ì¤ë¾¤Î¥×¥í¥»¥¹½ªÎ»¥¹¥Æ¥Ã¥×¤Ï¼Â¹Ô¤µ¤ì¤Ê¤¤¡£
89
90 POSIX.1-2001 ¤Ç¤Ï¡¢
91 .BR atexit (3)
92 ¤ò»È¤Ã¤ÆÅÐÏ¿¤µ¤ì¤¿°ì¤Ä¤Î´Ø¿ôÆâ¤Ç¡¢Ê£¿ô²ó
93 .BR exit (3)
94 ¤ò¸Æ¤Ó½Ð¤·¤¿ºÝ¤Î·ë²Ì¤Ï̤ÄêµÁ¤Ç¤¢¤ë¡£
95 .\" This can happen on OpenBSD 4.2 for example, and is documented
96 .\" as occurring on FreeBSD as well.
97 .\" Glibc does "the Right Thing" -- invocation of the remaining
98 .\" exit handlers carries on as normal.
99 (Linux ¤Ç¤Ï¤Ê¤¤¤¬) ¤¤¤¯¤Ä¤«¤Î¥·¥¹¥Æ¥à¤Ç¤Ï¡¢¤³¤Î¾ì¹ç¡¢
100 ·«¤êÊÖ¤·¤¬Ìµ¸Â¤Ëµ¯¤³¤ë¤³¤È¤Ë¤Ê¤ë¡£
101 °Ü¿¢À­¤¬É¬Í×¤Ê¥×¥í¥°¥é¥à¤Ç¤Ï¡¢
102 .BR atexit (3)
103 ¤ÇÅÐÏ¿¤µ¤ì¤¿´Ø¿ôÆâ¤Ç
104 .BR exit (3)
105 ¤òµ¯Æ°¤¹¤Ù¤­¤Ç¤Ï¤Ê¤¤¡£
106
107 .BR atexit ()
108 ¤È
109 .BR on_exit (3)
110 ¤Ï¡¢Æ±¤¸¥ê¥¹¥È¤ËÂФ·¤Æ´Ø¿ô¤òÅÐÏ¿¤¹¤ë¡£
111 ¥×¥í¥»¥¹¤¬Àµ¾ï¤Ë½ªÎ»¤·¤¿ºÝ¤Ë¤Ï¡¢
112 ¤³¤ì¤é¤ÎÆó¤Ä¤Î´Ø¿ô¤ÇÅÐÏ¿¤µ¤ì¤¿½ç½ø¤ÎµÕ½ç¤Ç¡¢
113 ÅÐÏ¿¤µ¤ì¤¿´Ø¿ô¤¬µ¯Æ°¤µ¤ì¤ë¡£
114
115 POSIX.1-2001 ¤Ç¤Ï¡¢
116 .BR atexit (3)
117 ¤ÇÅÐÏ¿¤µ¤ì¤¿´Ø¿ô¤Î¼Â¹Ô¤ò½ªÎ»¤¹¤ë¤¿¤á¤Ë
118 .BR longjmp (3)
119 ¤¬»ÈÍѤµ¤ì¤¿¾ì¹ç¤Î·ë²Ì¤Ï̤ÄêµÁ¤Ç¤¢¤ë¡£
120 .\" In glibc, things seem to be handled okay
121 .SS Linux ¤Ç¤ÎÃí°Õ
122 glibc 2.2.3 °Ê¹ß¤Ç¤Ï¡¢¶¦Í­¥é¥¤¥Ö¥é¥ê¤¬¥¢¥ó¥í¡¼¥É¤µ¤ì¤ë¤È¤­¤Ë¸Æ¤Ð¤ì¤ë
123 ´Ø¿ô¤òÅÐÏ¿¤¹¤ë¤¿¤á¤Ë¡¢¶¦Í­¥é¥¤¥Ö¥é¥ê¤ÎÃæ¤Ç
124 .BR atexit ()
125 (¤È
126 .BR on_exit (3))
127 ¤ò»ÈÍѤ¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
128 .PP
129 .SH Îã
130 .nf
131 #include <stdio.h>
132 #include <stdlib.h>
133 #include <unistd.h>
134
135 void
136 bye(void)
137 {
138     printf("That was all, folks\en");
139 }
140
141 int
142 main(void)
143 {
144     long a;
145     int i;
146
147     a = sysconf(_SC_ATEXIT_MAX);
148     printf("ATEXIT_MAX = %ld\en", a);
149
150     i = atexit(bye);
151     if (i != 0) {
152         fprintf(stderr, "cannot set exit function\en");
153         exit(EXIT_FAILURE);
154     }
155
156     exit(EXIT_SUCCESS);
157 }
158 .fi
159 .SH ´ØÏ¢¹àÌÜ
160 .BR _exit (2),
161 .BR exit (3),
162 .BR on_exit (3)