9 static struct atexit
*__atexit_list
;
11 static __noreturn
on_exit_exit(int rv
)
15 for (ap
= __atexit_list
; ap
; ap
= ap
->next
) {
16 ap
->fctn(rv
, ap
->arg
); /* This assumes extra args are harmless */
22 int on_exit(void (*fctn
) (int, void *), void *arg
)
24 struct atexit
*as
= malloc(sizeof(struct atexit
));
32 as
->next
= __atexit_list
;