2005-04-21 16:53:53 +02:00
|
|
|
#define _exit __exit
|
|
|
|
#include <lib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
PUBLIC void _exit(status)
|
|
|
|
int status;
|
|
|
|
{
|
2005-10-21 13:19:35 +02:00
|
|
|
void (*suicide)(void);
|
2005-04-21 16:53:53 +02:00
|
|
|
message m;
|
|
|
|
|
|
|
|
m.m1_i1 = status;
|
|
|
|
_syscall(MM, EXIT, &m);
|
2005-10-21 13:19:35 +02:00
|
|
|
|
|
|
|
/* 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(;;) { }
|
2005-04-21 16:53:53 +02:00
|
|
|
}
|
2005-10-21 13:19:35 +02:00
|
|
|
|