/* arch/posix.h - posix constants
* ? this file defines posix magic numbers
* needed in syscalls, both cross-platform
* ones and os-dependent ones. note that
* the values may change depending on the
* OS specified! */
#ifndef KIplatform_posix
#define KIplatform_posix
#include <k/def.h>
#include <k/type.h>
#if (!defined(KFplatform_define_constants)) && \
(!defined(KFplatform_define_types)) && \
(!defined(KFplatform_define_funcs))
#define KFplatform_define_constants
#define KFplatform_define_types
#define KFplatform_define_funcs
#endif
#ifdef KFplatform_define_constants
enum posix_prot {
posix_prot_none = 0,
posix_prot_read = 1 << 0,
posix_prot_write = 1 << 1,
posix_prot_exec = 1 << 2
};
enum posix_map {
posix_map_shared = 1,
posix_map_private = 2
};
enum posix_flag {
posix_flag_fixed = 0x10,
#if KVos == KA_os_lin
posix_flag_anonymous = 0x20,
#elif KVos == KA_os_fbsd
posix_flag_anonymous = 0x1000,
#endif
/* platform flags */
posix_flag_linux_hugetlb = 0x40000
};
enum posix_signal {
/* these numbers appear to be consistent across all
* platforms; we may have to specialize them if this
* assumption turns out to be untrue however. */
posix_signal_hangup = 1,
posix_signal_interrupt = 2,
posix_signal_quit = 3,
posix_signal_illegal = 4,
posix_signal_trap = 5,
posix_signal_abort = 6,
posix_signal_bus = 7,
posix_signal_float = 8,
posix_signal_kill = 9,
posix_signal_user_a = 10,
posix_signal_user_b = 12,
posix_signal_segfault = 11,
posix_signal_pipe = 13,
posix_signal_alarm = 14,
posix_signal_terminate = 15,
posix_signal_stack_fault = 16,
posix_signal_child = 17,
posix_signal_continue = 18,
posix_signal_stop = 19,
posix_signal_terminal_stop = 20,
posix_signal_tty_input = 21,
posix_signal_tty_output = 22,
posix_signal_io_urgent = 23,
posix_signal_limit_cpu = 24,
posix_signal_limit_space = 25,
posix_signal_vt_alarm = 26,
posix_signal_profile = 27,
posix_signal_winch = 28,
posix_signal_poll = 29,
posix_signal_power = 30,
posix_signal_system = 31,
};
#endif
#ifdef KFplatform_define_types
/* platform types */
typedef s64 k_platform_syscall_return;
typedef u64 k_platform_syscall_error;
#if KVos == KA_os_lin
typedef long k_platform_syscall_arg;
#elif KVos == KA_os_fbsd
typedef u64 k_platform_syscall_arg;
#else
/* we're going to just pick a sane
* fallback that's reasonably likely
* to work with most systems one way
* or another */
typedef unsigned long long k_platform_syscall_arg;
#endif
struct k_platform_syscall_answer {
k_platform_syscall_return ret;
k_platform_syscall_error error;
};
#endif
#if defined(KFplatform_define_constants) ||\
defined(KFplatform_define_funcs)
/* the specific system call table to use is
* selected by the build script; /arch/$target
* is set as an include directory */
# include <system_calls.h>
#endif
#ifdef KFplatform_define_funcs
volatile extern struct k_platform_syscall_answer
k_platform_syscall(volatile enum k_platform_syscall call,
volatile u8 valency, volatile k_platform_syscall_arg args[]);
#endif
#endif