C programs are typically exited via a call to exit(3) however it
it frequently useful to replace a running program image via a call
to one of the exec*() family functions, rather than exiting the
program via a call to exit(3).
Unfortunately, when exiting a program via a call to one of the exec*
functions, there is no obvious way to `unwind' the stack of program
finalization actions that have been built up, during program execution,
via successive calls to the atexit(3) function. Likewise there is
no easy way to insure that all open streams are properly flushed
(as would happen if exit(3) were called) prior to a call to one of
the exec* functions.
Ideally, there should be some standard C library function available
that could be called, prior to a call to one of the exec* functions,
that would invoke the set of pending atexit(3) finalization actions,
and that would also flush all open streams. In effect, what I am
requesting is a C library entry point that would invoke the following
code, copied from the current exit(3) implementation:
for (p = __atexit; p; p = p->next)
for (n = p->ind; --n >= 0;)
Move the code shown above (from the exit(3) implementation) into its
own function, make that function accessible via the standard C library
interface, and make the implementation of exit(3) call the new function
rather than having the code inline.
How-To-Repeat: This is a C library enhancement request. There is nothing to repeat.
For bugs matching the following criteria:
Status: In Progress Changed: (is less than) 2014-06-01
Reset to default assignee and clear in-progress tags.
Mail being skipped