Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Implementation of __cxa_atexit.
  3.  */
  4.  
  5. #include <stddef.h>
  6. #include <stdlib.h>
  7. #include <reent.h>
  8. #include <sys/lock.h>
  9. #include "atexit.h"
  10.  
  11. #ifdef _REENT_SMALL
  12.  
  13. #include "on_exit_args.h"
  14.  
  15. /* force linking of static instance of _on_exit_args */
  16. const void * const __cxa_atexit_dummy = &__on_exit_args;
  17.  
  18. #endif  /* def _REENT_SMALL */
  19.  
  20. /*
  21.  * Register a function to be performed at exit or DSO unload.
  22.  */
  23.  
  24. int
  25. _DEFUN (__cxa_atexit,
  26.         (fn, arg, d),
  27.         void (*fn) (void *) _AND
  28.         void *arg _AND
  29.         void *d)
  30. {
  31. #ifdef _LITE_EXIT
  32.   /* Refer to comments in __atexit.c for more details of lite exit.  */
  33.   int __register_exitproc _PARAMS ((int, void (*fn) (void), _PTR, _PTR))
  34.     __attribute__ ((weak));
  35.  
  36.   if (!__register_exitproc)
  37.     return 0;
  38.   else
  39. #endif
  40.     return __register_exitproc (__et_cxa, (void (*)(void)) fn, arg, d);
  41. }
  42.