ref: 63e58ec2d143083afa060d26ac15a125ffe88609
dir: /lib/c/src/atexit.c/
#include <stdlib.h> #include <errno.h> #undef atexit extern void (*_exitf[_ATEXIT_MAX])(void); extern unsigned _exitn; int atexit(void (*fun)(void)) { if (_exitn == _ATEXIT_MAX) { errno = ENOMEN; return -1; } _exitf[_exitn++] = fun; return 0; }