libk  platform.syscall.fn.c at [14172a910a]

File mod/kcore/platform.syscall.fn.c artifact 9c61e189e0 part of check-in 14172a910a


/* platform.syscall.fn.c
 * ~ lexi hale <lexi@hale.su>
 * this file provides a unified interface
 * to the host operating system's syscalls.
 * its function signature may vary across
 * OSes, as the details of each's syscall
 * implementation may vary drastically.
 */

#include <k/def.h>
#include <k/type.h>

#ifdef KFenv_posix
#	include <posix/posix.h>
#else
	Knoimpl(k_platform_syscall)
#endif

extern void k_platform_syscall_raw (
		k_platform_syscall_return* return_slot,
		k_platform_syscall_error*  error_no_slot,
		enum k_platform_syscall    syscall_no,
		u8                         valency,
		s64*                       args);

struct k_platform_syscall_answer
k_platform_syscall(enum k_platform_syscall call, u8 valency, s64 args[]) {
	struct k_platform_syscall_answer answer;

	k_platform_syscall_raw
		(&answer.ret,
		 &answer.error,
		 call, valency, args);

	return answer;
}