28
28
.\" Modified 1993-07-24, Rik Faith (faith@cs.unc.edu)
29
29
.\" Modified 2003-10-25, Walter Harms
31
.TH ATEXIT 3 2003-11-01 "Linux" "Linux Programmer's Manual"
31
.TH ATEXIT 3 2008-12-05 "Linux" "Linux Programmer's Manual"
33
33
atexit \- register a function to be called at normal process termination
46
46
or via return from the program's \fImain\fP().
47
47
Functions so registered are called in
48
48
the reverse order of their registration; no arguments are passed.
50
The same function may be registered multiple times:
51
it is called once for each registration.
50
53
POSIX.1-2001 requires that an implementation allow at least
75
78
are not called if a process terminates abnormally because
76
79
of the delivery of a signal.
81
If one of the functions registered functions calls
83
then any remaining functions are not invoked,
84
and the other process termination steps performed by
88
POSIX.1-2001 says that the result of calling
90
more than once (i.e., calling
92
within a function registered using
95
On some systems (but not Linux), this can result in an infinite recursion;
96
.\" This can happen on OpenBSD 4.2 for example, and is documented
97
.\" as occurring on FreeBSD as well.
98
.\" Glibc does "the Right Thing" -- invocation of the remaining
99
.\" exit handlers carries on as normal.
100
portable programs should not invoke
102
inside a function registered using
109
functions register functions on the same list:
110
at normal process termination,
111
the registered functions are invoked in reverse order
112
of their registration by these two functions.
114
POSIX.1-2001 says that the result is undefined if
116
is used to terminate execution of one of the functions registered
118
.\" In glibc, things seem to be handled okay
78
120
Since glibc 2.2.3,