Files
sakurac/system/linux/x86_64.sakura
T
2026-11-19 04:54:17 -06:00

72 lines
2.5 KiB
Plaintext

#! @file x86_64.sakura
#! @author John Christman (sorakatadzuma@gmail.com)
#! @copyright Malunal Studios, LLC.
#! @license MIT
#!
#! Contains what `system::linux` gives of Linux on x86-64.
#!
#! What a program needs to know of Linux on x86-64: the numbers of the system
#! calls it makes, the flags that differ by processor, and
#! where `stat` writes what `file_info` is read from.
module system::linux when os == linux && arch == x86_64;
pub val call_read: i64 = 0;
pub val call_write: i64 = 1;
pub val call_open: i64 = 2;
pub val call_close: i64 = 3;
pub val call_stat: i64 = 4;
pub val call_fstat: i64 = 5;
pub val call_lstat: i64 = 6;
pub val call_poll: i64 = 7;
pub val call_lseek: i64 = 8;
pub val call_mmap: i64 = 9;
pub val call_munmap: i64 = 11;
pub val call_rt_sigaction: i64 = 13;
pub val call_rt_sigprocmask: i64 = 14;
pub val call_dup2: i64 = 33;
pub val call_nanosleep: i64 = 35;
pub val call_getpid: i64 = 39;
pub val call_fork: i64 = 57;
pub val call_execve: i64 = 59;
pub val call_wait4: i64 = 61;
pub val call_kill: i64 = 62;
pub val call_fcntl: i64 = 72;
pub val call_getcwd: i64 = 79;
pub val call_chdir: i64 = 80;
pub val call_rename: i64 = 82;
pub val call_mkdir: i64 = 83;
pub val call_rmdir: i64 = 84;
pub val call_unlink: i64 = 87;
pub val call_chmod: i64 = 90;
pub val call_fchmod: i64 = 91;
pub val call_sched_yield: i64 = 24;
pub val call_rt_sigsuspend: i64 = 130;
pub val call_gettid: i64 = 186;
pub val call_futex: i64 = 202;
pub val call_sched_getaffinity: i64 = 204;
pub val call_getdents64: i64 = 217;
pub val call_clock_gettime: i64 = 228;
pub val call_exit_group: i64 = 231;
pub val call_newfstatat: i64 = 262;
pub val call_pipe2: i64 = 293;
pub val open_directory := 0x10000u;
pub const stat_bytes: u64 = 144;
pub val stat_mode := 24u;
pub val stat_size := 48u;
pub val stat_accessed := 72u; # Seconds, then nanoseconds.
pub val stat_modified := 88u; # Seconds, then nanoseconds.
# What `fcntl` is asked: a copy of a handle at the lowest free number from
# another up, or the handle's flags, of which only close-on-exec is set.
pub val f_dupfd := 0u;
pub val f_setfd := 2u;
# How `rt_sigprocmask` changes the signals held off: adding some, or setting
# all of them.
pub val sig_block := 0u;
pub val sig_setmask := 2u;