shithub: scc

ref: 8426988151d94d69a482e6275777d3f7275dbabe
dir: /src/libc/stdlib/atexit.c/

View raw version
#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;
}