shithub: scc

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