]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/on_exit.3
err.3: EXAMPLES: use EXIT_FAILURE rather than 1 as exit status
[thirdparty/man-pages.git] / man3 / on_exit.3
index bac34d9645d5959ec0e082c66bd6d3a563635b75..188c5bc88b5c6d6344570602873c3a4c90992164 100644 (file)
 .\"     386BSD man pages
 .\" Modified 1993-04-02, David Metcalfe
 .\" Modified 1993-07-25, Rik Faith (faith@cs.unc.edu)
-.TH ON_EXIT 3  2015-05-07 "GNU" "Linux Programmer's Manual"
+.TH ON_EXIT 3  2019-08-02 "GNU" "Linux Programmer's Manual"
 .SH NAME
 on_exit \- register a function to be called at normal process termination
 .SH SYNOPSIS
 .nf
 .B #include <stdlib.h>
-.sp
+.PP
 .BI "int on_exit(void (*" function ")(int , void *), void *" arg );
 .fi
-.sp
+.PP
 .in -4n
 Feature Test Macro Requirements for glibc (see
 .BR feature_test_macros (7)):
 .in
-.sp
+.PP
 .BR on_exit ():
     Since glibc 2.19:
         _DEFAULT_SOURCE
@@ -66,10 +66,10 @@ and the
 .I arg
 argument from
 .BR on_exit ().
-
+.PP
 The same function may be registered multiple times:
 it is called once for each registration.
-
+.PP
 When a child process is created via
 .BR fork (2),
 it inherits copies of its parent's registrations.
@@ -93,13 +93,23 @@ T{
 .BR on_exit ()
 T}     Thread safety   MT-Safe
 .TE
-
+.sp 1
 .SH CONFORMING TO
 This function comes from SunOS 4, but is also present in glibc.
 It no longer occurs in Solaris (SunOS 5).
 Portable application should avoid this function, and use the standard
 .BR atexit (3)
 instead.
+.SH NOTES
+By the time
+.I function
+is executed, stack
+.RI ( auto )
+variables may already have gone out of scope.
+Therefore,
+.I arg
+should not be a pointer to a stack variable;
+it may however be a pointer to a heap variable or a global variable.
 .SH SEE ALSO
 .BR _exit (2),
 .BR atexit (3),