minix/lib/libc/posix/__exit.c
2010-06-08 13:58:01 +00:00

23 lines
455 B
C

#define _exit __exit
#include <lib.h>
#include <unistd.h>
PUBLIC void _exit(status)
int status;
{
void (*suicide)(void);
message m;
m.m1_i1 = status;
_syscall(PM_PROC_NR, EXIT, &m);
/* If exiting nicely through PM fails for some reason, try to
* commit suicide. E.g., message to PM might fail due to deadlock.
*/
suicide = (void (*)(void)) -1;
suicide();
/* If committing suicide fails for some reason, hang. */
for(;;) { }
}