Rev | Line | |
---|
[9] | 1 | #define _exit __exit
|
---|
| 2 | #include <lib.h>
|
---|
| 3 | #include <unistd.h>
|
---|
| 4 |
|
---|
| 5 | PUBLIC void _exit(status)
|
---|
| 6 | int status;
|
---|
| 7 | {
|
---|
| 8 | void (*suicide)(void);
|
---|
| 9 | message m;
|
---|
| 10 |
|
---|
| 11 | m.m1_i1 = status;
|
---|
| 12 | _syscall(MM, EXIT, &m);
|
---|
| 13 |
|
---|
| 14 | /* If exiting nicely through PM fails for some reason, try to
|
---|
| 15 | * commit suicide. E.g., message to PM might fail due to deadlock.
|
---|
| 16 | */
|
---|
| 17 | suicide = (void (*)(void)) -1;
|
---|
| 18 | suicide();
|
---|
| 19 |
|
---|
| 20 | /* If committing suicide fails for some reason, hang. */
|
---|
| 21 | for(;;) { }
|
---|
| 22 | }
|
---|
| 23 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.