Plan 9 from Bell Labs’s /usr/web/sources/patch/maybe/ape-updates/exit.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#include <unistd.h>
#include <stdlib.h>

void (*_atexitfns[ATEXIT_MAX])(void);

void
_doatexits(void)
{
	int i;
	void (*f)(void);

	for(i = ATEXIT_MAX-1; i >= 0; i--)
		if(_atexitfns[i]){
			f = _atexitfns[i];
			_atexitfns[i] = NULL;	/* self defense against bozos */
			(*f)();
		}
}

void exit(int status)
{
	_doatexits();
	_exit(status);
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.