/* kcore/stop.fn.c - kstop() * ~ lexi hale * this file defines a function that prematurely exits from * a running libk program with an appropriate exit status. */ #include #include // so we know what system this is #include #ifdef KFenv_posix # define KFplatform_define_types # define KFplatform_define_constants # include #endif /* this manual redefinition is necessary to stop gcc * bitching that kstop returns, which it def does not */ 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 }