shithub: scc

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