2004-09-09 19:46:54 +00:00
|
|
|
/*
|
|
|
|
* Implementation of __cxa_atexit.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <reent.h>
|
|
|
|
#include <sys/lock.h>
|
|
|
|
#include "atexit.h"
|
|
|
|
|
2015-12-21 11:49:28 -05:00
|
|
|
#ifdef _REENT_SMALL
|
|
|
|
|
|
|
|
#include "on_exit_args.h"
|
|
|
|
|
|
|
|
/* force linking of static instance of _on_exit_args */
|
|
|
|
const void * const __cxa_atexit_dummy = &__on_exit_args;
|
|
|
|
|
|
|
|
#endif /* def _REENT_SMALL */
|
|
|
|
|
2004-09-09 19:46:54 +00:00
|
|
|
/*
|
|
|
|
* Register a function to be performed at exit or DSO unload.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int
|
2017-12-03 21:43:30 -06:00
|
|
|
__cxa_atexit (void (*fn) (void *),
|
2017-12-03 19:31:41 -06:00
|
|
|
void *arg,
|
2004-09-09 19:46:54 +00:00
|
|
|
void *d)
|
|
|
|
{
|
2013-07-02 21:30:57 +00:00
|
|
|
#ifdef _LITE_EXIT
|
|
|
|
/* Refer to comments in __atexit.c for more details of lite exit. */
|
2017-12-03 20:53:22 -06:00
|
|
|
int __register_exitproc (int, void (*fn) (void), void *, void *)
|
2013-07-02 21:30:57 +00:00
|
|
|
__attribute__ ((weak));
|
|
|
|
|
|
|
|
if (!__register_exitproc)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
return __register_exitproc (__et_cxa, (void (*)(void)) fn, arg, d);
|
2004-09-09 19:46:54 +00:00
|
|
|
}
|