ref: 541539b33afc0c198e44ecce36b6b0f2030c6b3b
dir: /src/libc/stdlib/atexit.c/
#include <stdlib.h> #include <errno.h> #include "../libc.h" #undef atexit int atexit(void (*fun)(void)) { if (_exitn == _ATEXIT_MAX) { errno = ENOMEM; return -1; } _exitf[_exitn++] = fun; return 0; }