ref: b589353e707d07bf1412c206e9e5cfa876e57400
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; }