2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
* ~ lexi hale <lexi@hale.su>
* this file defines a function that prematurely exits from
* a running libk program with an appropriate exit status. */
#include <k/core.h>
#include <k/def.h> // so we know what system this is
#include <k/type.h>
#ifdef KFenv_posix
# define STOPFN kio_posix_exit
extern noreturn void STOPFN(int);
#else
Knoimpl(kstop)
#endif
noreturn void kstop (stat_long code) { STOPFN(code); }
|
>
>
>
>
>
>
>
>
>
>
|
<
<
>
>
|
|
|
|
<
>
|
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
|
* ~ lexi hale <lexi@hale.su>
* this file defines a function that prematurely exits from
* a running libk program with an appropriate exit status. */
#include <k/core.h>
#include <k/def.h> // so we know what system this is
#include <k/type.h>
#ifdef KFenv_posix
# define KFplatform_define_types
# define KFplatform_define_constants
# include <posix.h>
#endif
noreturn extern struct k_platform_syscall_answer
k_platform_syscall(enum k_platform_syscall call, u8 valency,
k_platform_syscall_arg args[]);
noreturn void kstop(stat_long code) {
# ifdef KFenv_posix
k_platform_syscall_arg exit_code[] = { code };
k_platform_syscall(k_platform_syscall_exit, 1, exit_code);
# else
Knoimpl(kstop)
# endif
}
|