mirror of https://github.com/mkerrisk/man-pages
Noted use of atexit() for establishing function to be invoked on shared library
unload. Noted that atexit()-registered functions are not invoked on abnormal termination. Formatting fixes.
This commit is contained in:
parent
87ed9800a4
commit
1b825ab4b4
|
@ -38,10 +38,10 @@ atexit \- register a function to be called at normal process termination
|
|||
.BI "int atexit(void (*" function )(void));
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
The \fBatexit()\fP function registers the given \fIfunction\fP to be
|
||||
The \fBatexit\fP() function registers the given \fIfunction\fP to be
|
||||
called at normal process termination, either via
|
||||
.BR exit (3)
|
||||
or via return from the program's \fBmain\fP().
|
||||
or via return from the program's \fImain\fP().
|
||||
Functions so registered are called in
|
||||
the reverse order of their registration; no arguments are passed.
|
||||
.LP
|
||||
|
@ -53,7 +53,7 @@ The actual limit supported by an implementation can be obtained using
|
|||
Upon a successful call to one of the exec functions,
|
||||
all registrations are removed.
|
||||
.SH "RETURN VALUE"
|
||||
The \fBatexit()\fP function returns the value 0 if successful; otherwise
|
||||
The \fBatexit\fP() function returns the value 0 if successful; otherwise
|
||||
it returns a non-zero value.
|
||||
.SH EXAMPLE
|
||||
.nf
|
||||
|
@ -80,6 +80,14 @@ int main(){
|
|||
return EXIT_SUCCESS;
|
||||
}
|
||||
.fi
|
||||
.SH NOTES
|
||||
Since glibc 2.2.3, \fBatexit\fP() (and \fBon_exit\fP())
|
||||
can be used to within a shared library to establish functions
|
||||
that are called when the shared library is unloaded.
|
||||
.PP
|
||||
Functions registered using \fBatexit\fP() (and \fBon_exit\fP())
|
||||
are not called if a process terminates abnormally because
|
||||
of the delivery of a signal.
|
||||
.SH "CONFORMING TO"
|
||||
SVID 3, BSD 4.3, ISO 9899, POSIX 1003.1-2001
|
||||
.SH "SEE ALSO"
|
||||
|
|
Loading…
Reference in New Issue