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