some coverity fixes.
[minix.git] / lib / libc / sys-minix / _exit.c
blob3cd818d984630a1cc2be4deb013c548158f635d6
1 #include <sys/cdefs.h>
2 #include "namespace.h"
3 #include <lib.h>
5 #include <unistd.h>
7 #ifdef __weak_alias
8 __weak_alias(_exit, __exit)
9 #endif
11 __dead void _exit(status)
12 int status;
14 void (*suicide)(void);
15 message m;
17 m.m1_i1 = status;
18 _syscall(PM_PROC_NR, EXIT, &m);
20 /* If exiting nicely through PM fails for some reason, try to
21 * commit suicide. E.g., message to PM might fail due to deadlock.
23 suicide = (void (*)(void)) -1;
24 suicide();
26 /* If committing suicide fails for some reason, hang. */
27 for(;;) { }