diff options
Diffstat (limited to 'sys/rt/exit.c')
-rw-r--r-- | sys/rt/exit.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/sys/rt/exit.c b/sys/rt/exit.c index 55a684a..e6027b7 100644 --- a/sys/rt/exit.c +++ b/sys/rt/exit.c @@ -1,15 +1,27 @@ +#include <u.h> #include <rt.h> -#include <sys.h> +#include <syscall.h> -void -rt·exit(int code) +/* XXX: + * if we are here, we are in charge, call exit syscalls + * think of better way to encapsulate these syscalls? + */ +static noreturn void +rt·shutdown(int code) { if(rt·context.fini) rt·context.fini(); if(rt·context.exit) rt·context.exit(); - /* call exit syscalls here */ + _syscall1(·ExitGroup, code); + for(;;) + _syscall1(·Exit, code); +} +weakalias(rt·shutdown, exit); - for(;;); +noreturn void +rt·exit(int code) +{ + rt·shutdown(code); } |