aboutsummaryrefslogtreecommitdiff
path: root/sys/rt/exit.c
blob: e6027b7a93319665a7587575016c66b5b0ea7593 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <u.h>
#include <rt.h>
#include <syscall.h>

/* 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();

	_syscall1(·ExitGroup, code);
    for(;;)
		_syscall1(·Exit, code);
}
weakalias(rt·shutdown, exit);

noreturn void
rt·exit(int code)
{
	rt·shutdown(code);
}