~ubuntu-branches/ubuntu/saucy/manpages/saucy

« back to all changes in this revision

Viewing changes to man3/atexit.3

  • Committer: Bazaar Package Importer
  • Author(s): Joey Schulze
  • Date: 2008-12-13 15:28:58 UTC
  • mfrom: (1.1.37 upstream) (2.1.13 sid)
  • Revision ID: james.westby@ubuntu.com-20081213152858-06ey2s94bhc09owg
* New upstream source
* Avoid distribution of more up-to-date pthread manpages that are
  currently also provided by glibc-doc:
  . pthread_cleanup_push_defer_np(3)
  . pthread_cleanup_pop_restore_np(3)

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
.\" Modified 1993-07-24, Rik Faith (faith@cs.unc.edu)
29
29
.\" Modified 2003-10-25, Walter Harms
30
30
.\"
31
 
.TH ATEXIT 3  2003-11-01 "Linux" "Linux Programmer's Manual"
 
31
.TH ATEXIT 3  2008-12-05 "Linux" "Linux Programmer's Manual"
32
32
.SH NAME
33
33
atexit \- register a function to be called at normal process termination
34
34
.SH SYNOPSIS
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.
 
49
 
 
50
The same function may be registered multiple times:
 
51
it is called once for each registration.
49
52
.LP
50
53
POSIX.1-2001 requires that an implementation allow at least
51
54
.B ATEXIT_MAX
74
77
.BR on_exit (3))
75
78
are not called if a process terminates abnormally because
76
79
of the delivery of a signal.
 
80
 
 
81
If one of the functions registered functions calls
 
82
.BR _exit (2),
 
83
then any remaining functions are not invoked,
 
84
and the other process termination steps performed by
 
85
.BR exit (3)
 
86
are not performed.
 
87
 
 
88
POSIX.1-2001 says that the result of calling
 
89
.BR exit (3)
 
90
more than once (i.e., calling
 
91
.BR exit (3)
 
92
within a function registered using
 
93
.BR atexit (3))
 
94
is undefined.
 
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
 
101
.BR exit (3)
 
102
inside a function registered using
 
103
.BR atexit (3).
 
104
 
 
105
The
 
106
.BR atexit ()
 
107
and
 
108
.BR on_exit (3)
 
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.
 
113
 
 
114
POSIX.1-2001 says that the result is undefined if
 
115
.BR longjmp (3)
 
116
is used to terminate execution of one of the functions registered
 
117
.BR atexit ().
 
118
.\" In glibc, things seem to be handled okay
77
119
.SS "Linux Notes"
78
120
Since glibc 2.2.3,
79
121
.BR atexit ()
116
158
.BR exit (3),
117
159
.BR on_exit (3)
118
160
.SH COLOPHON
119
 
This page is part of release 3.14 of the Linux
 
161
This page is part of release 3.15 of the Linux
120
162
.I man-pages
121
163
project.
122
164
A description of the project,