core/sys/linux
linux
Types
351Address_Family
Address_Family :: Protocol_FamilySourceAddress family for the socket.
Typically there's one address family for every protocol family.Branch_Sample_Type
Branch_Sample_Type :: bit_set[Branch_Sample_Type_Bits; u64]SourceSpecifies which branches to include in branch record.
Branch_Sample_Type_Bits
Branch_Sample_Type_Bits :: enum int {
USER = 0,
KERNEL = 1,
HV = 2,
ANY = 3,
ANY_CALL = 4,
ANY_RETURN = 5,
IND_CALL = 6,
ABORT_TX = 7,
IN_TX = 8,
NO_TX = 9,
COND = 10,
CALL_STACK = 11,
IND_JUMP = 12,
CALL = 13,
NO_FLAGS = 14,
NO_CYCLES = 15,
TYPE_SAVE = 16,
HW_INDEX = 17,
PRIV_SAVE = 18,
}SourceBits for Branch_Sample_Type
Clock_Id
Clock_Id :: enum int {
REALTIME = 0,
MONOTONIC = 1,
PROCESS_CPUTIME_ID = 2,
THREAD_CPUTIME_ID = 3,
MONOTONIC_RAW = 4,
REALTIME_COARSE = 5,
MONOTONIC_COARSE = 6,
BOOTTIME = 7,
REALTIME_ALARM = 8,
BOOTTIME_ALARM = 9,
}SourceClock IDs for various system clocks.
Clock_State
Clock_State :: enum i32 {
TIME_OK = 0,
TIME_INS = 1,
TIME_DEL = 2,
TIME_OOP = 3,
TIME_WAIT = 4,
TIME_ERROR = 5,
}SourceClose_Range_Flags
Close_Range_Flags :: bit_set[Close_Range_Flags_Bits; u32]SourceFlags for close_range(2).
Close_Range_Flags_Bits
Close_Range_Flags_Bits :: enum int {
CLOEXEC = 2,
UNSHARE = 1,
}SourceBits for Close_Range_Flags
Cpu_Set
Cpu_Set :: Cpu_SetSourceDev
Dev :: u64SourceType for storage device handle.
Dirent
Dirent :: struct {
ino: Inode,
off: i64,
reclen: u16,
type: Dirent_Type,
name: [0]u8,
}SourceDirectory entry record.
Recommended to iterate these with `dirent_iterate_buf()`,
and obtain the name via `dirent_name()`.Dirent_Type
Dirent_Type :: enum u8 {
UNKNOWN = 0,
FIFO = 1,
CHR = 2,
DIR = 4,
BLK = 6,
REG = 8,
LNK = 10,
SOCK = 12,
WHT = 14,
}SourceType of the file in a directory entry
EPoll_Ctl_Opcode
EPoll_Ctl_Opcode :: enum i32 {
ADD = 1,
DEL = 2,
MOD = 3,
}SourceEPoll_Data
EPoll_Data :: struct #raw_union {
ptr: rawptr,
fd: Fd,
u32: u32,
u64: u64,
}SourceEPoll_Event
EPoll_Event :: struct #packed {
events: EPoll_Event_Set,
data: EPoll_Data,
}SourceEPoll_Event_Kind
EPoll_Event_Kind :: enum u32 {
IN = log2(0x001),
PRI = log2(0x002),
OUT = log2(0x004),
RDNORM = log2(0x040),
RDBAND = log2(0x080),
WRNORM = log2(0x100),
WRBAND = log2(0x200),
MSG = log2(0x400),
ERR = log2(0x008),
HUP = log2(0x010),
RDHUP = log2(0x2000),
EXCLUSIVE = log2(1<<28),
WAKEUP = log2(1<<29),
ONESHOT = log2(1<<30),
ET = log2(1<<31),
}SourceEPoll_Event_Set
EPoll_Event_Set :: bit_set[EPoll_Event_Kind; u32]SourceEPoll_Flags
EPoll_Flags :: bit_set[EPoll_Flags_Bits; i32]SourceFlags for epoll_create(2) syscall.
EPoll_Flags_Bits
EPoll_Flags_Bits :: enum int {
FDCLOEXEC = 19,
}SourceBits for epoll_create(2) flags.
Errno
Errno :: enum i32 {
NONE = 0,
// Errno-base
EPERM = 1,
ENOENT = 2,
ESRCH = 3,
EINTR = 4,
EIO = 5,
ENXIO = 6,
E2BIG = 7,
ENOEXEC = 8,
EBADF = 9,
ECHILD = 10,
EAGAIN = 11,
ENOMEM = 12,
EACCES = 13,
EFAULT = 14,
ENOTBLK = 15,
EBUSY = 16,
EEXIST = 17,
EXDEV = 18,
ENODEV = 19,
ENOTDIR = 20,
EISDIR = 21,
EINVAL = 22,
ENFILE = 23,
EMFILE = 24,
ENOTTY = 25,
ETXTBSY = 26,
EFBIG = 27,
ENOSPC = 28,
ESPIPE = 29,
EROFS = 30,
EMLINK = 31,
EPIPE = 32,
EDOM = 33,
ERANGE = 34,
// Linux
EDEADLK = 35,
ENAMETOOLONG = 36,
ENOLCK = 37,
ENOSYS = 38,
ENOTEMPTY = 39,
ELOOP = 40,
EUNKNOWN_41 = 41,
ENOMSG = 42,
EIDRM = 43,
ECHRNG = 44,
EL2NSYNC = 45,
EL3HLT = 46,
EL3RST = 47,
ELNRNG = 48,
EUNATCH = 49,
ENOCSI = 50,
EL2HLT = 51,
EBADE = 52,
EBADR = 53,
EXFULL = 54,
ENOANO = 55,
EBADRQC = 56,
EBADSLT = 57,
EUNKNOWN_58 = 58,
EBFONT = 59,
ENOSTR = 60,
ENODATA = 61,
ETIME = 62,
ENOSR = 63,
ENONET = 64,
ENOPKG = 65,
EREMOTE = 66,
ENOLINK = 67,
EADV = 68,
ESRMNT = 69,
ECOMM = 70,
EPROTO = 71,
EMULTIHOP = 72,
EDOTDOT = 73,
EBADMSG = 74,
EOVERFLOW = 75,
ENOTUNIQ = 76,
EBADFD = 77,
EREMCHG = 78,
ELIBACC = 79,
ELIBBAD = 80,
ELIBSCN = 81,
ELIBMAX = 82,
ELIBEXEC = 83,
EILSEQ = 84,
ERESTART = 85,
ESTRPIPE = 86,
EUSERS = 87,
ENOTSOCK = 88,
EDESTADDRREQ = 89,
EMSGSIZE = 90,
EPROTOTYPE = 91,
ENOPROTOOPT = 92,
EPROTONOSUPPORT = 93,
ESOCKTNOSUPPORT = 94,
EOPNOTSUPP = 95,
EPFNOSUPPORT = 96,
EAFNOSUPPORT = 97,
EADDRINUSE = 98,
EADDRNOTAVAIL = 99,
ENETDOWN = 100,
ENETUNREACH = 101,
ENETRESET = 102,
ECONNABORTED = 103,
ECONNRESET = 104,
ENOBUFS = 105,
EISCONN = 106,
ENOTCONN = 107,
ESHUTDOWN = 108,
ETOOMANYREFS = 109,
ETIMEDOUT = 110,
ECONNREFUSED = 111,
EHOSTDOWN = 112,
EHOSTUNREACH = 113,
EALREADY = 114,
EINPROGRESS = 115,
ESTALE = 116,
EUCLEAN = 117,
ENOTNAM = 118,
ENAVAIL = 119,
EISNAM = 120,
EREMOTEIO = 121,
EDQUOT = 122,
ENOMEDIUM = 123,
EMEDIUMTYPE = 124,
ECANCELED = 125,
ENOKEY = 126,
EKEYEXPIRED = 127,
EKEYREVOKED = 128,
EKEYREJECTED = 129,
EOWNERDEAD = 130,
ENOTRECOVERABLE = 131,
ERFKILL = 132,
EHWPOISON = 133,
// Errno aliases
EWOULDBLOCK = EAGAIN,
EDEADLOCK = EDEADLK,
}SourceRepresents an error returned by most of syscalls
Eventfd_Flags
Eventfd_Flags :: bit_set[Eventfd_Flags_Bits; i32]SourceEventfd_Flags_Bits
Eventfd_Flags_Bits :: enum int {
SEMAPHORE = 0,
CLOEXEC = auto_cast Open_Flags_Bits.CLOEXEC,
NONBLOCK = auto_cast Open_Flags_Bits.NONBLOCK,
}SourceExecveat_Flags
Execveat_Flags :: bit_set[Execveat_Flags_Bits; i32]SourceFlags for execveat(2) syscall.
Execveat_Flags_Bits
Execveat_Flags_Bits :: enum int {
AT_SYMLINK_NOFOLLOW = 8,
AT_EMPTY_PATH = 12,
}SourceBits for execveat(2) flags.
FCntl_Command
FCntl_Command :: enum int {
DUPFD = 0,
GETFD = 1,
SETFD = 2,
GETFL = 3,
SETFL = 4,
GETLK = 5,
SETLK = 6,
SETLKW = 7,
SETOWN = 8,
GETOWN = 9,
SETSIG = 10,
GETSIG = 11,
SETOWN_EX = 15,
GETOWN_EX = 16,
// OFD_GETLK = 36,
// OFD_SETLK = 37,
// OFD_SETLKW = 38,
SETLEASE = 1024,
GETLEASE = 1025,
NOTIFY = 1026,
DUPFD_CLOEXEC = 1030,
SETPIPE_SZ = 1031,
GETPIPE_SZ = 1032,
ADD_SEALS = 1033,
GET_SEALS = 1034,
GET_RW_HINT = 1035,
SET_RW_HINT = 1036,
GET_FILE_RW_HINT = 1037,
SET_FILE_RW_HINT = 1038,
}SourceCommand for fcntl(2)
FCntl_Command_ADD_SEALS
FCntl_Command_ADD_SEALS :: FCntl_CommandSourceFCntl_Command_DUPFD
FCntl_Command_DUPFD :: FCntl_CommandSourceFCntl_Command_DUPFD_CLOEXEC
FCntl_Command_DUPFD_CLOEXEC :: FCntl_CommandSourceFCntl_Command_GETFD
FCntl_Command_GETFD :: FCntl_CommandSourceFCntl_Command_GETFL
FCntl_Command_GETFL :: FCntl_CommandSourceFCntl_Command_GETLEASE
FCntl_Command_GETLEASE :: FCntl_CommandSourceFCntl_Command_GETLK
FCntl_Command_GETLK :: FCntl_CommandSourceFCntl_Command_GETOWN
FCntl_Command_GETOWN :: FCntl_CommandSourceFCntl_Command_GETOWN_EX
FCntl_Command_GETOWN_EX :: FCntl_CommandSourceFCntl_Command_GETPIPE_SZ
FCntl_Command_GETPIPE_SZ :: FCntl_CommandSourceFCntl_Command_GETSIG
FCntl_Command_GETSIG :: FCntl_CommandSourceFCntl_Command_GET_FILE_RW_HINT
FCntl_Command_GET_FILE_RW_HINT :: FCntl_CommandSourceFCntl_Command_GET_RW_HINT
FCntl_Command_GET_RW_HINT :: FCntl_CommandSourceFCntl_Command_GET_SEALS
FCntl_Command_GET_SEALS :: FCntl_CommandSourceFCntl_Command_NOTIFY
FCntl_Command_NOTIFY :: FCntl_CommandSourceFCntl_Command_SETFD
FCntl_Command_SETFD :: FCntl_CommandSourceFCntl_Command_SETFL
FCntl_Command_SETFL :: FCntl_CommandSourceFCntl_Command_SETLEASE
FCntl_Command_SETLEASE :: FCntl_CommandSourceFCntl_Command_SETLK
FCntl_Command_SETLK :: FCntl_CommandSourceFCntl_Command_SETLKW
FCntl_Command_SETLKW :: FCntl_CommandSourceFCntl_Command_SETOWN
FCntl_Command_SETOWN :: FCntl_CommandSourceFCntl_Command_SETOWN_EX
FCntl_Command_SETOWN_EX :: FCntl_CommandSourceFCntl_Command_SETPIPE_SZ
FCntl_Command_SETPIPE_SZ :: FCntl_CommandSourceFCntl_Command_SETSIG
FCntl_Command_SETSIG :: FCntl_CommandSourceFCntl_Command_SET_FILE_RW_HINT
FCntl_Command_SET_FILE_RW_HINT :: FCntl_CommandSourceFCntl_Command_SET_RW_HINT
FCntl_Command_SET_RW_HINT :: FCntl_CommandSourceFD_Flags
FD_Flags :: bit_set[FD_Flags_Bits; i32]SourceFlags for the file descriptors.
FD_Flags_Bits
FD_Flags_Bits :: enum int {
SYMLINK_NOFOLLOW = 8,
REMOVEDIR = 9,
EACCESS = 9,
SYMLINK_FOLLOW = 10,
NO_AUTOMOUNT = 11,
EMPTY_PATH = 12,
STATX_FORCE_SYNC = 13,
STATX_DONT_SYNC = 14,
RECURSIVE = 15,
}SourceBits for FD_Flags bitset
FD_Lease
FD_Lease :: enum int {
RDLCK = 0,
WRLCK = 1,
UNLCK = 2,
}SourceFD_Notifications
FD_Notifications :: bit_set[FD_Notifications_Bits; i32]SourceFlags for fcntl_notify().
FD_Notifications_Bits
FD_Notifications_Bits :: enum i32 {
ACCESS = 0,
MODIFY = 1,
CREATE = 2,
DELETE = 3,
RENAME = 4,
ATTRIB = 5,
MULTISHOT = 31,
}SourceBits for FD_Notifications
FLock
FLock :: struct {
type: FLock_Type,
whence: Seek_Whence,
start: i64,
len: i64,
pid: Pid,
}SourceLock record for fcntl(2).
FLock_Op
FLock_Op :: bit_set[FLock_Op_Bits; i32]SourceFile locking operations.
Use one of `EX`, `RW` or `UN` to specify the operation, and add `UN` if
you need a non-blocking operation.FLock_Op_Bits
FLock_Op_Bits :: enum i32 {
SH = 0,
EX = 1,
NB = 2,
UN = 3,
}SourceFile locking operation bits
FLock_Type
FLock_Type :: enum i16 {
RDLCK = 0,
WRLCK = 1,
UNLCK = 2,
}SourceType of a lock for fcntl(2)
FS_Flags
FS_Flags :: bit_set[FS_Flags_Bits; u32]SourceMount flags for filesystem.
FS_Flags_Bits
FS_Flags_Bits :: enum int {
RDONLY = 0,
NOSUID = 1,
NODEV = 2,
NOEXEC = 3,
SYNCHRONOUS = 4,
VALID = 5,
MANDLOCK = 6,
NOATIME = 10,
NODIRATIME = 11,
RELATIME = 12,
NOSYMFOLLOW = 13,
}SourceBits for FS_Flags bitset
FS_Magic
FS_Magic :: enum u32 {
ADFS_SUPER_MAGIC = 44533,
AFFS_SUPER_MAGIC = 44543,
AFS_SUPER_MAGIC = 1397113167,
ANON_INODE_FS_MAGIC = 151263540,
AUTOFS_SUPER_MAGIC = 391,
BDEVFS_MAGIC = 1650746742,
BEFS_SUPER_MAGIC = 1111905073,
BFS_MAGIC = 464386766,
BINFMTFS_MAGIC = 1112100429,
BPF_FS_MAGIC = 3405662737,
BTRFS_SUPER_MAGIC = 2435016766,
BTRFS_TEST_MAGIC = 1936880249,
CGROUP_SUPER_MAGIC = 2613483,
CGROUP2_SUPER_MAGIC = 1667723888,
CIFS_MAGIC_NUMBER = 4283649346,
CODA_SUPER_MAGIC = 1937076805,
COH_SUPER_MAGIC = 19920823,
CRAMFS_MAGIC = 684539205,
DEBUGFS_MAGIC = 1684170528,
DEVFS_SUPER_MAGIC = 4979,
DEVPTS_SUPER_MAGIC = 7377,
ECRYPTFS_SUPER_MAGIC = 61791,
EFIVARFS_MAGIC = 3730735588,
EFS_SUPER_MAGIC = 4278867,
EXT_SUPER_MAGIC = 4989,
EXT2_OLD_SUPER_MAGIC = 61265,
EXT2_SUPER_MAGIC = 61267,
EXT3_SUPER_MAGIC = 61267,
EXT4_SUPER_MAGIC = 61267,
F2FS_SUPER_MAGIC = 4076150800,
FUSE_SUPER_MAGIC = 1702057286,
FUTEXFS_SUPER_MAGIC = 195894762,
HFS_SUPER_MAGIC = 16964,
HOSTFS_SUPER_MAGIC = 12648430,
HPFS_SUPER_MAGIC = 4187351113,
HUGETLBFS_MAGIC = 2508478710,
ISOFS_SUPER_MAGIC = 38496,
JFFS2_SUPER_MAGIC = 29366,
JFS_SUPER_MAGIC = 827541066,
MINIX_SUPER_MAGIC = 4991,
MINIX_SUPER_MAGIC2 = 5007,
MINIX2_SUPER_MAGIC = 9320,
MINIX2_SUPER_MAGIC2 = 9336,
MINIX3_SUPER_MAGIC = 19802,
MQUEUE_MAGIC = 427819522,
MSDOS_SUPER_MAGIC = 19780,
MTD_INODE_FS_MAGIC = 288389204,
NCP_SUPER_MAGIC = 22092,
NFS_SUPER_MAGIC = 26985,
NILFS_SUPER_MAGIC = 13364,
NSFS_MAGIC = 1853056627,
NTFS_SB_MAGIC = 1397118030,
OCFS2_SUPER_MAGIC = 1952539503,
OPENPROM_SUPER_MAGIC = 40865,
OVERLAYFS_SUPER_MAGIC = 2035054128,
PIPEFS_MAGIC = 1346981957,
PROC_SUPER_MAGIC = 40864,
PSTOREFS_MAGIC = 1634035564,
QNX4_SUPER_MAGIC = 47,
QNX6_SUPER_MAGIC = 1746473250,
RAMFS_MAGIC = 2240043254,
REISERFS_SUPER_MAGIC = 1382369651,
ROMFS_MAGIC = 29301,
SECURITYFS_MAGIC = 1935894131,
SELINUX_MAGIC = 4185718668,
SMACK_MAGIC = 1128357203,
SMB_SUPER_MAGIC = 20859,
SMB2_MAGIC_NUMBER = 4266872130,
SOCKFS_MAGIC = 1397703499,
SQUASHFS_MAGIC = 1936814952,
SYSFS_MAGIC = 1650812274,
SYSV2_SUPER_MAGIC = 19920822,
SYSV4_SUPER_MAGIC = 19920821,
TMPFS_MAGIC = 16914836,
TRACEFS_MAGIC = 1953653091,
UDF_SUPER_MAGIC = 352400198,
UFS_MAGIC = 72020,
USBDEVICE_SUPER_MAGIC = 40866,
V9FS_MAGIC = 16914839,
VXFS_SUPER_MAGIC = 2768370933,
XENFS_SUPER_MAGIC = 2881100148,
XENIX_SUPER_MAGIC = 19920820,
XFS_SUPER_MAGIC = 1481003842,
_XIAFS_SUPER_MAGIC = 19911021,
}SourceMagic bits for filesystems returned by Stat_FS
F_Owner
F_Owner :: struct {
type: F_Owner_Type,
pid: Pid,
}SourceRepresents owner that receives events on file updates.
F_Owner_Type
F_Owner_Type :: enum i32 {
OWNER_TID = 0,
OWNER_PID = 1,
OWNER_PGRP = 2,
}SourceKind of owner for FD_Owner
Fd
Fd :: i32SourceRepresents a file descriptor.
Fd_Poll_Events
Fd_Poll_Events :: bit_set[Fd_Poll_Events_Bits; u16]SourceEvents for ppoll(2).
Fd_Poll_Events_Bits
Fd_Poll_Events_Bits :: enum int {
IN = 0,
PRI = 1,
OUT = 2,
ERR = 3,
HUP = 4,
NVAL = 5,
RDNORM = 6,
RDBAND = 7,
WRNORM = 8,
WRBAND = 9,
MSG = 10,
REMOVE = 12,
RDHUP = 13,
}SourceFutex
Futex :: u32SourceJust an alias to make futex-values more visible
Futex_Arg_Op
Futex_Arg_Op :: enum int {
SET = 0, // uaddr2 = oparg
ADD = 1, // uaddr2 += oparg
OR = 2, // uaddr2 |= oparg
ANDN = 3, // uaddr2 &= ~oparg
XOR = 4, // uaddr2 ^= oparg
PO2_SET = 0, // uaddr2 = 1<<oparg
PO2_ADD = 1, // uaddr2 += 1<<oparg
PO2_OR = 2, // uaddr2 |= 1<<oparg
PO2_ANDN = 3, // uaddr2 &~= 1<<oparg
PO2_XOR = 4, // uaddr2 ^= 1<<oparg
}SourceKind of operation on futex, see FUTEX_WAKE_OP
Futex_Cmp_Op
Futex_Cmp_Op :: enum int {
EQ = 0, // if (oldval == cmparg) wake
NE = 1, // if (oldval != cmparg) wake
LT = 2, // if (oldval < cmparg) wake
LE = 3, // if (oldval <= cmparg) wake
GT = 4, // if (oldval > cmparg) wake
GE = 5, // if (oldval >= cmparg) wake
}SourceKind of comparison operation on futex, see FUTEX_WAKE_OP
Futex_Cmp_Requeue_Type
Futex_Cmp_Requeue_Type :: Futex_OpSourceFutex_Cmp_requeue_Pi_Type
Futex_Cmp_requeue_Pi_Type :: Futex_OpSourceFutex_Fd_Type
Futex_Fd_Type :: Futex_OpSourceFutex_Flags
Futex_Flags :: bit_set[Futex_Flags_Bits; u32]SourceFlags for the futex (they are kept separately)
Futex_Flags_Bits
Futex_Flags_Bits :: enum int {
PRIVATE = 7,
REALTIME = 8,
}SourceBits for Futex_Flags
Futex_Lock_Pi2_Type
Futex_Lock_Pi2_Type :: Futex_OpSourceFutex_Lock_Pi_Type
Futex_Lock_Pi_Type :: Futex_OpSourceFutex_Op
Futex_Op :: enum u32 {
WAIT = 0,
WAKE = 1,
FD = 2,
REQUEUE = 3,
CMP_REQUEUE = 4,
WAKE_OP = 5,
LOCK_PI = 6,
UNLOCK_PI = 7,
TRYLOCK_PI = 8,
WAIT_BITSET = 9,
WAKE_BITSET = 10,
WAIT_REQUEUE_PI = 11,
CMP_REQUEUE_PI = 12,
LOCK_PI2 = 13,
}SourceSecond argument to futex(2) syscall
Futex_Requeue_Type
Futex_Requeue_Type :: Futex_OpSourceFutex_Trylock_Pi_Type
Futex_Trylock_Pi_Type :: Futex_OpSourceFutex_Unlock_Pi_Type
Futex_Unlock_Pi_Type :: Futex_OpSourceFutex_Wait_Bitset_Type
Futex_Wait_Bitset_Type :: Futex_OpSourceFutex_Wait_Type
Futex_Wait_Type :: Futex_OpSourceFutex_Wait_requeue_Pi_Type
Futex_Wait_requeue_Pi_Type :: Futex_OpSourceFutex_Wake_Bitset_Type
Futex_Wake_Bitset_Type :: Futex_OpSourceFutex_Wake_Op_Type
Futex_Wake_Op_Type :: Futex_OpSourceFutex_Wake_Type
Futex_Wake_Type :: Futex_OpSourceGet_Random_Flags
Get_Random_Flags :: bit_set[Get_Random_Flags_Bits; i32]SourceFlags for getrandom(2) syscall.
Get_Random_Flags_Bits
Get_Random_Flags_Bits :: enum int {
RANDOM = 0,
NONBLOCK = 1,
INSECURE = 2,
}SourceBits for Get_Random_Flags
Gid
Gid :: u32SourceType for 32-bit Group IDs.
Hardware_Breakpoint_Type
Hardware_Breakpoint_Type :: enum u32 {
EMPTY = 0,
R = 1,
W = 2,
X = 4,
RW = R | W,
INVALID = RW | X,
}SourceChooses the breakpoint type
IO_CQ_Ring_Offsets
IO_CQ_Ring_Offsets :: struct {
head: u32,
tail: u32,
ring_mask: u32,
ring_entries: u32,
overflow: u32,
cqes: u32,
flags: u32,
resv1: u32,
user_addr: u64,
}SourceIO_SQ_Ring_Offsets
IO_SQ_Ring_Offsets :: struct {
head: u32,
tail: u32,
ring_mask: u32,
ring_entries: u32,
flags: u32,
dropped: u32,
array: u32,
resv1: u32,
user_addr: u64,
}SourceIO_Uring_Accept_Flags
IO_Uring_Accept_Flags :: bit_set[IO_Uring_Accept_Flags_Bits; u16]SourceIO_Uring_Accept_Flags_Bits
IO_Uring_Accept_Flags_Bits :: enum int {
MULTISHOT = 0,
}SourceIO_Uring_CQE
IO_Uring_CQE :: struct {
// sq.data submission passed back.
user_data: u64,
// result code for this event.
res: i32,
flags: IO_Uring_CQE_Flags,
}SourceThe completion queue entry when the .CQE32 flag is not set on setup.
IO_Uring_CQE32
IO_Uring_CQE32 :: struct {
_: IO_Uring_CQE,
pad: u64,
pad2: u64,
}SourceThe completion queue entry when the .CQE32 flag is set on setup.
IO_Uring_CQE_Flags
IO_Uring_CQE_Flags :: bit_set[IO_Uring_CQE_Flags_Bits; u32]SourceIO_Uring_CQE_Flags_Bits
IO_Uring_CQE_Flags_Bits :: enum int {
// If set, the upper 16 bits are the buffer ID.
BUFFER = 0,
// If set, parent SQE will generate more CQE entries.
MORE = 1,
// If set, more data to read after socket recv.
SOCK_NONEMPTY = 2,
// Set for notification CQEs. Can be used to distinct them from sends.
NOTIF = 3,
}SourceIO_Uring_Cmd_Flags
IO_Uring_Cmd_Flags :: bit_set[IO_Uring_Cmd_Flags_Bits; u32]SourceIO_Uring_Cmd_Flags_Bits
IO_Uring_Cmd_Flags_Bits :: enum int {
// use registered buffer; pass this flag along with setting sqe.buf_index.
FIXED = 0,
}SourceIO_Uring_Enter_Flags
IO_Uring_Enter_Flags :: bit_set[IO_Uring_Enter_Flags_Bits; u32]SourceIO_Uring_Enter_Flags_Bits
IO_Uring_Enter_Flags_Bits :: enum int {
GETEVENTS = 0,
SQ_WAKEUP = 1,
SQ_WAIT = 2,
EXT_ARG = 3, // Available since Linux 5.11
REGISTERED_RING = 4,
}SourceIO_Uring_Features
IO_Uring_Features :: bit_set[IO_Uring_Features_Bits; u32]SourceIO_Uring_Features_Bits
IO_Uring_Features_Bits :: enum int {
SINGLE_MMAP = 0,
NODROP = 1,
SUBMIT_STABLE = 2,
RW_CUR_POS = 3,
CUR_PERSONALITY = 4,
FAST_POLL = 5,
POLL_32BITS = 6,
SQPOLL_NONFIXED = 7,
EXT_ARG = 8,
NATIVE_WORKERS = 9,
RSRC_TAGS = 10,
}SourceIO_Uring_Fsync_Flags
IO_Uring_Fsync_Flags :: bit_set[IO_Uring_Fsync_Flags_Bits; u32]SourceIO_Uring_Fsync_Flags_Bits
IO_Uring_Fsync_Flags_Bits :: enum int {
DATASYNC = 0,
}SourceIO_Uring_Getevents_Arg
IO_Uring_Getevents_Arg :: struct {
sigmask: ^Sig_Set,
sigmask_sz: u32,
// pad: u32,
ts: ^Time_Spec,
}SourceIO_Uring_OP
IO_Uring_OP :: enum u8 {
NOP = 0,
READV = 1,
WRITEV = 2,
FSYNC = 3,
READ_FIXED = 4,
WRITE_FIXED = 5,
POLL_ADD = 6,
POLL_REMOVE = 7,
SYNC_FILE_RANGE = 8,
SENDMSG = 9,
RECVMSG = 10,
TIMEOUT = 11,
TIMEOUT_REMOVE = 12,
ACCEPT = 13,
ASYNC_CANCEL = 14,
LINK_TIMEOUT = 15,
CONNECT = 16,
FALLOCATE = 17,
OPENAT = 18,
CLOSE = 19,
FILES_UPDATE = 20,
STATX = 21,
READ = 22,
WRITE = 23,
FADVISE = 24,
MADVISE = 25,
SEND = 26,
RECV = 27,
OPENAT2 = 28,
EPOLL_CTL = 29,
SPLICE = 30,
PROVIDE_BUFFERS = 31,
REMOVE_BUFFERS = 32,
TEE = 33,
SHUTDOWN = 34,
RENAMEAT = 35,
UNLINKAT = 36,
MKDIRAT = 37,
SYMLINKAT = 38,
LINKAT = 39,
MSG_RING = 40,
FSETXATTR = 41,
SETXATTR = 42,
FGETXATTR = 43,
GETXATTR = 44,
SOCKET = 45,
URING_CMD = 46,
SEND_ZC = 47,
SENDMSG_ZC = 48,
READ_MULTISHOT = 49,
WAITID = 50,
FUTEX_WAIT = 51,
FUTEX_WAKE = 52,
FUTEX_WAITV = 53,
FIXED_FD_INSTALL = 54,
FTRUNCATE = 55,
BIND = 56,
LISTEN = 57,
}SourceIO_Uring_Params
IO_Uring_Params :: struct {
sq_entries: u32,
cq_entries: u32,
flags: IO_Uring_Setup_Flags,
sq_thread_cpu: u32,
sq_thread_idle: u32,
features: IO_Uring_Features,
wq_fd: u32,
resv: [3]u32,
sq_off: IO_SQ_Ring_Offsets,
cq_off: IO_CQ_Ring_Offsets,
}SourceIO_Uring_Poll_Add_Flags
IO_Uring_Poll_Add_Flags :: bit_set[IO_Uring_Poll_Add_Flags_Bits; u32]SourceIO_Uring_Poll_Add_Flags_Bits
IO_Uring_Poll_Add_Flags_Bits :: enum int {
ADD_MULTI = 0,
UPDATE_EVENTS = 1,
UPDATE_USER_DATA = 2,
ADD_LEVEL = 3,
}SourceIO_Uring_Register_Opcode
IO_Uring_Register_Opcode :: enum uint {
REGISTER_BUFFERS = 0,
UNREGISTER_BUFFERS = 1,
REGISTER_FILES = 2,
UNREGISTER_FILES = 3,
REGISTER_EVENTFD = 4,
UNREGISTER_EVENTFD = 5,
REGISTER_FILES_UPDATE = 6,
REGISTER_EVENTFD_ASYNC = 7,
REGISTER_PROBE = 8,
REGISTER_PERSONALITY = 9,
UNREGISTER_PERSONALITY = 10,
REGISTER_RESTRICTIONS = 11,
REGISTER_ENABLE_RINGS = 12,
// extended with tagging
REGISTER_FILES2 = 13,
REGISTER_FILES_UPDATE2 = 14,
REGISTER_BUFFERS2 = 15,
REGISTER_BUFFERS_UPDATE = 16,
// set/clear io-wq thread affinities
REGISTER_IOWQ_AFF = 17,
UNREGISTER_IOWQ_AFF = 18,
// set/get max number of io-wq workers
REGISTER_IOWQ_MAX_WORKERS = 19,
// register/unregister io_uring fd with the ring
REGISTER_RING_FDS = 20,
UNREGISTER_RING_FDS = 21,
// register ring based provide buffer group
REGISTER_PBUF_RING = 22,
UNREGISTER_PBUF_RING = 23,
// sync cancelation API
REGISTER_SYNC_CANCEL = 24,
// register a range of fixed file slots for automatic slot allocation
REGISTER_FILE_ALLOC_RANGE = 25,
// this goes last
REGISTER_LAST = 26,
// flag added to the opcode to use a registered ring fd
REGISTER_USE_REGISTERED_RING = 1 << 31,
}SourceIO_Uring_Rsrc_Register
IO_Uring_Rsrc_Register :: struct {}SourceIO_Uring_Rsrc_Update2
IO_Uring_Rsrc_Update2 :: struct {}SourceIO_Uring_SQE
IO_Uring_SQE :: struct {
opcode: IO_Uring_OP,
flags: IO_Uring_SQE_Flags,
__ioprio: struct #raw_union {
ioprio: u16,
sq_accept_flags: IO_Uring_Accept_Flags,
sq_send_recv_flags: IO_Uring_Send_Recv_Flags,
},
fd: Fd,
__offset: struct #raw_union {
// Offset into file.
off: u64,
addr2: u64,
_: struct {
cmd_op: u32,
__pad1: u32,
},
statx: ^Statx,
},
__iovecs: struct #raw_union {
// Pointer to buffer or iovecs.
addr: u64,
splice_off_in: u64,
_: struct {
level: u32,
optname: u32,
},
},
__len: struct #raw_union {
// Buffer size or number of iovecs.
len: u32,
poll_flags: IO_Uring_Poll_Add_Flags,
statx_mask: Statx_Mask,
epoll_ctl_op: EPoll_Ctl_Opcode,
shutdown_how: Shutdown_How,
},
__contents: struct #raw_union {
rw_flags: i32,
fsync_flags: IO_Uring_Fsync_Flags,
// compatibility.
poll_events: Fd_Poll_Events,
// word-reversed for BE.
poll32_events: u32,
sync_range_flags: u32,
msg_flags: Socket_Msg,
timeout_flags: IO_Uring_Timeout_Flags,
accept_flags: Socket_FD_Flags,
cancel_flags: u32,
open_flags: Open_Flags,
statx_flags: FD_Flags,
fadvise_advice: u32,
splice_flags: IO_Uring_Splice_Flags,
rename_flags: u32,
unlink_flags: u32,
hardlink_flags: u32,
xattr_flags: u32,
msg_ring_flags: u32,
uring_cmd_flags: IO_Uring_Cmd_Flags,
},
// Data to be passed back at completion time.
user_data: u64,
__buffer: struct #raw_union {
// Index into fixed buffers, if used.
buf_index: u16,
// For grouped buffer selection.
buf_group: u16,
},
// Personality to use, if used.
personality: u16,
_: struct #raw_union {
splice_fd_in: Fd,
file_index: u32,
_: struct {
addr_len: u16,
__pad3: [1]u16,
},
},
__: struct #raw_union {
_: struct {
addr3: u64,
__pad2: [1]u64,
},
},
}SourceThe submission queue entry when the .SQE128 flag is not set on setup.
IO_Uring_SQE128
IO_Uring_SQE128 :: struct {
_: IO_Uring_SQE,
cmd: [64]u8,
}SourceThe submission queue entry when the .SQE128 flag is set on setup.
IO_Uring_SQE_Flags
IO_Uring_SQE_Flags :: bit_set[IO_Uring_SQE_Flags_Bits; u8]SourceIO_Uring_SQE_Flags_Bits
IO_Uring_SQE_Flags_Bits :: enum int {
// Use fixed fileset.
FIXED_FILE = 0,
// Issue after inflight IO.
IO_DRAIN = 1,
// Links next sqe.
IO_LINK = 2,
// Like LINK, but stronger.
IO_HARDLINK = 3,
// Always go async.
ASYNC = 4,
// Select buffer from sq.buf_group.
BUFFER_SELECT = 5,
// Don't post CQE if request succeeded.
CQE_SKIP_SUCCESS = 6,
}SourceIO_Uring_Send_Recv_Flags
IO_Uring_Send_Recv_Flags :: bit_set[IO_Uring_Send_Recv_Flags_Bits; u16]SourceIO_Uring_Send_Recv_Flags_Bits
IO_Uring_Send_Recv_Flags_Bits :: enum int {
// If set, instead of first attempting to send
// or receive and arm poll if that yields an
// -EAGAIN result, arm poll upfront and skip
// the initial transfer attempt.
RECVSEND_POLL_FIRST = 0,
// Multishot recv. Sets IORING_CQE_F_MORE if
// the handler will continue to report
// CQEs on behalf of the same SQE.
RECV_MULTISHOT = 1,
// Use registered buffers, the index is stored in
// the buf_index field.
RECVSEND_FIXED_BUF = 2,
// If set, SEND[MSG]_ZC should report
// the zerocopy usage in cqe.res
// for the IORING_CQE_F_NOTIF cqe.
// 0 is reported if zerocopy was actually possible.
// IORING_NOTIF_USAGE_ZC_COPIED if data was copied
// (at least partially).
SEND_ZC_REPORT_USAGE = 3,
}SourceIO_Uring_Setup_Flags
IO_Uring_Setup_Flags :: bit_set[IO_Uring_Setup_Flags_Bits; u32]SourceIO_Uring_Setup_Flags_Bits
IO_Uring_Setup_Flags_Bits :: enum int {
// io_context is polled.
IOPOLL = 0,
// SQ poll thread.
SQPOLL = 1,
// sq_thread_cpu is valid.
SQ_AFF = 2,
// app defines CQ size.
CQSIZE = 3,
// clamp SQ/CQ ring sizes.
CLAMP = 4,
// attach to existing wq.
ATTACH_WQ = 5,
// start with ring disabled.
R_DISABLED = 6,
// continue submit on error.
SUBMIT_ALL = 7,
// Cooperative task running. When requests complete, they often require
// forcing the submitter to transition to the kernel to complete. If this
// flag is set, work will be done when the task transitions anyway, rather
// than force an inter-processor interrupt reschedule. This avoids interrupting
// a task running in userspace, and saves an IPI.
COOP_TASKRUN = 8,
// If COOP_TASKRUN is set, get notified if task work is available for
// running and a kernel transition would be needed to run it. This sets
// IORING_SQ_TASKRUN in the sq ring flags. Not valid with COOP_TASKRUN.
TASKRUN_FLAG = 9,
// SQEs are 128 bytes.
SQE128 = 10,
// CQEs are 32 bytes.
CQE32 = 11,
// Only one task is allowed to submit requests
SINGLE_ISSUER = 12,
// Defer running task work to get events.
// Rather than running bits of task work whenever the task transitions
// try to do it just before it is needed.
DEFER_TASKRUN = 13,
}SourceIO_Uring_Splice_Flags
IO_Uring_Splice_Flags :: bit_set[IO_Uring_Splice_Flags_Bits; u32]SourceIO_Uring_Splice_Flags_Bits
IO_Uring_Splice_Flags_Bits :: enum int {
MOVE = 0,
NONBLOCK = 1,
MORE = 2,
GIFT = 3,
F_FD_IN_FIXED = 31,
}SourceIO_Uring_Submission_Queue_Flags
IO_Uring_Submission_Queue_Flags :: bit_set[IO_Uring_Submission_Queue_Flags_Bits; u32]SourceIO_Uring_Submission_Queue_Flags_Bits
IO_Uring_Submission_Queue_Flags_Bits :: enum int {
NEED_WAKEUP = 0,
CQ_OVERFLOW = 1,
TASKRUN = 2,
}SourceIO_Uring_Timeout_Flags
IO_Uring_Timeout_Flags :: bit_set[IO_Uring_Timeout_Flags_Bits; u32]SourceIO_Uring_Timeout_Flags_Bits
IO_Uring_Timeout_Flags_Bits :: enum int {
ABS = 0,
UPDATE = 1,
BOOTTIME = 2,
REALTIME = 3,
LINK_TIMEOUT_UPDATE = 4,
ETIME_SUCCESS = 5,
}SourceIO_Vec
IO_Vec :: struct {
base: [^]u8,
len: uint,
}SourceStruct used for IO operations
IPC_Cmd
IPC_Cmd :: enum i16 {
// IPC common
IPC_RMID = 0,
IPC_SET = 1,
IPC_STAT = 2,
// Shared memory
SHM_LOCK = 11,
SHM_UNLOCK = 12,
SHM_STAT = 13,
SHM_INFO = 14,
SHM_STAT_ANY = 15,
// Semaphore
GETPID = 11,
GETVAL = 12,
GETALL = 13,
GETNCNT = 14,
GETZCNT = 15,
SETVAL = 16,
SETALL = 17,
SEM_STAT = 18,
SEM_INFO = 19,
SEM_STAT_ANY = 20,
// Message queue
MSG_STAT = 11,
MSG_INFO = 12,
MSG_STAT_ANY = 13,
}SourceIPC memory commands
IPC_Flags
IPC_Flags :: bit_set[IPC_Flags_Bits; i16]SourceAccess modes and flags used by SystemV IPC procedures.
IPC_Flags_Bits
IPC_Flags_Bits :: enum int {
// Access modes for shared memory.
WROTH = 1,
RDOTH = 2,
WRGRP = 4,
RDGRP = 5,
WRUSR = 7,
RDUSR = 8,
// Creation flags for shared memory.
IPC_CREAT = 9,
IPC_EXCL = 10,
SHM_HUGETLB = 11,
SHM_NORESERVE = 12,
// Usage flags for shared memory.
IPC_NOWAIT = 11,
SEM_UNDO = 9,
SHM_RDONLY = 12,
SHM_RND = 13,
SHM_REMAP = 14,
SHM_EXEC = 15,
MSG_NOERROR = 12,
MSG_EXCEPT = 13,
MSG_COPY = 14,
}SourceBits for SystemV IPC flags.
In this enum, access modes are common for any shared memory. Prefixed
entries (i.e. `IPC_` or `SHM_`) denote flags, where `IPC_` are common flags
for all SystemV IPC primitives, and `SHM_`, `SEM_` and `MSG_` are specific
to shared memory segments, semaphores and message queues respectively.
These bits overlap, because they are meant to be used within the
context of specific procedures. Creation flags, used for `*get` procedures,
and usage flags used by all other IPC procedures. Do not mix creation and
usage flags, as well as flags prefixed differently (excluding `IPC_`
prefix).IPC_Perm
IPC_Perm :: struct {
key: Key,
uid: u32,
gid: u32,
cuid: u32,
cgid: u32,
mode: IPC_Flags,
seq: u16,
_: [2 + 2*size_of(int)]u8,
}SourcePermissions for SystemV IPC primitives.
ITimer_Flags
ITimer_Flags :: bit_set[ITimer_Flags_Bits; u32]SourceFlags for POSIX interval timers.
ITimer_Flags_Bits
ITimer_Flags_Bits :: enum int {
ABSTIME = 0,
}SourceBits for POSIX interval timer flags.
ITimer_Spec
ITimer_Spec :: struct {
interval: Time_Spec,
value: Time_Spec,
}SourceITimer_Val
ITimer_Val :: struct {
interval: Time_Val,
value: Time_Val,
}SourceInterval timer value
ITimer_Which
ITimer_Which :: enum int {
REAL = 0,
VIRTUAL = 1,
PROF = 2,
}SourceInterval timer types
Id
Id :: uintSourceType for any of: pid, pidfd, pgid.
Id_Type
Id_Type :: enum uint {
ALL = 0,
PID = 1,
PGID = 2,
PIDFD = 3,
}SourceRepresent the type of Id
Inode
Inode :: u64SourceType for 64-bit inode number for files.
Used pretty much only in struct Stat64 for 32-bit platforms.Inotify_Event
Inotify_Event :: struct {
wd: Wd,
mask: Inotify_Event_Mask,
cookie: u32,
len: u32,
name: [0]u8,
}SourceInotify_Event_Bits
Inotify_Event_Bits :: enum u32 {
ACCESS = 0,
MODIFY = 1,
ATTRIB = 2,
CLOSE_WRITE = 3,
CLOSE_NOWRITE = 4,
OPEN = 5,
MOVED_FROM = 6,
MOVED_TO = 7,
CREATE = 8,
DELETE = 9,
DELETE_SELF = 10,
MOVE_SELF = 11,
UNMOUNT = 13,
Q_OVERFLOW = 14,
IGNORED = 15,
ONLYDIR = 24,
DONT_FOLLOW = 25,
EXCL_UNLINK = 26,
MASK_CREATE = 28,
MASK_ADD = 29,
ISDIR = 30,
ONESHOT = 31,
}SourceInotify_Event_Mask
Inotify_Event_Mask :: bit_set[Inotify_Event_Bits; u32]SourceInotify_Init_Bits
Inotify_Init_Bits :: enum int {
NONBLOCK = 11,
CLOEXEC = 19,
}SourceInotify_Init_Flags
Inotify_Init_Flags :: bit_set[Inotify_Init_Bits; i32]SourceKey
Key :: i32SourceShared memory identifiers used by shmget(2) and other calls.
MAdvice
MAdvice :: enum int {
NORMAL = 0,
RANDOM = 1,
SEQUENTIAL = 2,
WILLNEED = 3,
DONTNEED = 4,
FREE = 8,
REMOVE = 9,
DONTFORK = 10,
DOFORK = 11,
MERGEABLE = 12,
UNMERGEABLE = 13,
HUGEPAGE = 14,
NOHUGEPAGE = 15,
DONTDUMP = 16,
DODUMP = 17,
WIPEONFORK = 18,
KEEPONFORK = 19,
COLD = 20,
PAGEOUT = 21,
POPULATE_READ = 22,
POPULATE_WRITE = 23,
DONTNEED_LOCKED = 24,
COLLAPSE = 25,
HWPOISON = 100,
SOFT_OFFLINE = 101,
}SourceArgument for madvice(2)
MLock_Flags
MLock_Flags :: bit_set[MLock_Flags_Bits; u32]SourceFlags for mlock(2).
MLock_Flags_Bits
MLock_Flags_Bits :: enum int {
ONFAULT = 0,
}SourceBits for MLock_Flags
MMsg_Hdr
MMsg_Hdr :: struct {
hdr: Msg_Hdr,
len: u32,
}SourceMultiple message header for sendmmsg/recvmmsg
MRemap_Flags
MRemap_Flags :: bit_set[MRemap_Flags_Bits; i32]SourceFlags for mremap(2).
MRemap_Flags_Bits
MRemap_Flags_Bits :: enum int {
MAYMOVE = 0,
FIXED = 1,
DONTUNMAP = 2,
}SourceBits for MRemap_Flags
MSync_Flags
MSync_Flags :: bit_set[MSync_Flags_Bits; i32]SourceFlags for msync(2).
MSync_Flags_Bits
MSync_Flags_Bits :: enum int {
ASYNC = 0,
INVALIDATE = 1,
SYNC = 2,
}SourceBits for MSync_Flags
Map_Flags
Map_Flags :: bit_set[Map_Flags_Bits; i32]SourceFlags for mmap.
See `constants.odin` for `MAP_SHARED_VALIDATE` and `MAP_HUGE_16KB`, et al.Map_Flags_Bits
Map_Flags_Bits :: enum int {
SHARED = 0,
PRIVATE = 1,
DROPPABLE = 3,
FIXED = 4,
ANONYMOUS = 5,
// platform-dependent section start
X86_32BIT = 6,
X86_ABOVE4G = 7,
// platform-dependent section end
GROWSDOWN = 8,
DENYWRITE = 11,
EXECUTABLE = 12,
LOCKED = 13,
NORESERVE = 14,
POPULATE = 15,
NONBLOCK = 16,
STACK = 17,
HUGETLB = 18,
SYNC = 19,
FIXED_NOREPLACE = 20,
UNINITIALIZED = 26,
}SourceBits for Map_Flags
See `constants.odin` for `MAP_SHARED_VALIDATE` and `MAP_HUGE_16KB`, et al.Mem_Protection
Mem_Protection :: bit_set[Mem_Protection_Bits; i32]SourceSpecifies protection for memory pages.
Mem_Protection_Bits
Mem_Protection_Bits :: enum int {
READ = 0,
WRITE = 1,
EXEC = 2,
SEM = 3,
// platform-specific section start
ARM64_BTI = 4,
ARM64_MTE = 5,
// platform-specific section end
GROWSDOWN = 24,
GROWSUP = 25,
}SourceBits for Mem_Protection bitfield
Memfd_Create_Flag_Bits
Memfd_Create_Flag_Bits :: enum int {
CLOEXEC = log2(0x1),
ALLOW_SEALING = log2(0x2),
HUGETLB = log2(0x4),
}SourceSee constants.odin for MFD_HUGE_16KB, et al.
Memfd_Create_Flags
Memfd_Create_Flags :: bit_set[Memfd_Create_Flag_Bits; u32]SourceMode
Mode :: bit_set[Mode_Bits; u32]SourceRepresents file's permission and status bits Example:
When you're passing a value of this type the recommended usage is: linux.Mode{.S_IXOTH, .S_IROTH} | linux.S_IRWXU | linux.S_IRWXGThis would generate a mode that has full permissions for the
file's owner and group, and only "read" and "execute" bits
for others.Mode_Bits
Mode_Bits :: enum int {
IXOTH = 0, // 0o0000001
IWOTH = 1, // 0o0000002
IROTH = 2, // 0o0000004
IXGRP = 3, // 0o0000010
IWGRP = 4, // 0o0000020
IRGRP = 5, // 0o0000040
IXUSR = 6, // 0o0000100
IWUSR = 7, // 0o0000200
IRUSR = 8, // 0o0000400
ISVTX = 9, // 0o0001000
ISGID = 10, // 0o0002000
ISUID = 11, // 0o0004000
IFIFO = 12, // 0o0010000
IFCHR = 13, // 0o0020000
IFDIR = 14, // 0o0040000
IFREG = 15, // 0o0100000
}SourceThe bits for the Mode bitset.
Mount_Flags
Mount_Flags :: bit_set[Mount_Flags_Bits; uint]SourceMount_Flags_Bits
Mount_Flags_Bits :: enum int {
RDONLY = log2(1),
NOSUID = log2(2),
NODEV = log2(4),
NOEXEC = log2(8),
SYNCHRONOUS = log2(16),
REMOUNT = log2(32),
MANDLOCK = log2(64),
DIRSYNC = log2(128),
NOATIME = log2(1024),
NODIRATIME = log2(2048),
BIND = log2(4096),
MOVE = log2(8192),
REC = log2(16384),
SILENT = log2(32768),
POSIXACL = log2(1<<16),
UNBINDABLE = log2(1<<17),
PRIVATE = log2(1<<18),
SLAVE = log2(1<<19),
SHARED = log2(1<<20),
RELATIME = log2(1<<21),
KERNMOUNT = log2(1<<22),
I_VERSION = log2(1<<23),
STRICTATIME = log2(1<<24),
LAZYTIME = log2(1<<25),
ACTIVE = log2(1<<30),
NOUSER = log2(1<<31),
NOSYMFOLLOW = log2(256),
}SourceMsg_Buf
Msg_Buf :: struct {
type: int,
text: [0]u8,
}SourceTemplate for the struct used for sending and receiving messages
Msg_Hdr
Msg_Hdr :: struct {
name: rawptr,
namelen: i32,
iov: []IO_Vec,
control: []u8,
flags: Socket_Msg,
}SourceMessage header for sendmsg/recvmsg
Msqid_DS
Msqid_DS :: struct {
perm: IPC_Perm,
stime: uint,
rtime: uint,
ctime: uint,
cbytes: uint,
qnum: uint,
qbytes: uint,
lspid: Pid,
lrpid: Pid,
_: [2]uint,
}SourceSystemV message queue data.
Open_Flags
Open_Flags :: bit_set[Open_Flags_Bits; u32]SourceFlags for open(2).
PKey_Access_Bits
PKey_Access_Bits :: enum int {
DISABLE_ACCESS = 0,
DISABLE_WRITE = 2,
}SourceBits for PKey_Access_Rights
PKey_Access_Rights
PKey_Access_Rights :: bit_set[PKey_Access_Bits; u32]SourceAccess rights for pkey_alloc(2).
PTrace_Arch_Prctl_Type
PTrace_Arch_Prctl_Type :: PTrace_RequestSourcePTrace_Attach_Type
PTrace_Attach_Type :: PTrace_RequestSourcePTrace_Cont_Type
PTrace_Cont_Type :: PTrace_RequestSourcePTrace_Detach_Type
PTrace_Detach_Type :: PTrace_RequestSourcePTrace_Event_Code
PTrace_Event_Code :: enum int {
EVENT_FORK = 1,
EVENT_VFORK = 2,
EVENT_CLONE = 3,
EVENT_EXEC = 4,
EVENT_VFORK_DONE = 5,
EVENT_EXIT = 6,
EVENT_SECCOMP = 7,
EVENT_STOP = 128,
}Sourceptrace event codes.
PTrace_Get_RSeq_Configuration_Type
PTrace_Get_RSeq_Configuration_Type :: PTrace_RequestSourcePTrace_Get_Syscall_Info_Op
PTrace_Get_Syscall_Info_Op :: enum u8 {
NONE = 0,
ENTRY = 1,
EXIT = 2,
SECCOMP = 3,
}Sourceptrace's get syscall info operation.
PTrace_Get_Syscall_Info_Type
PTrace_Get_Syscall_Info_Type :: PTrace_RequestSourcePTrace_Get_Thread_Area_Type
PTrace_Get_Thread_Area_Type :: PTrace_RequestSourcePTrace_Geteventmsg_Type
PTrace_Geteventmsg_Type :: PTrace_RequestSourcePTrace_Getfpregs_Type
PTrace_Getfpregs_Type :: PTrace_RequestSourcePTrace_Getfpxregs_Type
PTrace_Getfpxregs_Type :: PTrace_RequestSourcePTrace_Getregs_Type
PTrace_Getregs_Type :: PTrace_RequestSourcePTrace_Getregset_Type
PTrace_Getregset_Type :: PTrace_RequestSourcePTrace_Getsiginfo_Type
PTrace_Getsiginfo_Type :: PTrace_RequestSourcePTrace_Getsigmask_Type
PTrace_Getsigmask_Type :: PTrace_RequestSourcePTrace_Interrupt_Type
PTrace_Interrupt_Type :: PTrace_RequestSourcePTrace_Kill_Type
PTrace_Kill_Type :: PTrace_RequestSourcePTrace_Listen_Type
PTrace_Listen_Type :: PTrace_RequestSourcePTrace_Note_Type
PTrace_Note_Type :: enum int {
NT_PRSTATUS = 1,
NT_PRFPREG = 2,
NT_PRPSINFO = 3,
NT_TASKSTRUCT = 4,
NT_AUXV = 6,
NT_SIGINFO = 1397311305,
NT_FILE = 1179208773,
NT_PRXFPREG = 1189489535,
NT_386_TLS = 512,
NT_386_IOPERM = 513,
NT_X86_XSTATE = 514,
NT_X86_SHSTK = 516,
NT_ARM_VFP = 1024,
NT_ARM_TLS = 1025,
NT_ARM_HW_BREAK = 1026,
NT_ARM_HW_WATCH = 1027,
NT_ARM_SYSTEM_CALL = 1028,
NT_ARM_SVE = 1029,
NT_ARM_PAC_MASK = 1030,
NT_ARM_PACA_KEYS = 1031,
NT_ARM_PACG_KEYS = 1032,
NT_ARM_TAGGED_ADDR_CTRL = 1033,
NT_ARM_PAC_ENABLED_KEYS = 1034,
NT_ARM_SSVE = 1035,
NT_ARM_ZA = 1036,
NT_ARM_ZT = 1037,
}SourceNote types for PTRACE_GETREGSET. Mirrors constants in elf definition,
files though this enum only contains the constants defined for architectures
Odin can compile to.PTrace_Options
PTrace_Options :: bit_set[PTrace_Options_Bits; u32]Sourceptrace options.
PTrace_Options_Bits
PTrace_Options_Bits :: enum i32 {
TRACESYSGOOD = 0,
TRACEFORK = 1,
TRACEVFORK = 2,
TRACECLONE = 3,
TRACEEXEC = 4,
TRACEVFORKDONE = 5,
TRACEEXIT = 6,
TRACESECCOMP = 7,
EXITKILL = 20,
SUSPEND_SECCOMP = 21,
}Sourceptrace options
PTrace_Peek_Sig_Info_Args
PTrace_Peek_Sig_Info_Args :: struct {
off: u64,
flags: PTrace_Peek_Sig_Info_Flags,
nr: i32,
}Sourceptrace's PEEKSIGINFO argument.
PTrace_Peek_Sig_Info_Flags
PTrace_Peek_Sig_Info_Flags :: bit_set[PTrace_Peek_Sig_Info_Flags_Bits; u32]Sourceptrace's PEEKSIGINFO flags.
PTrace_Peek_Sig_Info_Flags_Bits
PTrace_Peek_Sig_Info_Flags_Bits :: enum int {
SHARED = 0,
}Sourceptrace's PEEKSIGINFO flags bits
PTrace_Peek_Type
PTrace_Peek_Type :: PTrace_RequestSourcePTrace_Peeksiginfo_Type
PTrace_Peeksiginfo_Type :: PTrace_RequestSourcePTrace_Poke_Type
PTrace_Poke_Type :: PTrace_RequestSourcePTrace_RSeq_Configuration
PTrace_RSeq_Configuration :: struct {
rseq_abi_pointer: u64,
rseq_abi_size: u32,
signature: u32,
flags: u32,
_: u32,
}Sourceptrace's results of GET_RSEQ_CONFIGURATION.
PTrace_Request
PTrace_Request :: enum i32 {
TRACEME = 0,
PEEKTEXT = 1,
PEEKDATA = 2,
PEEKUSER = 3,
POKETEXT = 4,
POKEDATA = 5,
POKEUSER = 6,
CONT = 7,
KILL = 8,
SINGLESTEP = 9,
GETREGS = 12,
SETREGS = 13,
GETFPREGS = 14,
SETFPREGS = 15,
ATTACH = 16,
DETACH = 17,
GETFPXREGS = 18,
SETFPXREGS = 19,
SYSCALL = 24,
GET_THREAD_AREA = 25,
SET_THREAD_AREA = 26,
ARCH_PRCTL = 30,
SYSEMU = 31,
SYSEMU_SINGLESTEP = 32,
SINGLEBLOCK = 33,
SETOPTIONS = 16896,
GETEVENTMSG = 16897,
GETSIGINFO = 16898,
SETSIGINFO = 16899,
GETREGSET = 16900,
SETREGSET = 16901,
SEIZE = 16902,
INTERRUPT = 16903,
LISTEN = 16904,
PEEKSIGINFO = 16905,
GETSIGMASK = 16906,
SETSIGMASK = 16907,
SECCOMP_GET_FILTER = 16908,
SECCOMP_GET_METADATA = 16909,
GET_SYSCALL_INFO = 16910,
GET_RSEQ_CONFIGURATION = 16911,
}Sourceptrace requests
PTrace_Seccomp_Get_Filter_Type
PTrace_Seccomp_Get_Filter_Type :: PTrace_RequestSourcePTrace_Seccomp_Get_Metadata_Type
PTrace_Seccomp_Get_Metadata_Type :: PTrace_RequestSourcePTrace_Seccomp_Metadata
PTrace_Seccomp_Metadata :: struct {
filter_off: u64,
flags: u64,
}Sourceptrace's SECCOMP metadata.
PTrace_Seize_Type
PTrace_Seize_Type :: PTrace_RequestSourcePTrace_Set_Thread_Area_Type
PTrace_Set_Thread_Area_Type :: PTrace_RequestSourcePTrace_Setfpregs_Type
PTrace_Setfpregs_Type :: PTrace_RequestSourcePTrace_Setfpxregs_Type
PTrace_Setfpxregs_Type :: PTrace_RequestSourcePTrace_Setoptions_Type
PTrace_Setoptions_Type :: PTrace_RequestSourcePTrace_Setregs_Type
PTrace_Setregs_Type :: PTrace_RequestSourcePTrace_Setregset_Type
PTrace_Setregset_Type :: PTrace_RequestSourcePTrace_Setsiginfo_Type
PTrace_Setsiginfo_Type :: PTrace_RequestSourcePTrace_Setsigmask_Type
PTrace_Setsigmask_Type :: PTrace_RequestSourcePTrace_Singleblock_Type
PTrace_Singleblock_Type :: PTrace_RequestSourcePTrace_Singlestep_Type
PTrace_Singlestep_Type :: PTrace_RequestSourcePTrace_Syscall_Info
PTrace_Syscall_Info :: struct {
op: PTrace_Get_Syscall_Info_Op,
arch: u32,
instruction_pointer: u64,
stack_pointer: u64,
_: struct #raw_union {
entry: struct {
nr: u64,
args: [6]u64,
},
exit: struct {
rval: i64,
is_error: b8,
},
seccomp: struct {
nr: u64,
args: [6]u64,
ret_data: u32,
},
},
}Sourceptrace's results of GET_SYSCALL_INFO.
PTrace_Syscall_Type
PTrace_Syscall_Type :: PTrace_RequestSourcePTrace_Sysemu_Singlestep_Type
PTrace_Sysemu_Singlestep_Type :: PTrace_RequestSourcePTrace_Sysemu_Type
PTrace_Sysemu_Type :: PTrace_RequestSourcePTrace_Traceme_Type
PTrace_Traceme_Type :: PTrace_RequestSourcePerf_Cap_Flags
Perf_Cap_Flags :: bit_set[Perf_Cap_Flags_Bits; u64]SourcePerf_Cap_Flags_Bits
Perf_Cap_Flags_Bits :: enum u64 {
Bit0 = 0,
Bit0_Is_Deprecated = 1,
User_Rdpmc = 2,
User_Time = 3,
User_Time_Zero = 4,
User_Time_Short = 5,
}SourcePerf_Event_Attr
Perf_Event_Attr :: struct #packed {
type: Perf_Event_Type,
size: u32,
config: struct #raw_union {
hw: Perf_Hardware_Id,
sw: Perf_Software_Id,
cache: u64,
other: u64,
},
sample: struct #raw_union {
period: u64,
frequency: u64,
},
sample_type: Perf_Event_Sample_Type,
read_format: Perf_Read_Format,
flags: Perf_Event_Flags,
wakeup: struct #raw_union {
events: u32,
watermark: u32,
},
breakpoint_type: Hardware_Breakpoint_Type,
_: struct #raw_union {
breakpoint_addr: u64,
kprobe_func: u64,
uprobe_path: u64,
config1: u64,
},
_: struct #raw_union {
breakpoint_len: u64,
kprobe_addr: u64,
uprobe_offset: u64,
config2: u64,
},
branch_sample_type: Branch_Sample_Type,
sample_regs_user: u64,
sample_stack_user: u32,
clock_id: i32,
sample_regs_intr: u64,
aux_watermark: u32,
sample_max_stack: u16,
_: u16,
}SourceThe struct for perf_event_open.
Perf_Event_Flags
Perf_Event_Flags :: bit_set[Perf_Event_Flags_Bits; u64]SourcePerf_Event_Flags_Bits
Perf_Event_Flags_Bits :: enum u64 {
Disabled = 0,
Inherit = 1,
Pinned = 2,
Exclusive = 3,
Exclude_User = 4,
Exclude_Kernel = 5,
Exclude_HV = 6,
Exclude_Idle = 7,
Mmap = 8,
Comm = 9,
Freq = 10,
Inherit_Stat = 11,
Enable_On_Exec = 12,
Task = 13,
Watermark = 14,
Precise_IP_0 = 15,
Precise_IP_1 = 16,
Mmap_Data = 17,
Sample_Id_All = 18,
Exclude_Host = 19,
Exclude_Guest = 20,
Exclude_Callchain_Kernel = 21,
Exclude_Callchain_User = 22,
Mmap2 = 23,
Comm_Exec = 24,
Use_Clockid = 25,
Context_Switch = 26,
Write_Backward = 27,
Namespaces = 28,
KSymbol = 29,
BPF_Event = 30,
Aux_Output = 31,
CGroup = 32,
Text_Poke = 33,
Build_Id = 34,
Inherit_Thread = 35,
Remove_On_Exec = 36,
Sigtrap = 37,
}SourcePerf_Event_Mmap_Page
Perf_Event_Mmap_Page :: struct #packed {
version: u32,
compat_version: u32,
lock: u32,
index: u32,
offset: i64,
time_enabled: u64,
time_running: u64,
cap: struct #raw_union {
capabilities: u64,
flags: Perf_Cap_Flags,
},
pmc_width: u16,
time_shift: u16,
time_mult: u32,
time_offset: u64,
time_zero: u64,
size: u32,
reserved1: u32,
time_cycles: u64,
time_mask: u64,
reserved2: [928]u8,
data_head: u64,
data_tail: u64,
data_offset: u64,
data_size: u64,
aux_head: u64,
aux_tail: u64,
aux_offset: u64,
aux_size: u64,
}SourceThe ring buffer structure when mmaping Perf_Event_Attr.
Perf_Event_Sample_Type
Perf_Event_Sample_Type :: bit_set[Perf_Event_Sample_Type_Bits; u64]SourcePerf_Event_Sample_Type_Bits
Perf_Event_Sample_Type_Bits :: enum int {
IP = 0,
TID = 1,
TIME = 2,
ADDR = 3,
READ = 4,
CALLCHAIN = 5,
ID = 6,
CPU = 7,
PERIOD = 8,
STREAM_ID = 9,
RAW = 10,
BRANCH_STACK = 11,
REGS_USER = 12,
STACK_USER = 13,
WEIGHT = 14,
DATA_SRC = 15,
IDENTIFIER = 16,
TRANSACTION = 17,
REGS_INTR = 18,
PHYS_ADDR = 19,
AUX = 20,
CGROUP = 21,
DATA_PAGE_SIZE = 22,
CODE_PAGE_SIZE = 23,
WEIGHT_STRUCT = 24,
}SourceSpecifies which values to include in the sample
Perf_Event_Type
Perf_Event_Type :: enum u32 {
HARDWARE = 0,
SOFTWARE = 1,
TRACEPOINT = 2,
HW_CACHE = 3,
RAW = 4,
BREAKPOINT = 5,
}SourceUnion tag for Perf_Event_Attr struct
Perf_Flags
Perf_Flags :: bit_set[Perf_Flags_Bits; uint]SourceFlags for perf_event_open(2) syscall.
Perf_Flags_Bits
Perf_Flags_Bits :: enum int {
FD_NO_GROUP = 0,
FD_OUTPUT = 1,
PID_CGROUP = 2,
FD_CLOEXEC = 3,
}SourceBits for Perf_Flags
Perf_Hardware_Cache_Id
Perf_Hardware_Cache_Id :: enum u64 {
L1D = 0,
L1I = 1,
LL = 2,
DTLB = 3,
ITLB = 4,
BPU = 5,
NODE = 6,
}SourceSpecifies the cache for the particular cache event that you want to get info about
Perf_Hardware_Cache_Op_Id
Perf_Hardware_Cache_Op_Id :: enum u64 {
READ = 0,
WRITE = 1,
PREFETCH = 2,
}SourceSpecifies the cache op that you want to get info about
Perf_Hardware_Cache_Result_Id
Perf_Hardware_Cache_Result_Id :: enum u64 {
ACCESS = 0,
MISS = 1,
}SourceSpecifies the cache operation result that you want to get info about
Perf_Hardware_Id
Perf_Hardware_Id :: enum u64 {
CPU_CYCLES = 0,
INSTRUCTIONS = 1,
CACHE_REFERENCES = 2,
CACHE_MISSES = 3,
BRANCH_INSTRUCTIONS = 4,
BRANCH_MISSES = 5,
BUS_CYCLES = 6,
STALLED_CYCLES_FRONTEND = 7,
STALLED_CYCLES_BACKEND = 8,
REF_CPU_CYCLES = 9,
}SourceSpecifies the type of the hardware event that you want to get info about
Perf_Read_Format
Perf_Read_Format :: bit_set[Perf_Read_Format_Bits; u64]SourcePerf_Read_Format_Bits
Perf_Read_Format_Bits :: enum int {
TOTAL_TIME_ENABLED = 0,
TOTAL_TIME_RUNNING = 1,
ID = 2,
GROUP = 3,
LOST = 4,
}Source/ Describes field sets to include in mmaped page
Perf_Software_Id
Perf_Software_Id :: enum u64 {
CPU_CLOCK = 0,
TASK_CLOCK = 1,
PAGE_FAULTS = 2,
CONTEXT_SWITCHES = 3,
CPU_MIGRATIONS = 4,
PAGE_FAULTS_MIN = 5,
PAGE_FAULTS_MAJ = 6,
ALIGNMENT_FAULTS = 7,
EMULATION_FAULTS = 8,
DUMMY = 9,
BPF_OUTPUT = 10,
CGROUP_SWITCHES = 11,
}SourceSpecifies the particular software event that you want to get info about
Pid
Pid :: i32SourceType for Process IDs, Thread IDs, Thread group ID.
Pid_FD
Pid_FD :: i32SourceType for PID file descriptors.
Pid_FD_Flags
Pid_FD_Flags :: bit_set[Pid_FD_Flags_Bits; i32]SourceFlags for pidfd_open(2).
Pid_FD_Flags_Bits
Pid_FD_Flags_Bits :: enum int {
NONBLOCK = 11,
}SourceBits for flags for pidfd
Poll_Fd
Poll_Fd :: struct {
fd: Fd,
events: Fd_Poll_Events,
revents: Fd_Poll_Events,
}SourceStruct for ppoll(2).
Priority_Which
Priority_Which :: enum i32 {
PROCESS = 0,
PGRP = 1,
USER = 2,
}SourcePriority for process, process group, user
Protocol
Protocol :: enum int {
HOPOPT = 0,
ICMP = 1,
IGMP = 2,
GGP = 3,
IPv4 = 4,
ST = 5,
TCP = 6,
CBT = 7,
EGP = 8,
IGP = 9,
BBN_RCC_MON = 10,
NVP_II = 11,
PUP = 12,
EMCON = 14,
XNET = 15,
CHAOS = 16,
UDP = 17,
MUX = 18,
DCN_MEAS = 19,
HMP = 20,
PRM = 21,
XNS_IDP = 22,
TRUNK_1 = 23,
TRUNK_2 = 24,
LEAF_1 = 25,
LEAF_2 = 26,
RDP = 27,
IRTP = 28,
ISO_TP4 = 29,
NETBLT = 30,
MFE_NSP = 31,
MERIT_INP = 32,
DCCP = 33,
THREE_PC = 34,
IDPR = 35,
XTP = 36,
DDP = 37,
IDPR_CMTP = 38,
TP_PlusPlus = 39,
IL = 40,
IPv6 = 41,
SDRP = 42,
IPv6_Route = 43,
IPv6_Frag = 44,
IDRP = 45,
RSVP = 46,
GRE = 47,
DSR = 48,
BNA = 49,
ESP = 50,
AH = 51,
I_NLSP = 52,
NARP = 54,
MOBILE = 55,
TLSP = 56,
SKIP = 57,
IPv6_ICMP = 58,
IPv6_NoNxt = 59,
IPv6_Opts = 60,
CFTP = 62,
SAT_EXPAK = 64,
KRYPTOLAN = 65,
RVD = 66,
IPPC = 67,
SAT_MON = 69,
VISA = 70,
IPCV = 71,
CPNX = 72,
CPHB = 73,
WSN = 74,
PVP = 75,
BR_SAT_MON = 76,
SUN_ND = 77,
WB_MON = 78,
WB_EXPAK = 79,
ISO_IP = 80,
VMTP = 81,
SECURE_VMTP = 82,
VINES = 83,
IPTM = 84,
NSFNET_IGP = 85,
DGP = 86,
TCF = 87,
EIGRP = 88,
OSPFIGP = 89,
Sprite_RPC = 90,
LARP = 91,
MTP = 92,
AX_25 = 93,
IPIP = 94,
SCC_SP = 96,
ETHERIP = 97,
ENCAP = 98,
GMTP = 100,
IFMP = 101,
PNNI = 102,
PIM = 103,
ARIS = 104,
SCPS = 105,
QNX = 106,
A_N = 107,
IPComp = 108,
SNP = 109,
Compaq_Peer = 110,
IPX_in_IP = 111,
VRRP = 112,
PGM = 113,
L2TP = 115,
DDX = 116,
IATP = 117,
STP = 118,
SRP = 119,
UTI = 120,
SMP = 121,
PTP = 123,
FIRE = 125,
CRTP = 126,
CRUDP = 127,
SSCOPMCE = 128,
IPLT = 129,
SPS = 130,
PIPE = 131,
SCTP = 132,
FC = 133,
RSVP_E2E_IGNORE = 134,
UDPLite = 136,
MPLS_in_IP = 137,
manet = 138,
HIP = 139,
Shim6 = 140,
WESP = 141,
ROHC = 142,
Ethernet = 143,
AGGFRAG = 144,
NSH = 145,
Reserved = 255,
}SourceThe protocol number according to IANA protocol number list
Full list of protocol numbers:
https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml
Supported by the OS protocols can be queried by reading:
/etc/protocolsProtocol_Family
Protocol_Family :: enum u16 {
UNSPEC = 0,
LOCAL = 1,
UNIX = LOCAL,
FILE = LOCAL,
INET = 2,
AX25 = 3,
IPX = 4,
APPLETALK = 5,
NETROM = 6,
BRIDGE = 7,
ATMPVC = 8,
X25 = 9,
INET6 = 10,
ROSE = 11,
DECnet = 12,
NETBEUI = 13,
SECURITY = 14,
KEY = 15,
NETLINK = 16,
ROUTE = NETLINK,
PACKET = 17,
ASH = 18,
ECONET = 19,
ATMSVC = 20,
RDS = 21,
SNA = 22,
IRDA = 23,
PPPOX = 24,
WANPIPE = 25,
LLC = 26,
IB = 27,
MPLS = 28,
CAN = 29,
TIPC = 30,
BLUETOOTH = 31,
IUCV = 32,
RXRPC = 33,
ISDN = 34,
PHONET = 35,
IEEE802154 = 36,
CAIF = 37,
ALG = 38,
NFC = 39,
VSOCK = 40,
KCM = 41,
QIPCRTR = 42,
SMC = 43,
XDP = 44,
MCTP = 45,
}SourceProtocol family
RISCV_HWProbe
RISCV_HWProbe :: struct {
// set to `.UNSUPPORTED` by the kernel if that is the case.
key: RISCV_HWProbe_Key,
value: struct #raw_union {
base_behavior: RISCV_HWProbe_Base_Behavior,
ima_ext_0: RISCV_HWProbe_IMA_Ext_0,
cpu_perf_0: RISCV_HWProbe_CPU_Perf_0,
misaligned_scalar_perf: RISCV_HWProbe_Misaligned_Scalar_Perf,
raw: u64,
},
}SourceRISCV_HWProbe_Base_Behavior
RISCV_HWProbe_Base_Behavior :: bit_set[RISCV_HWProbe_Base_Behavior_Bits; u64]SourceRISCV_HWProbe_Base_Behavior_Bits
RISCV_HWProbe_Base_Behavior_Bits :: enum int {
IMA = 0,
}SourceRISCV_HWProbe_CPU_Perf_0
RISCV_HWProbe_CPU_Perf_0 :: bit_set[RISCV_HWProbe_Misaligned_Scalar_Perf; u64]SourceRISCV_HWProbe_Flags
RISCV_HWProbe_Flags :: bit_set[RISCV_HWProbe_Flags_Bits; u32]SourceRISCV_HWProbe_Flags_Bits
RISCV_HWProbe_Flags_Bits :: enum int {
WHICH_CPUS = 0,
}SourceRISCV_HWProbe_IMA_Ext_0
RISCV_HWProbe_IMA_Ext_0 :: bit_set[RISCV_HWProbe_IMA_Ext_0_Bits; u64]SourceRISCV_HWProbe_IMA_Ext_0_Bits
RISCV_HWProbe_IMA_Ext_0_Bits :: enum int {
FD = 0,
C = 1,
V = 2,
EXT_ZBA = 3,
EXT_ZBB = 4,
EXT_ZBS = 5,
EXT_ZICBOZ = 6,
EXT_ZBC = 7,
EXT_ZBKB = 8,
EXT_ZBKC = 9,
EXT_ZBKX = 10,
EXT_ZKND = 11,
EXT_ZKNE = 12,
EXT_ZKNH = 13,
EXT_ZKSED = 14,
EXT_ZKSH = 15,
EXT_ZKT = 16,
EXT_ZVBB = 17,
EXT_ZVBC = 18,
EXT_ZVKB = 19,
EXT_ZVKG = 20,
EXT_ZVKNED = 21,
EXT_ZVKNHA = 22,
EXT_ZVKNHB = 23,
EXT_ZVKSED = 24,
EXT_ZVKSH = 25,
EXT_ZVKT = 26,
EXT_ZFH = 27,
EXT_ZFHMIN = 28,
EXT_ZIHINTNTL = 29,
EXT_ZVFH = 30,
EXT_ZVFHMIN = 31,
EXT_ZFA = 32,
EXT_ZTSO = 33,
EXT_ZACAS = 34,
EXT_ZICOND = 35,
EXT_ZIHINTPAUSE = 36,
EXT_ZVE32X = 37,
EXT_ZVE32F = 38,
EXT_ZVE64X = 39,
EXT_ZVE64F = 40,
EXT_ZVE64D = 41,
EXT_ZIMOP = 42,
EXT_ZCA = 43,
EXT_ZCB = 44,
EXT_ZCD = 45,
EXT_ZCF = 46,
EXT_ZCMOP = 47,
EXT_ZAWRS = 48,
}SourceRISCV_HWProbe_Key
RISCV_HWProbe_Key :: enum i64 {
UNSUPPORTED = -1,
MVENDORID = 0,
MARCHID = 1,
MIMPID = 2,
BASE_BEHAVIOR = 3,
IMA_EXT_0 = 4,
// Deprecated, try `.MISALIGNED_SCALAR_PERF` first, if that is `.UNSUPPORTED`, use this.
CPUPERF_0 = 5,
ZICBOZ_BLOCK_SIZE = 6,
HIGHEST_VIRT_ADDRESS = 7,
TIME_CSR_FREQ = 8,
MISALIGNED_SCALAR_PERF = 9,
}SourceRISCV_HWProbe_Misaligned_Scalar_Perf
RISCV_HWProbe_Misaligned_Scalar_Perf :: enum int {
UNKNOWN = 0,
EMULATED = 1,
SLOW = 2,
FAST = 3,
UNSUPPORTED = 4,
}SourceRLimit
RLimit :: struct {
cur: uint,
max: uint,
}SourceResource limit
RLimit_Kind
RLimit_Kind :: enum i32 {
CPU = 0,
FSIZE = 1,
DATA = 2,
STACK = 3,
CORE = 4,
RSS = 5,
NOFILE = 7,
AS = 9,
NPROC = 6,
MEMLOCK = 8,
LOCKS = 10,
SIGPENDING = 11,
MSGQUEUE = 12,
NICE = 13,
RTPRIO = 14,
RTTIME = 15,
NLIMITS = 16,
}SourceThe kind of resource limits
RUsage
RUsage :: struct {
utime: Time_Val,
stime: Time_Val,
maxrss_word: int,
ixrss_word: int,
idrss_word: int,
isrss_word: int,
minflt_word: int,
majflt_word: int,
nswap_word: int,
inblock_word: int,
oublock_word: int,
msgsnd_word: int,
msgrcv_word: int,
nsignals_word: int,
nvcsw_word: int,
nivcsw_word: int,
}SourceStructure representing how much of each resource got used.
RUsage_Who
RUsage_Who :: enum i32 {
CHILDREN = -1,
SELF = 0,
THREAD = 1,
LWP = THREAD,
}SourceRepresents the user of resources
RW_Hint
RW_Hint :: enum u64 {
WRITE_LIFE_NOT_SET = 0,
WRITE_LIFE_NONE = 1,
WRITE_LIFE_SHORT = 2,
WRITE_LIFE_MEDIUM = 3,
WRITE_LIFE_LONG = 4,
WRITE_LIFE_EXTREME = 5,
}SourceReboot_Magic
Reboot_Magic :: enum u64 {
RB_MAGIC_1 = 4276215469,
RB_MAGIC_2 = 672274793,
RB_MAGIC_2A = 85072278, // Since Linux 2.1.17
RB_MAGIC_2B = 369367448, // Since Linux 2.1.97
RB_MAGIC_2C = 537993216, // Since Linux 2.5.71
}SourceReboot_Operation
Reboot_Operation :: enum u64 {
RB_DISABLE_CAD = 0,
RB_ENABLE_CAD = 2309737967,
RB_HALT_SYSTEM = 3454992675,
RB_KEXEC = 1163412803,
RB_POWER_OFF = 1126301404,
RB_AUTOBOOT = 19088743,
RB_AUTOBOOT_2 = 2712847316,
RB_SW_SUSPEND = 3489725666,
}SourceRename_Flags
Rename_Flags :: bit_set[Rename_Flags_Bits; u32]SourceFlags for rename(2).
Rename_Flags_Bits
Rename_Flags_Bits :: enum int {
EXCHANGE = 1,
NOREPLACE = 0,
WHITEOUT = 2,
}SourceBits for Rename_Flags
Sched_Attr
Sched_Attr :: struct {
size: u32,
sched_policy: Sched_Policy,
sched_flags: Sched_Flags,
sched_nice: i32,
sched_priority: u32,
// For the DEADLINE policy
sched_runtime: u64,
sched_deadline: u64,
sched_period: u64,
// Utilization hints
sched_util_min: u32,
sched_util_max: u32,
}SourceSched_Attr_Flag_Bits
Sched_Attr_Flag_Bits :: enum int {}SourceSched_Attr_Flags
Sched_Attr_Flags :: bit_set[Sched_Attr_Flag_Bits; u32]SourceSched_Flag_Bits
Sched_Flag_Bits :: enum int {
RESET_ON_FORK = log2(0x01),
RECLAIM = log2(0x02),
DL_OVERRUN = log2(0x04),
KEEP_POLICY = log2(0x08),
KEEP_PARAMS = log2(0x10),
UTIL_CLAMP_MIN = log2(0x20),
UTIL_CLAMP_MAX = log2(0x40),
}SourceSched_Flags
Sched_Flags :: bit_set[Sched_Flag_Bits; u32]SourceSched_Param
Sched_Param :: struct {
sched_priority: i32,
}SourceSched_Policy
Sched_Policy :: enum u32 {
OTHER = 0,
BATCH = 3,
IDLE = 5,
FIFO = 1,
RR = 2,
DEADLINE = 6,
}SourceSeal
Seal :: bit_set[Seal_Bits; i32]SourceSeals for fcntl_add_seals().
Seal_Bits
Seal_Bits :: enum int {
SEAL = 0,
SHRINK = 1,
GROW = 2,
WRITE = 3,
FUTURE_WRITE = 4,
}SourceBits for seal
Seek_Whence
Seek_Whence :: enum i16 {
SET = 0,
CUR = 1,
END = 2,
DATA = 3,
HOLE = 4,
}SourceSem_Buf
Sem_Buf :: struct {
num: u16,
op: IPC_Cmd,
flg: IPC_Flags,
}SourceSystemV semaphore operation.
Sem_Info
Sem_Info :: struct {
semmap: i32,
mni: i32,
mns: i32,
mnu: i32,
msl: i32,
opm: i32,
ume: i32,
usz: i32,
vmx: i32,
aem: i32,
}SourceSystenV semaphore info.
Sem_Un
Sem_Un :: struct #raw_union {
val: i32,
buf: rawptr,
array: u16,
__buf: Sem_Info,
_: uintptr,
}SourceArgument for semctl functions
Semid_DS
Semid_DS :: _Arch_Semid_DSSourceArchitecture-specific semaphore data.
Shm_Info
Shm_Info :: struct {
used_ids: i32,
shm_tot: uint,
shm_rss: uint,
shm_swp: uint,
swap_attempts: uint,
swap_successes: uint,
}SourceSystemV shared memory info.
Shutdown_How
Shutdown_How :: enum i32 {
RD = 0,
WR = 1,
RDWR = 2,
}SourceArgument to shutdown(2)
Sig_Action
Sig_Action :: struct {
_u: struct #raw_union {
handler: Sig_Handler_Fn,
sigaction: _,
},
}SourceSig_Action_Flag
Sig_Action_Flag :: enum u32 {
NOCLDSTOP = 0,
NOCLDWAIT = 1,
SIGINFO = 2,
UNSUPPORTED = 10,
EXPOSE_TAGBITS = 11,
RESTORER = 26,
ONSTACK = 27,
RESTART = 28,
NODEFER = 30,
RESETHAND = 31,
}SourceSig_Action_Flags
Sig_Action_Flags :: bit_set[Sig_Action_Flag; uint]SourceSig_Action_Special
Sig_Action_Special :: enum uint {
SIG_DFL = 0,
SIG_IGN = 1,
SIG_ERR = ~uint(0),
}SourceSig_Child_Code
Sig_Child_Code :: enum int {
NONE = 0,
EXITED = 1,
KILLED = 2,
DUMPED = 3,
TRAPPED = 4,
STOPPED = 5,
CONTINUED = 6,
}SourceTranslation of code in Sig_Info for when signo is SIGCHLD
Sig_Event
Sig_Event :: struct {
value: Sig_Val,
signo: i32,
notify: i32,
_: struct #raw_union {
_: [SIGEV_PAD_SIZE]u32,
thread_id: Pid,
_: struct {
notify_function: _,
},
},
}SourceSig_Handler_Fn
Sig_Handler_Fn :: proc(sig: Signal)SourceSig_Mask_Kind
Sig_Mask_Kind :: enum i32 {
SIG_BLOCK = 0,
SIG_UNBLOCK = 1,
SIG_SETMASK = 2,
}SourceSig_Restore_Fn
Sig_Restore_Fn :: proc() -> ()SourceSig_Set
Sig_Set :: [_SIGSET_NWORDS]uintSourceSig_Stack
Sig_Stack :: struct {
sp: rawptr,
flags: Sig_Stack_Flags,
size: uintptr,
}SourceSig_Stack_Flag
Sig_Stack_Flag :: enum i32 {
DISABLE = 0,
ONSTACK = 1,
AUTODISARM = 31,
}SourceSig_Stack_Flags
Sig_Stack_Flags :: bit_set[Sig_Stack_Flag; i32]SourceSig_Val
Sig_Val :: struct #raw_union {
sival_int: i32,
sival_ptr: rawptr,
}SourceSignal
Signal :: enum i32 {
// POSIX-defined signals
SIGINT = 2, // Interactive attention signal.
SIGILL = 4, // Illegal instruction.
SIGABRT = 6, // Abnormal termination.
SIGFPE = 8, // Erroneous arithmetic operation.
SIGSEGV = 11, // Invalid access to storage.
SIGTERM = 15, // Termination request.
// Other POSIX signals
SIGHUP = 1, // Hangup.
SIGQUIT = 3, // Quit.
SIGTRAP = 5, // Trace/breakpoint trap.
SIGKILL = 9, // Killed.
SIGPIPE = 13, // Broken pipe.
SIGALRM = 14, // Alarm clock.
// Adjustments needed for most linux systems
SIGSTKFLT = 16, // Stack fault (obsolete).
SIGPWR = 30, // Power failure imminent.
// Historical signals specified by POSIX.
SIGBUS = 7, // Bus error.
SIGSYS = 31, // Bad system call.
// New(er) POSIX signals (1003.1-2008, 1003.1-2013).
SIGURG = 23, // Urgent data is available at a socket.
SIGSTOP = 19, // Stop, unblockable.
SIGTSTP = 20, // Keyboard stop.
SIGCONT = 18, // Continue.
SIGCHLD = 17, // Child terminated or stopped.
SIGTTIN = 21, // Background read from control terminal.
SIGTTOU = 22, // Background write to control terminal.
SIGPOLL = 29, // Pollable event occurred (System V).
SIGXFSZ = 25, // File size limit exceeded.
SIGXCPU = 24, // CPU time limit exceeded.
SIGVTALRM = 26, // Virtual timer expired.
SIGPROF = 27, // Profiling timer expired.
SIGUSR1 = 10, // User-defined signal 1.
SIGUSR2 = 12, // User-defined signal 2.
// Nonstandard signals found in all modern POSIX systems (including both BSD and Linux).
SIGWINCH = 28, // Window size change (4.3 BSD, Sun).
// Archaic names for compatibility.
SIGIO = SIGPOLL, // I/O now possible (4.2 BSD).
SIGIOT = SIGABRT, // IOT instruction, abort() on a PDP-11.
SIGCLD = SIGCHLD, // Old System V name
}SourceSock_Addr
Sock_Addr :: struct #packed {
sa_family: Address_Family,
sa_data: [14]u8,
}SourceStruct representing a generic socket address.
Sock_Addr_Any
Sock_Addr_Any :: struct #raw_union {
_: struct {
family: Address_Family,
port: u16be,
},
generic: Sock_Addr,
ipv4: Sock_Addr_In,
ipv6: Sock_Addr_In6,
uds: Sock_Addr_Un,
}SourceStruct representing an arbitrary socket address.
Sock_Addr_In
Sock_Addr_In :: struct #packed {
sin_family: Address_Family,
sin_port: u16be,
sin_addr: [4]u8,
sin_zero: [size_of(Sock_Addr) - size_of(Address_Family) - size_of(u16be) - size_of([4]u8,
}SourceStruct representing IPv4 socket address.
Sock_Addr_In6
Sock_Addr_In6 :: struct #packed {
sin6_family: Address_Family,
sin6_port: u16be,
sin6_flowinfo: u32,
sin6_addr: [16]u8,
sin6_scope_id: u32,
}SourceStruct representing IPv6 socket address.
Sock_Addr_Un
Sock_Addr_Un :: struct #packed {
sun_family: Address_Family,
sun_path: [108]u8,
}SourceStruct representing Unix Domain Socket address
Socket_API_Level
Socket_API_Level :: enum int {
// Comes from <bits/socket-constants.h>
SOCKET = 1,
// Copy-pasted from protocol numbers
TCP = 6,
UDP = 17,
// Comes from <bits/socket.h>
RAW = 255,
DECNET = 261,
X25 = 262,
PACKET = 263,
ATM = 264,
AAL = 265,
IRDA = 266,
NETBEUI = 267,
LLC = 268,
DCCP = 269,
NETLINK = 270,
TIPC = 271,
RXRPC = 272,
PPPOL2TP = 273,
BLUETOOTH = 274,
PNPIPE = 275,
RDS = 276,
IUCV = 277,
CAIF = 278,
ALG = 279,
NFC = 280,
KCM = 281,
TLS = 282,
XDP = 283,
MPTCP = 284,
MCTP = 285,
SMC = 286,
}SourceAPI Level for getsockopt(2)/setsockopt(2)
Socket_API_Level_Raw
Socket_API_Level_Raw :: Socket_API_LevelSourceSocket_API_Level_Sock
Socket_API_Level_Sock :: Socket_API_LevelSourceSocket_API_Level_TCP
Socket_API_Level_TCP :: Socket_API_LevelSourceSocket_API_Level_UDP
Socket_API_Level_UDP :: Socket_API_LevelSourceSocket_FD_Flags
Socket_FD_Flags :: bit_set[Socket_FD_Flags_Bits; i32]SourceFlags for the socket file descriptor.
Note, on linux these are technically passed by OR'ing together
with Socket_Type, our wrapper does this under the hood.Socket_FD_Flags_Bits
Socket_FD_Flags_Bits :: enum int {
NONBLOCK = 11,
CLOEXEC = 19,
}SourceBits for Socket_FD_Flags
Socket_Msg
Socket_Msg :: bit_set[Socket_Msg_Bits; i32]SourceFlags for the socket for send/recv calls.
Socket_Msg_Bits
Socket_Msg_Bits :: enum int {
OOB = 0,
PEEK = 1,
DONTROUTE = 2,
TRYHARD = DONTROUTE,
CTRUNC = 3,
PROXY = 4,
TRUNC = 5,
DONTWAIT = 6,
EOR = 7,
WAITALL = 8,
FIN = 9,
SYN = 10,
CONFIRM = 11,
RST = 12,
ERRQUEUE = 13,
NOSIGNAL = 14,
MORE = 15,
WAITFORONE = 16,
BATCH = 18,
ZEROCOPY = 22,
FASTOPEN = 29,
CMSG_CLOEXEC = 30,
}SourceBits for Socket_Msg
Socket_Option
Socket_Option :: enum int {
DEBUG = 1,
REUSEADDR = 2,
TYPE = 3,
ERROR = 4,
DONTROUTE = 5,
BROADCAST = 6,
SNDBUF = 7,
RCVBUF = 8,
SNDBUFFORCE = 32,
RCVBUFFORCE = 33,
KEEPALIVE = 9,
OOBINLINE = 10,
NO_CHECK = 11,
PRIORITY = 12,
LINGER = 13,
BSDCOMPAT = 14,
REUSEPORT = 15,
PASSCRED = 16,
PEERCRED = 17,
RCVLOWAT = 18,
SNDLOWAT = 19,
RCVTIMEO_OLD = 20,
SNDTIMEO_OLD = 21,
SECURITY_AUTHENTICATION = 22,
SECURITY_ENCRYPTION_TRANSPORT = 23,
SECURITY_ENCRYPTION_NETWORK = 24,
BINDTODEVICE = 25,
ATTACH_FILTER = 26,
DETACH_FILTER = 27,
GET_FILTER = ATTACH_FILTER,
PEERNAME = 28,
ACCEPTCONN = 30,
PEERSEC = 31,
PASSSEC = 34,
IP_ADD_MEMBERSHIP = 35,
MARK = 36,
PROTOCOL = 38,
DOMAIN = 39,
RXQ_OVFL = 40,
WIFI_STATUS = 41,
PEEK_OFF = 42,
NOFCS = 43,
LOCK_FILTER = 44,
SELECT_ERR_QUEUE = 45,
BUSY_POLL = 46,
MAX_PACING_RATE = 47,
BPF_EXTENSIONS = 48,
INCOMING_CPU = 49,
ATTACH_BPF = 50,
DETACH_BPF = DETACH_FILTER,
ATTACH_REUSEPORT_CBPF = 51,
ATTACH_REUSEPORT_EBPF = 52,
CNX_ADVICE = 53,
TIMESTAMPING_OPT_STATS = 54,
MEMINFO = 55,
INCOMING_NAPI_ID = 56,
COOKIE = 57,
TIMESTAMPING_PKTINFO = 58,
PEERGROUPS = 59,
ZEROCOPY = 60,
TXTIME = 61,
BINDTOIFINDEX = 62,
TIMESTAMP_OLD = 29,
TIMESTAMPNS_OLD = 35,
TIMESTAMPING_OLD = 37,
TIMESTAMP_NEW = 63,
TIMESTAMPNS_NEW = 64,
TIMESTAMPING_NEW = 65,
RCVTIMEO_NEW = 66,
SNDTIMEO_NEW = 67,
DETACH_REUSEPORT_BPF = 68,
PREFER_BUSY_POLL = 69,
BUSY_POLL_BUDGET = 70,
NETNS_COOKIE = 71,
BUF_LOCK = 72,
RESERVE_MEM = 73,
TXREHASH = 74,
RCVMARK = 75,
TIMESTAMP = TIMESTAMP_OLD when _SOCKET_OPTION_OLD else TIMESTAMP_NEW,
TIMESTAMPNS = TIMESTAMPNS_OLD when _SOCKET_OPTION_OLD else TIMESTAMPNS_NEW,
TIMESTAMPING = TIMESTAMPING_OLD when _SOCKET_OPTION_OLD else TIMESTAMPING_NEW,
RCVTIMEO = RCVTIMEO_OLD when _SOCKET_OPTION_OLD else RCVTIMEO_NEW,
SNDTIMEO = SNDTIMEO_OLD when _SOCKET_OPTION_OLD else SNDTIMEO_NEW,
}SourceIf Socket_API_Level == .SOCKET, these are the options
you can specify in getsockopt(2)/setsockopt(2)Socket_TCP_Option
Socket_TCP_Option :: enum int {
NODELAY = 1,
MAXSEG = 2,
CORK = 3,
KEEPIDLE = 4,
KEEPINTVL = 5,
KEEPCNT = 6,
SYNCNT = 7,
LINGER2 = 8,
DEFER_ACCEPT = 9,
WINDOW_CLAMP = 10,
INFO = 11,
QUICKACK = 12,
CONGESTION = 13,
MD5SIG = 14,
COOKIE_TRANSACTIONS = 15,
THIN_LINEAR_TIMEOUTS = 16,
THIN_DUPACK = 17,
USER_TIMEOUT = 18,
REPAIR = 19,
REPAIR_QUEUE = 20,
QUEUE_SEQ = 21,
REPAIR_OPTIONS = 22,
FASTOPEN = 23,
TIMESTAMP = 24,
NOTSENT_LOWAT = 25,
CC_INFO = 26,
SAVE_SYN = 27,
SAVED_SYN = 28,
REPAIR_WINDOW = 29,
FASTOPEN_CONNECT = 30,
ULP = 31,
MD5SIG_EXT = 32,
FASTOPEN_KEY = 33,
FASTOPEN_NO_COOKIE = 34,
ZEROCOPY_RECEIVE = 35,
INQ = 36,
CM_INQ = INQ,
TX_DELAY = 37,
}SourceSocket_Type
Socket_Type :: enum int {
STREAM = 1,
DGRAM = 2,
RAW = 3,
RDM = 4,
SEQPACKET = 5,
DCCP = 6,
PACKET = 10,
}SourceType of socket to create
- For TCP you want to use SOCK_STREAM
- For UDP you want to use SOCK_DGRAM
Also see `Protocol`Socket_UDP_Option
Socket_UDP_Option :: enum int {
CORK = 1,
ENCAP = 100,
NO_CHECK6_TX = 101,
NO_CHECK6_RX = 102,
SEGMENT = 103,
GRO = 104,
}SourceSplice_Flags
Splice_Flags :: bit_set[Splice_Flags_Bits; u32]SourceFlags for splice(2) and tee(2) syscalls.
Splice_Flags_Bits
Splice_Flags_Bits :: enum int {
MOVE = 1,
NONBLOCK = 2,
MORE = 4,
GIFT = 8,
}SourceBits for splice flags.
Stat
Stat :: struct {
_impl_stat: _Arch_Stat,
}SourceRepresents the file state.
If you're on 32-bit platform, consider using Stat64 instead.Stat_FS
Stat_FS :: struct {
_impl_stat_fs: _Arch_Stat_FS,
}SourceStruct for statfs(2).
Statx
Statx :: struct {
mask: Statx_Mask,
blksize: u32,
attributes: Statx_Attr,
nlink: u32,
uid: Uid,
gid: Gid,
// Note(flysand): mode is 16-bit on linux + there's
// 16-bit padding following it. Since our mode is 32-bits,
// we're using the padding. This should be fine because
// the placement of that padding suggests it was going to
// be used for the Mode bits anyway.
mode: Mode,
ino: Inode,
size: u64,
blocks: u64,
attributes_mask: Statx_Attr,
atime: Statx_Timestamp,
btime: Statx_Timestamp,
ctime: Statx_Timestamp,
mtime: Statx_Timestamp,
rdev_major: u32,
rdev_minor: u32,
dev_major: u32,
dev_minor: u32,
mnt_id: u64,
dio_mem_align: u32,
dio_offset_align: u32,
_: [12]u64,
}SourceThe extended Stat struct, the argument to statx(2) syscall.
Statx_Attr
Statx_Attr :: bit_set[Statx_Attr_Bits; u64]SourceFile attributes, returned by statx. This bitset is also
used to specify which attributes are present, not just
their value.Statx_Attr_Bits
Statx_Attr_Bits :: enum int {
COMPRESSED = 2, // 0x00000004
IMMUTABLE = 4, // 0x00000010
APPEND = 5, // 0x00000020
NODUMP = 6, // 0x00000040
ENCRYPTED = 11, // 0x00000800
AUTOMOUNT = 12, // 0x00001000
MOUNT_ROOT = 13, // 0x00002000
VERITY = 20, // 0x00100000
DAX = 21, // 0x00200000
}SourceBits found in Statx_Attr bitset
You should not use these directlyStatx_Mask
Statx_Mask :: bit_set[Statx_Mask_Bits; u32]SourceQuery params/results for statx().
Statx_Mask_Bits
Statx_Mask_Bits :: enum int {
TYPE = 0,
MODE = 1,
NLINK = 2,
UID = 3,
GID = 4,
ATIME = 5,
MTIME = 6,
CTIME = 7,
INO = 8,
SIZE = 9,
BLOCKS = 10,
BTIME = 11,
MNT_ID = 12,
DIOALIGN = 13,
}SourceThe bits used by the Statx_Mask bitset
Statx_Timestamp
Statx_Timestamp :: struct {
sec: i64,
nsec: u32,
_: i32,
}SourceTimestamp type used for Statx struct
Swap_Flags
Swap_Flags :: bit_set[Swap_Flags_Bits; u32]SourceSwap_Flags_Bits
Swap_Flags_Bits :: enum int {
PREFER = log2(0x8000),
DISCARD = log2(0x10000),
}SourceSys_Info
Sys_Info :: struct {
uptime: int,
loads: [3]int,
totalram: uint,
freeram: uint,
sharedram: uint,
bufferram: uint,
totalswap: uint,
freeswap: uint,
procs: u16,
totalhigh: uint,
freehigh: uint,
mem_unit: i32,
_padding: [20 - (2 * size_of(int)) - size_of(i32)]u8,
}SourceReturn buffer for the sysinfo syscall
Syslog_Action
Syslog_Action :: enum i32 {
CLOSE = 0,
OPEN = 1,
READ = 2,
READ_ALL = 3,
READ_CLEAR = 4,
CLEAR = 5,
CONSOLE_OFF = 6,
CONSOLE_ON = 7,
CONSOLE_LEVEL = 8,
SIZE_UNREAD = 9,
SIZE_BUFFER = 10,
}SourceSyslog actions.
Time_Spec
Time_Spec :: struct {
time_sec: uint,
time_nsec: uint,
}SourceRepresents time with nanosecond precision.
Time_Val
Time_Val :: struct {
seconds: int,
microseconds: int,
}SourceRepresents time with millisecond precision.
Timer
Timer :: i32SourceRepresents timer IDs.
Timex
Timex :: struct {
modes: u32,
offset: int,
freq: int,
maxerror: int,
esterror: int,
status: i32,
constant: int,
precision: int,
tolerance: int,
time: Time_Val,
tick: int,
ppsfreq: int,
jitter: int,
shift: i32,
stabil: int,
jitcnt: int,
calcnt: int,
errcnt: int,
stbcnt: int,
tai: i32,
}SourceTms
Tms :: struct {
tms_utime: int,
tms_stime: int,
tms_cutime: int,
tms_cstime: int,
}SourceTimes
UPD_Encapsulation
UPD_Encapsulation :: enum int {
ENCAP_ESPINUDP_NON_IKE = 1,
ENCAP_ESPINUDP = 2,
ENCAP_L2TPINUDP = 3,
ENCAP_GTP0 = 4,
ENCAP_GTP1U = 5,
}SourceUTS_Name
UTS_Name :: struct {
sysname: [65]u8,
nodename: [65]u8,
release: [65]u8,
version: [65]u8,
machine: [65]u8,
domainname: [65]u8,
}Source"Unix time-sharing system name", allegedly.
Basically system info.UTim_Buf
UTim_Buf :: struct {
actime: uint,
modtime: uint,
}SourceAccess and modification times for files
Uid
Uid :: u32SourceType for 32-bit User IDs.
Umount2_Flags
Umount2_Flags :: bit_set[Umount2_Flags_Bits; u32]SourceUmount2_Flags_Bits
Umount2_Flags_Bits :: enum int {
MNT_FORCE = log2(0x00000001),
MNT_DETACH = log2(0x00000002),
MNT_EXPIRE = log2(0x00000004),
UMOUNT_NOFOLLOW = log2(0x00000008),
UMOUNT_UNUSED = log2(0x80000000),
}SourceUser_FPX_Regs
User_FPX_Regs :: _Arch_User_FPX_RegsSourceArchitecture-specific extended floating-point registers.
Currently only used for x86 CPU's.User_FP_Regs
User_FP_Regs :: _Arch_User_FP_RegsSourceArchitecture-specific floating-point registers
User_Regs
User_Regs :: _Arch_User_RegsSourceArchitecture-specific registers struct.
Wait_Option
Wait_Option :: enum int {
WNOHANG = 0,
WUNTRACED = 1,
WSTOPPED = 1,
WEXITED = 2,
WCONTINUED = 3,
WNOWAIT = 24,
// // For processes created using clone
__WNOTHREAD = 29,
__WALL = 30,
__WCLONE = 31,
}SourceOptions for wait syscalls
Wait_Options
Wait_Options :: bit_set[Wait_Option; i32]SourceTODO(flysand): Its taking too much effort to bind the other data structures related to perf_event_open Options for wait4(2) and waitpid(2).
Wd
Wd :: i32SourceRepresents a watch descriptor.
_Arch_Semid_DS
_Arch_Semid_DS :: struct {
perm: IPC_Perm,
otime: int,
ctime: int,
nsems: uint,
_: [2]uint,
}Source_Arch_Stat
_Arch_Stat :: struct {
dev: Dev,
ino: Inode,
nlink: uint,
mode: Mode,
uid: Uid,
gid: Gid,
_: u32,
rdev: Dev,
size: uint,
blksize: uint,
blocks: uint,
atime: Time_Spec,
mtime: Time_Spec,
ctime: Time_Spec,
_: [3]uint,
}Sourcex86-64 has mode and nlink swapped for some reason
_Arch_User_FPX_Regs
_Arch_User_FPX_Regs :: struct {
cwd: u16,
swd: u16,
twd: u16,
fop: u16,
fip: uint,
fcs: uint,
foo: uint,
fos: uint,
mxcsr: uint,
_: uint,
st_space: [32]uint,
xmm_space: [32]uint,
padding: [56]uint,
}SourceFXSR instruction set state
_Arch_User_FP_Regs
_Arch_User_FP_Regs :: struct {
cwd: u16,
swd: u16,
twd: u16,
fop: u16,
rip: uint,
rdp: uint,
mxcsr: u32,
mxcsr_mask: u32,
st_space: [32]u32,
xmm_space: [64]u32,
_: [24]u32,
}SourceAll floating point state
_Arch_User_Regs
_Arch_User_Regs :: struct {
// Callee-preserved, may not be correct if the syscall doesn't need
// these registers
r15: uint,
r14: uint,
r13: uint,
r12: uint,
rbp: uint,
rbx: uint,
// Always saved
r11: uint,
r10: uint,
r9: uint,
r8: uint,
rax: uint,
rcx: uint,
rdx: uint,
rsi: uint,
rdi: uint,
// On syscall entry this is the syscall number, on CPU exception this
// is the error code, on hardware interrupt this is its IRQ number
orig_rax: uint,
// Return frame for iretq
rip: uint,
cs: uint,
eflags: uint,
rsp: uint,
ss: uint,
fs_base: uint,
gs_base: uint,
ds: uint,
es: uint,
fs: uint,
gs: uint,
}SourceConstants
557ADDR_COMPAT_LAYOUT
ADDR_COMPAT_LAYOUT :: 21SourceADDR_LIMIT_32BIT
ADDR_LIMIT_32BIT :: 23SourceADDR_LIMIT_3GB
ADDR_LIMIT_3GB :: 27SourceADDR_NO_RANDOMIZE
ADDR_NO_RANDOMIZE :: 18SourceAT_FDCWD
AT_FDCWD :: Fd = Fd(-100)SourceSpecial file descriptor to pass to *at functions to specify
that relative paths are relative to current directory.FDPIC_FUNCPTRS
FDPIC_FUNCPTRS :: 19SourceFUTEX_CMP_REQUEUE
FUTEX_CMP_REQUEUE :: Futex_Cmp_Requeue_Type = Futex_Cmp_Requeue_Type(.CMP_REQUEUE)SourceRequeue waiters from one futex to another if the value at mutex matches.
FUTEX_CMP_REQUEUE_PI
FUTEX_CMP_REQUEUE_PI :: Futex_Cmp_requeue_Pi_Type = Futex_Cmp_requeue_Pi_Type(.CMP_REQUEUE_PI)SourceFUTEX_FD
FUTEX_FD :: Futex_Fd_Type = Futex_Fd_Type(.FD)SourceNot implemented. Basically, since.
FUTEX_LOCK_PI
FUTEX_LOCK_PI :: Futex_Lock_Pi_Type = Futex_Lock_Pi_Type(.LOCK_PI)SourceTODO(flysand): Priority inversion futexes
FUTEX_LOCK_PI2
FUTEX_LOCK_PI2 :: Futex_Lock_Pi2_Type = Futex_Lock_Pi2_Type(.LOCK_PI2)SourceFUTEX_REQUEUE
FUTEX_REQUEUE :: Futex_Requeue_Type = Futex_Requeue_Type(.REQUEUE)SourceRequeue waiters from one futex to another.
FUTEX_TRYLOCK_PI
FUTEX_TRYLOCK_PI :: Futex_Trylock_Pi_Type = Futex_Trylock_Pi_Type(.TRYLOCK_PI)SourceFUTEX_UNLOCK_PI
FUTEX_UNLOCK_PI :: Futex_Unlock_Pi_Type = Futex_Unlock_Pi_Type(.UNLOCK_PI)SourceFUTEX_WAIT
FUTEX_WAIT :: Futex_Wait_Type = Futex_Wait_Type(.WAIT)SourceWait on futex wakeup signal.
FUTEX_WAIT_BITSET
FUTEX_WAIT_BITSET :: Futex_Wait_Bitset_Type = Futex_Wait_Bitset_Type(.WAIT_BITSET)SourceWait on a futex, but the value is a bitset.
FUTEX_WAIT_REQUEUE_PI
FUTEX_WAIT_REQUEUE_PI :: Futex_Wait_requeue_Pi_Type = Futex_Wait_requeue_Pi_Type(.WAIT_REQUEUE_PI)SourceFUTEX_WAKE
FUTEX_WAKE :: Futex_Wake_Type = Futex_Wake_Type(.WAKE)SourceWake up other processes waiting on the futex.
FUTEX_WAKE_BITSET
FUTEX_WAKE_BITSET :: Futex_Wake_Bitset_Type = Futex_Wake_Bitset_Type(.WAKE_BITSET)SourceWait on a futex, but the value is a bitset.
FUTEX_WAKE_OP
FUTEX_WAKE_OP :: Futex_Wake_Op_Type = Futex_Wake_Op_Type(.WAKE_OP)SourceSee man pages, I'm not describing it here.
F_ADD_SEALS
F_ADD_SEALS :: FCntl_Command_ADD_SEALS = FCntl_Command_ADD_SEALS(.ADD_SEALS)SourceF_DUPFD
F_DUPFD :: FCntl_Command_DUPFD = FCntl_Command_DUPFD(.DUPFD)SourceF_DUPFD_CLOEXEC
F_DUPFD_CLOEXEC :: FCntl_Command_DUPFD_CLOEXEC = FCntl_Command_DUPFD_CLOEXEC(.DUPFD_CLOEXEC)SourceF_GETFD
F_GETFD :: FCntl_Command_GETFD = FCntl_Command_GETFD(.GETFD)SourceF_GETFL
F_GETFL :: FCntl_Command_GETFL = FCntl_Command_GETFL(.GETFL)SourceF_GETLEASE
F_GETLEASE :: FCntl_Command_GETLEASE = FCntl_Command_GETLEASE(.GETLEASE)SourceF_GETLK
F_GETLK :: FCntl_Command_GETLK = FCntl_Command_GETLK(.GETLK)SourceF_GETLK64 :: FCntl_Command_GETLK64(.GETLK64) F_SETLK64 :: FCntl_Command_SETLK64(.SETLK64) F_SETLKW64 :: FCntl_Command_SETLKW64(.SETLKW64)
F_GETOWN
F_GETOWN :: FCntl_Command_GETOWN = FCntl_Command_GETOWN(.GETOWN)SourceF_GETOWN_EX
F_GETOWN_EX :: FCntl_Command_GETOWN_EX = FCntl_Command_GETOWN_EX(.GETOWN_EX)SourceF_GETPIPE_SZ
F_GETPIPE_SZ :: FCntl_Command_GETPIPE_SZ = FCntl_Command_GETPIPE_SZ(.GETPIPE_SZ)SourceF_GETSIG
F_GETSIG :: FCntl_Command_GETSIG = FCntl_Command_GETSIG(.GETSIG)SourceF_GET_FILE_RW_HINT
F_GET_FILE_RW_HINT :: FCntl_Command_GET_FILE_RW_HINT = FCntl_Command_GET_FILE_RW_HINT(.GET_FILE_RW_HINT)SourceF_GET_RW_HINT
F_GET_RW_HINT :: FCntl_Command_GET_RW_HINT = FCntl_Command_GET_RW_HINT(.GET_RW_HINT)SourceF_GET_SEALS
F_GET_SEALS :: FCntl_Command_GET_SEALS = FCntl_Command_GET_SEALS(.GET_SEALS)SourceF_NOTIFY
F_NOTIFY :: FCntl_Command_NOTIFY = FCntl_Command_NOTIFY(.NOTIFY)SourceF_OK
F_OK :: Mode = Mode{}SourceFor access.2 syscall family: instruct to check if the file exists.
F_SETFD
F_SETFD :: FCntl_Command_SETFD = FCntl_Command_SETFD(.SETFD)SourceF_SETFL
F_SETFL :: FCntl_Command_SETFL = FCntl_Command_SETFL(.SETFL)SourceF_SETLEASE
F_SETLEASE :: FCntl_Command_SETLEASE = FCntl_Command_SETLEASE(.SETLEASE)SourceF_SETLK
F_SETLK :: FCntl_Command_SETLK = FCntl_Command_SETLK(.SETLK)SourceF_SETLKW
F_SETLKW :: FCntl_Command_SETLKW = FCntl_Command_SETLKW(.SETLKW)SourceF_SETOWN
F_SETOWN :: FCntl_Command_SETOWN = FCntl_Command_SETOWN(.SETOWN)SourceF_SETOWN_EX
F_SETOWN_EX :: FCntl_Command_SETOWN_EX = FCntl_Command_SETOWN_EX(.SETOWN_EX)SourceF_SETPIPE_SZ
F_SETPIPE_SZ :: FCntl_Command_SETPIPE_SZ = FCntl_Command_SETPIPE_SZ(.SETPIPE_SZ)SourceF_SETSIG
F_SETSIG :: FCntl_Command_SETSIG = FCntl_Command_SETSIG(.SETSIG)SourceF_SET_FILE_RW_HINT
F_SET_FILE_RW_HINT :: FCntl_Command_SET_FILE_RW_HINT = FCntl_Command_SET_FILE_RW_HINT(.SET_FILE_RW_HINT)SourceF_SET_RW_HINT
F_SET_RW_HINT :: FCntl_Command_SET_RW_HINT = FCntl_Command_SET_RW_HINT(.SET_RW_HINT)SourceIN_ALL_EVENTS
IN_ALL_EVENTS :: Inotify_Event_Mask = Inotify_Event_Mask {
.ACCESS,
.MODIFY,
.ATTRIB,
.CLOSE_WRITE,
.CLOSE_NOWRITE,
.OPEN,
.MOVED_FROM,
.MOVED_TO,
.CREATE,
.DELETE,
.DELETE_SELF,
.MOVE_SELF,
}SourceIN_CLOSE
IN_CLOSE :: Inotify_Event_Mask = Inotify_Event_Mask {
.CLOSE_WRITE,
.CLOSE_NOWRITE,
}SourceIN_MOVE
IN_MOVE :: Inotify_Event_Mask = Inotify_Event_Mask {
.MOVED_FROM,
.MOVED_TO,
}SourceIORING_OFF_CQ_RING
IORING_OFF_CQ_RING :: 0x8000000SourceIORING_OFF_MMAP_MASK
IORING_OFF_MMAP_MASK :: 0xf8000000SourceIORING_OFF_PBUF_RING
IORING_OFF_PBUF_RING :: 0x80000000SourceIORING_OFF_PBUF_SHIFT
IORING_OFF_PBUF_SHIFT :: 16SourceIORING_OFF_SQES
IORING_OFF_SQES :: 0x10000000SourceIORING_OFF_SQ_RING
IORING_OFF_SQ_RING :: 0SourceIORING_TIMEOUT_CLOCK_MASK
IORING_TIMEOUT_CLOCK_MASK :: IO_Uring_Timeout_Flags = IO_Uring_Timeout_Flags{.BOOTTIME, .REALTIME}SourceIORING_TIMEOUT_UPDATE_MASK
IORING_TIMEOUT_UPDATE_MASK :: IO_Uring_Timeout_Flags = IO_Uring_Timeout_Flags{.UPDATE, .LINK_TIMEOUT_UPDATE}SourceIPC_PRIVATE
IPC_PRIVATE :: Key = Key(0)SourceTell shmget to create a new key
MAP_HUGE_16GB
MAP_HUGE_16GB :: _ = transmute(Map_Flags)(u32(34) << MAP_HUGE_SHIFT)SourceMAP_HUGE_16KB
MAP_HUGE_16KB :: _ = transmute(Map_Flags)(u32(14) << MAP_HUGE_SHIFT)SourceMAP_HUGE_16MB
MAP_HUGE_16MB :: _ = transmute(Map_Flags)(u32(24) << MAP_HUGE_SHIFT)SourceMAP_HUGE_1GB
MAP_HUGE_1GB :: _ = transmute(Map_Flags)(u32(30) << MAP_HUGE_SHIFT)SourceMAP_HUGE_1MB
MAP_HUGE_1MB :: _ = transmute(Map_Flags)(u32(20) << MAP_HUGE_SHIFT)SourceMAP_HUGE_256MB
MAP_HUGE_256MB :: _ = transmute(Map_Flags)(u32(28) << MAP_HUGE_SHIFT)SourceMAP_HUGE_2GB
MAP_HUGE_2GB :: _ = transmute(Map_Flags)(u32(31) << MAP_HUGE_SHIFT)SourceMAP_HUGE_2MB
MAP_HUGE_2MB :: _ = transmute(Map_Flags)(u32(21) << MAP_HUGE_SHIFT)SourceMAP_HUGE_32MB
MAP_HUGE_32MB :: _ = transmute(Map_Flags)(u32(25) << MAP_HUGE_SHIFT)SourceMAP_HUGE_512KB
MAP_HUGE_512KB :: _ = transmute(Map_Flags)(u32(19) << MAP_HUGE_SHIFT)SourceMAP_HUGE_512MB
MAP_HUGE_512MB :: _ = transmute(Map_Flags)(u32(29) << MAP_HUGE_SHIFT)SourceMAP_HUGE_64KB
MAP_HUGE_64KB :: _ = transmute(Map_Flags)(u32(16) << MAP_HUGE_SHIFT)SourceMAP_HUGE_8MB
MAP_HUGE_8MB :: _ = transmute(Map_Flags)(u32(23) << MAP_HUGE_SHIFT)SourceMAP_HUGE_MASK
MAP_HUGE_MASK :: 63SourceMAP_HUGE_SHIFT
MAP_HUGE_SHIFT :: 26SourceMAP_SHARED_VALIDATE
MAP_SHARED_VALIDATE :: Map_Flags = Map_Flags{.SHARED, .PRIVATE}SourceMFD_HUGE_16GB
MFD_HUGE_16GB :: _ = transmute(Memfd_Create_Flags)(u32(34) << MAP_HUGE_SHIFT)SourceMFD_HUGE_16KB
MFD_HUGE_16KB :: _ = transmute(Memfd_Create_Flags)(u32(14) << MAP_HUGE_SHIFT)SourceMFD_HUGE_16MB
MFD_HUGE_16MB :: _ = transmute(Memfd_Create_Flags)(u32(24) << MAP_HUGE_SHIFT)SourceMFD_HUGE_1GB
MFD_HUGE_1GB :: _ = transmute(Memfd_Create_Flags)(u32(30) << MAP_HUGE_SHIFT)SourceMFD_HUGE_1MB
MFD_HUGE_1MB :: _ = transmute(Memfd_Create_Flags)(u32(20) << MAP_HUGE_SHIFT)SourceMFD_HUGE_256MB
MFD_HUGE_256MB :: _ = transmute(Memfd_Create_Flags)(u32(28) << MAP_HUGE_SHIFT)SourceMFD_HUGE_2GB
MFD_HUGE_2GB :: _ = transmute(Memfd_Create_Flags)(u32(31) << MAP_HUGE_SHIFT)SourceMFD_HUGE_2MB
MFD_HUGE_2MB :: _ = transmute(Memfd_Create_Flags)(u32(21) << MAP_HUGE_SHIFT)SourceMFD_HUGE_32MB
MFD_HUGE_32MB :: _ = transmute(Memfd_Create_Flags)(u32(25) << MAP_HUGE_SHIFT)SourceMFD_HUGE_512KB
MFD_HUGE_512KB :: _ = transmute(Memfd_Create_Flags)(u32(19) << MAP_HUGE_SHIFT)SourceMFD_HUGE_512MB
MFD_HUGE_512MB :: _ = transmute(Memfd_Create_Flags)(u32(29) << MAP_HUGE_SHIFT)SourceMFD_HUGE_64KB
MFD_HUGE_64KB :: _ = transmute(Memfd_Create_Flags)(u32(16) << MAP_HUGE_SHIFT)SourceMFD_HUGE_8MB
MFD_HUGE_8MB :: _ = transmute(Memfd_Create_Flags)(u32(23) << MAP_HUGE_SHIFT)SourceMMAP_PAGE_ZERO
MMAP_PAGE_ZERO :: 20SourcePER_BSD
PER_BSD :: 0x0006SourcePER_HPUX
PER_HPUX :: 0x0010SourcePER_IRIX32
PER_IRIX32 :: 0x0009 | STICKY_TIMEOUTSSourcePER_IRIX64
PER_IRIX64 :: 0x000b | STICKY_TIMEOUTSSourcePER_IRIXN32
PER_IRIXN32 :: 0x000a | STICKY_TIMEOUTSSourcePER_ISCR4
PER_ISCR4 :: 0x0005 | STICKY_TIMEOUTSSourcePER_LINUX
PER_LINUX :: 0x0000SourcePersonality type
These go into the bottom 8 bits of the personality valuePER_LINUX32
PER_LINUX32 :: 0x0008SourcePER_LINUX32_3GB
PER_LINUX32_3GB :: 0x0008 | ADDR_LIMIT_3GBSourcePER_LINUX_32BIT
PER_LINUX_32BIT :: 0x0000 | ADDR_LIMIT_32BITSourcePER_LINUX_FDPIC
PER_LINUX_FDPIC :: 0x0000 | FDPIC_FUNCPTRSSourcePER_MASK
PER_MASK :: 0x00ffSourcePER_OSF4
PER_OSF4 :: 0x000fSourcePER_OSR5
PER_OSR5 :: 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDSSourcePER_RISCOS
PER_RISCOS :: 0x000cSourcePER_SCOSVR3
PER_SCOSVR3 :: 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODESourcePER_SOLARIS
PER_SOLARIS :: 0x000d | STICKY_TIMEOUTSSourcePER_SUNOS
PER_SUNOS :: 0x0006 | STICKY_TIMEOUTSSourcePER_SVR3
PER_SVR3 :: 0x0002 | STICKY_TIMEOUTS | SHORT_INODESourcePER_SVR4
PER_SVR4 :: 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZEROSourcePER_UW7
PER_UW7 :: 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZEROSourcePER_WYSEV386
PER_WYSEV386 :: 0x0004 | STICKY_TIMEOUTS | SHORT_INODESourcePER_XENIX
PER_XENIX :: 0x0007 | STICKY_TIMEOUTS | SHORT_INODESourcePRIO_MAX
PRIO_MAX :: 20SourceMaximum priority (aka nice value) for the process.
PRIO_MIN
PRIO_MIN :: -20SourceMinimum priority (aka nice value) for the process.
PTRACE_ARCH_PRCTL
PTRACE_ARCH_PRCTL :: PTrace_Arch_Prctl_Type = PTrace_Arch_Prctl_Type(.ARCH_PRCTL)SourcePTRACE_ATTACH
PTRACE_ATTACH :: PTrace_Attach_Type = PTrace_Attach_Type(.ATTACH)SourcePTRACE_CONT
PTRACE_CONT :: PTrace_Cont_Type = PTrace_Cont_Type(.CONT)SourcePTRACE_DETACH
PTRACE_DETACH :: PTrace_Detach_Type = PTrace_Detach_Type(.DETACH)SourcePTRACE_GETEVENTMSG
PTRACE_GETEVENTMSG :: PTrace_Geteventmsg_Type = PTrace_Geteventmsg_Type(.GETEVENTMSG)SourcePTRACE_GETFPREGS
PTRACE_GETFPREGS :: PTrace_Getfpregs_Type = PTrace_Getfpregs_Type(.GETFPREGS)SourcePTRACE_GETFPXREGS
PTRACE_GETFPXREGS :: PTrace_Getfpxregs_Type = PTrace_Getfpxregs_Type(.GETFPXREGS)SourcePTRACE_GETREGS
PTRACE_GETREGS :: PTrace_Getregs_Type = PTrace_Getregs_Type(.GETREGS)SourcePTRACE_GETREGSET
PTRACE_GETREGSET :: PTrace_Getregset_Type = PTrace_Getregset_Type(.GETREGSET)SourcePTRACE_GETSIGINFO
PTRACE_GETSIGINFO :: PTrace_Getsiginfo_Type = PTrace_Getsiginfo_Type(.GETSIGINFO)SourcePTRACE_GETSIGMASK
PTRACE_GETSIGMASK :: PTrace_Getsigmask_Type = PTrace_Getsigmask_Type(.GETSIGMASK)SourcePTRACE_GET_RSEQ_CONFIGURATION
PTRACE_GET_RSEQ_CONFIGURATION :: PTrace_Get_RSeq_Configuration_Type = PTrace_Get_RSeq_Configuration_Type(.GET_RSEQ_CONFIGURATION)SourcePTRACE_GET_SYSCALL_INFO
PTRACE_GET_SYSCALL_INFO :: PTrace_Get_Syscall_Info_Type = PTrace_Get_Syscall_Info_Type(.GET_SYSCALL_INFO)SourcePTRACE_GET_THREAD_AREA
PTRACE_GET_THREAD_AREA :: PTrace_Get_Thread_Area_Type = PTrace_Get_Thread_Area_Type(.GET_THREAD_AREA)SourcePTRACE_INTERRUPT
PTRACE_INTERRUPT :: PTrace_Interrupt_Type = PTrace_Interrupt_Type(.INTERRUPT)SourcePTRACE_KILL
PTRACE_KILL :: PTrace_Kill_Type = PTrace_Kill_Type(.KILL)SourcePTRACE_LISTEN
PTRACE_LISTEN :: PTrace_Listen_Type = PTrace_Listen_Type(.LISTEN)SourcePTRACE_PEEKDATA
PTRACE_PEEKDATA :: PTrace_Peek_Type = PTrace_Peek_Type(.PEEKDATA)SourcePTRACE_PEEKSIGINFO
PTRACE_PEEKSIGINFO :: PTrace_Peeksiginfo_Type = PTrace_Peeksiginfo_Type(.PEEKSIGINFO)SourcePTRACE_PEEKTEXT
PTRACE_PEEKTEXT :: PTrace_Peek_Type = PTrace_Peek_Type(.PEEKTEXT)SourcePTRACE_PEEKUSER
PTRACE_PEEKUSER :: PTrace_Peek_Type = PTrace_Peek_Type(.PEEKUSER)SourcePTRACE_POKEDATA
PTRACE_POKEDATA :: PTrace_Poke_Type = PTrace_Poke_Type(.POKEDATA)SourcePTRACE_POKETEXT
PTRACE_POKETEXT :: PTrace_Poke_Type = PTrace_Poke_Type(.POKETEXT)SourcePTRACE_POKEUSER
PTRACE_POKEUSER :: PTrace_Poke_Type = PTrace_Poke_Type(.POKEUSER)SourcePTRACE_SECCOMP_GET_FILTER
PTRACE_SECCOMP_GET_FILTER :: PTrace_Seccomp_Get_Filter_Type = PTrace_Seccomp_Get_Filter_Type(.SECCOMP_GET_FILTER)SourcePTRACE_SECCOMP_GET_METADATA
PTRACE_SECCOMP_GET_METADATA :: PTrace_Seccomp_Get_Metadata_Type = PTrace_Seccomp_Get_Metadata_Type(.SECCOMP_GET_METADATA)SourcePTRACE_SEIZE
PTRACE_SEIZE :: PTrace_Seize_Type = PTrace_Seize_Type(.SEIZE)SourcePTRACE_SETFPREGS
PTRACE_SETFPREGS :: PTrace_Setfpregs_Type = PTrace_Setfpregs_Type(.SETFPREGS)SourcePTRACE_SETFPXREGS
PTRACE_SETFPXREGS :: PTrace_Setfpxregs_Type = PTrace_Setfpxregs_Type(.SETFPXREGS)SourcePTRACE_SETOPTIONS
PTRACE_SETOPTIONS :: PTrace_Setoptions_Type = PTrace_Setoptions_Type(.SETOPTIONS)SourcePTRACE_SETREGS
PTRACE_SETREGS :: PTrace_Setregs_Type = PTrace_Setregs_Type(.SETREGS)SourcePTRACE_SETREGSET
PTRACE_SETREGSET :: PTrace_Setregset_Type = PTrace_Setregset_Type(.SETREGSET)SourcePTRACE_SETSIGINFO
PTRACE_SETSIGINFO :: PTrace_Setsiginfo_Type = PTrace_Setsiginfo_Type(.SETSIGINFO)SourcePTRACE_SETSIGMASK
PTRACE_SETSIGMASK :: PTrace_Setsigmask_Type = PTrace_Setsigmask_Type(.SETSIGMASK)SourcePTRACE_SET_THREAD_AREA
PTRACE_SET_THREAD_AREA :: PTrace_Set_Thread_Area_Type = PTrace_Set_Thread_Area_Type(.SET_THREAD_AREA)SourcePTRACE_SINGLEBLOCK
PTRACE_SINGLEBLOCK :: PTrace_Singleblock_Type = PTrace_Singleblock_Type(.SINGLEBLOCK)SourcePTRACE_SINGLESTEP
PTRACE_SINGLESTEP :: PTrace_Singlestep_Type = PTrace_Singlestep_Type(.SINGLESTEP)SourcePTRACE_SYSCALL
PTRACE_SYSCALL :: PTrace_Syscall_Type = PTrace_Syscall_Type(.SYSCALL)SourcePTRACE_SYSEMU
PTRACE_SYSEMU :: PTrace_Sysemu_Type = PTrace_Sysemu_Type(.SYSEMU)SourcePTRACE_SYSEMU_SINGLESTEP
PTRACE_SYSEMU_SINGLESTEP :: PTrace_Sysemu_Singlestep_Type = PTrace_Sysemu_Singlestep_Type(.SYSEMU_SINGLESTEP)SourcePTRACE_TRACEME
PTRACE_TRACEME :: PTrace_Traceme_Type = PTrace_Traceme_Type(.TRACEME)SourceREAD_IMPLIES_EXEC
READ_IMPLIES_EXEC :: 22SourceR_OK
R_OK :: Mode = Mode{.IROTH}SourceFor access.2 syscall family: instruct to check if the file is readable.
SHORT_INODE
SHORT_INODE :: 24SourceSIGEV_MAX_SIZE
SIGEV_MAX_SIZE :: 64SourceSIGEV_PAD_SIZE
SIGEV_PAD_SIZE :: ((SIGEV_MAX_SIZE-size_of(i32)*2+size_of(Sig_Val))/size_of(i32))SourceSIGRTMAX
SIGRTMAX :: Signal = Signal(64)SourceSIGRTMIN
SIGRTMIN :: Signal = Signal(32)SourceSOL_RAW
SOL_RAW :: Socket_API_Level_Raw = Socket_API_Level_Raw(.RAW)SourceSOL_SOCKET
SOL_SOCKET :: Socket_API_Level_Sock = Socket_API_Level_Sock(.SOCKET)SourceSOL_TCP
SOL_TCP :: Socket_API_Level_TCP = Socket_API_Level_TCP(.TCP)SourceSOL_UDP
SOL_UDP :: Socket_API_Level_UDP = Socket_API_Level_UDP(.UDP)SourceSTATX_BASIC_STATS
STATX_BASIC_STATS :: Statx_Mask = Statx_Mask {
.TYPE,
.MODE,
.NLINK,
.UID,
.GID,
.ATIME,
.MTIME,
.CTIME,
.INO,
.SIZE,
.BLOCKS,
}SourceThe stats you get by calling stat.
STDERR_FILENO
STDERR_FILENO :: Fd = Fd(2)SourceStandard error file descriptor
STDIN_FILENO
STDIN_FILENO :: Fd = Fd(0)SourceStandard input file descriptor
STDOUT_FILENO
STDOUT_FILENO :: Fd = Fd(1)SourceStandard output file descriptor
STICKY_TIMEOUTS
STICKY_TIMEOUTS :: 26SourceSWAP_FLAG_PRIO_MASK
SWAP_FLAG_PRIO_MASK :: u32 = u32(0x7fff)SourceSWAP_FLAG_PRIO_SHIFT
SWAP_FLAG_PRIO_SHIFT :: u32 = u32(0)SourceSYS__sysctl
SYS__sysctl :: uintptr = uintptr(156)SourceSYS_accept
SYS_accept :: uintptr = uintptr(43)SourceSYS_accept4
SYS_accept4 :: uintptr = uintptr(288)SourceSYS_access
SYS_access :: uintptr = uintptr(21)SourceSYS_acct
SYS_acct :: uintptr = uintptr(163)SourceSYS_add_key
SYS_add_key :: uintptr = uintptr(248)SourceSYS_adjtimex
SYS_adjtimex :: uintptr = uintptr(159)SourceSYS_afs_syscall
SYS_afs_syscall :: uintptr = uintptr(183)SourceSYS_alarm
SYS_alarm :: uintptr = uintptr(37)SourceSYS_arch_prctl
SYS_arch_prctl :: uintptr = uintptr(158)SourceSYS_bind
SYS_bind :: uintptr = uintptr(49)SourceSYS_bpf
SYS_bpf :: uintptr = uintptr(321)SourceSYS_brk
SYS_brk :: uintptr = uintptr(12)SourceSYS_cachestat
SYS_cachestat :: uintptr = uintptr(451)SourceSYS_capget
SYS_capget :: uintptr = uintptr(125)SourceSYS_capset
SYS_capset :: uintptr = uintptr(126)SourceSYS_chdir
SYS_chdir :: uintptr = uintptr(80)SourceSYS_chmod
SYS_chmod :: uintptr = uintptr(90)SourceSYS_chown
SYS_chown :: uintptr = uintptr(92)SourceSYS_chroot
SYS_chroot :: uintptr = uintptr(161)SourceSYS_clock_adjtime
SYS_clock_adjtime :: uintptr = uintptr(305)SourceSYS_clock_getres
SYS_clock_getres :: uintptr = uintptr(229)SourceSYS_clock_gettime
SYS_clock_gettime :: uintptr = uintptr(228)SourceSYS_clock_nanosleep
SYS_clock_nanosleep :: uintptr = uintptr(230)SourceSYS_clock_settime
SYS_clock_settime :: uintptr = uintptr(227)SourceSYS_clone
SYS_clone :: uintptr = uintptr(56)SourceSYS_clone3
SYS_clone3 :: uintptr = uintptr(435)SourceSYS_close
SYS_close :: uintptr = uintptr(3)SourceSYS_close_range
SYS_close_range :: uintptr = uintptr(436)SourceSYS_connect
SYS_connect :: uintptr = uintptr(42)SourceSYS_copy_file_range
SYS_copy_file_range :: uintptr = uintptr(326)SourceSYS_creat
SYS_creat :: uintptr = uintptr(85)SourceSYS_create_module
SYS_create_module :: uintptr = uintptr(174)SourceSYS_delete_module
SYS_delete_module :: uintptr = uintptr(176)SourceSYS_dup
SYS_dup :: uintptr = uintptr(32)SourceSYS_dup2
SYS_dup2 :: uintptr = uintptr(33)SourceSYS_dup3
SYS_dup3 :: uintptr = uintptr(292)SourceSYS_epoll_create
SYS_epoll_create :: uintptr = uintptr(213)SourceSYS_epoll_create1
SYS_epoll_create1 :: uintptr = uintptr(291)SourceSYS_epoll_ctl
SYS_epoll_ctl :: uintptr = uintptr(233)SourceSYS_epoll_ctl_old
SYS_epoll_ctl_old :: uintptr = uintptr(214)SourceSYS_epoll_pwait
SYS_epoll_pwait :: uintptr = uintptr(281)SourceSYS_epoll_pwait2
SYS_epoll_pwait2 :: uintptr = uintptr(441)SourceSYS_epoll_wait
SYS_epoll_wait :: uintptr = uintptr(232)SourceSYS_epoll_wait_old
SYS_epoll_wait_old :: uintptr = uintptr(215)SourceSYS_eventfd
SYS_eventfd :: uintptr = uintptr(284)SourceSYS_eventfd2
SYS_eventfd2 :: uintptr = uintptr(290)SourceSYS_execve
SYS_execve :: uintptr = uintptr(59)SourceSYS_execveat
SYS_execveat :: uintptr = uintptr(322)SourceSYS_exit
SYS_exit :: uintptr = uintptr(60)SourceSYS_exit_group
SYS_exit_group :: uintptr = uintptr(231)SourceSYS_faccessat
SYS_faccessat :: uintptr = uintptr(269)SourceSYS_faccessat2
SYS_faccessat2 :: uintptr = uintptr(439)SourceSYS_fadvise64
SYS_fadvise64 :: uintptr = uintptr(221)SourceSYS_fallocate
SYS_fallocate :: uintptr = uintptr(285)SourceSYS_fanotify_init
SYS_fanotify_init :: uintptr = uintptr(300)SourceSYS_fanotify_mark
SYS_fanotify_mark :: uintptr = uintptr(301)SourceSYS_fchdir
SYS_fchdir :: uintptr = uintptr(81)SourceSYS_fchmod
SYS_fchmod :: uintptr = uintptr(91)SourceSYS_fchmodat
SYS_fchmodat :: uintptr = uintptr(268)SourceSYS_fchmodat2
SYS_fchmodat2 :: uintptr = uintptr(452)SourceSYS_fchown
SYS_fchown :: uintptr = uintptr(93)SourceSYS_fchownat
SYS_fchownat :: uintptr = uintptr(260)SourceSYS_fcntl
SYS_fcntl :: uintptr = uintptr(72)SourceSYS_fdatasync
SYS_fdatasync :: uintptr = uintptr(75)SourceSYS_fgetxattr
SYS_fgetxattr :: uintptr = uintptr(193)SourceSYS_finit_module
SYS_finit_module :: uintptr = uintptr(313)SourceSYS_flistxattr
SYS_flistxattr :: uintptr = uintptr(196)SourceSYS_flock
SYS_flock :: uintptr = uintptr(73)SourceSYS_fork
SYS_fork :: uintptr = uintptr(57)SourceSYS_fremovexattr
SYS_fremovexattr :: uintptr = uintptr(199)SourceSYS_fsconfig
SYS_fsconfig :: uintptr = uintptr(431)SourceSYS_fsetxattr
SYS_fsetxattr :: uintptr = uintptr(190)SourceSYS_fsmount
SYS_fsmount :: uintptr = uintptr(432)SourceSYS_fsopen
SYS_fsopen :: uintptr = uintptr(430)SourceSYS_fspick
SYS_fspick :: uintptr = uintptr(433)SourceSYS_fstat
SYS_fstat :: uintptr = uintptr(5)SourceSYS_fstatfs
SYS_fstatfs :: uintptr = uintptr(138)SourceSYS_fsync
SYS_fsync :: uintptr = uintptr(74)SourceSYS_ftruncate
SYS_ftruncate :: uintptr = uintptr(77)SourceSYS_futex
SYS_futex :: uintptr = uintptr(202)SourceSYS_futex_waitv
SYS_futex_waitv :: uintptr = uintptr(449)SourceSYS_futimesat
SYS_futimesat :: uintptr = uintptr(261)SourceSYS_get_kernel_syms
SYS_get_kernel_syms :: uintptr = uintptr(177)SourceSYS_get_mempolicy
SYS_get_mempolicy :: uintptr = uintptr(239)SourceSYS_get_robust_list
SYS_get_robust_list :: uintptr = uintptr(274)SourceSYS_get_thread_area
SYS_get_thread_area :: uintptr = uintptr(211)SourceSYS_getcpu
SYS_getcpu :: uintptr = uintptr(309)SourceSYS_getcwd
SYS_getcwd :: uintptr = uintptr(79)SourceSYS_getdents
SYS_getdents :: uintptr = uintptr(78)SourceSYS_getdents64
SYS_getdents64 :: uintptr = uintptr(217)SourceSYS_getegid
SYS_getegid :: uintptr = uintptr(108)SourceSYS_geteuid
SYS_geteuid :: uintptr = uintptr(107)SourceSYS_getgid
SYS_getgid :: uintptr = uintptr(104)SourceSYS_getgroups
SYS_getgroups :: uintptr = uintptr(115)SourceSYS_getitimer
SYS_getitimer :: uintptr = uintptr(36)SourceSYS_getpeername
SYS_getpeername :: uintptr = uintptr(52)SourceSYS_getpgid
SYS_getpgid :: uintptr = uintptr(121)SourceSYS_getpgrp
SYS_getpgrp :: uintptr = uintptr(111)SourceSYS_getpid
SYS_getpid :: uintptr = uintptr(39)SourceSYS_getpmsg
SYS_getpmsg :: uintptr = uintptr(181)SourceSYS_getppid
SYS_getppid :: uintptr = uintptr(110)SourceSYS_getpriority
SYS_getpriority :: uintptr = uintptr(140)SourceSYS_getrandom
SYS_getrandom :: uintptr = uintptr(318)SourceSYS_getresgid
SYS_getresgid :: uintptr = uintptr(120)SourceSYS_getresuid
SYS_getresuid :: uintptr = uintptr(118)SourceSYS_getrlimit
SYS_getrlimit :: uintptr = uintptr(97)SourceSYS_getrusage
SYS_getrusage :: uintptr = uintptr(98)SourceSYS_getsid
SYS_getsid :: uintptr = uintptr(124)SourceSYS_getsockname
SYS_getsockname :: uintptr = uintptr(51)SourceSYS_getsockopt
SYS_getsockopt :: uintptr = uintptr(55)SourceSYS_gettid
SYS_gettid :: uintptr = uintptr(186)SourceSYS_gettimeofday
SYS_gettimeofday :: uintptr = uintptr(96)SourceSYS_getuid
SYS_getuid :: uintptr = uintptr(102)SourceSYS_getxattr
SYS_getxattr :: uintptr = uintptr(191)SourceSYS_init_module
SYS_init_module :: uintptr = uintptr(175)SourceSYS_inotify_add_watch
SYS_inotify_add_watch :: uintptr = uintptr(254)SourceSYS_inotify_init
SYS_inotify_init :: uintptr = uintptr(253)SourceSYS_inotify_init1
SYS_inotify_init1 :: uintptr = uintptr(294)SourceSYS_inotify_rm_watch
SYS_inotify_rm_watch :: uintptr = uintptr(255)SourceSYS_io_cancel
SYS_io_cancel :: uintptr = uintptr(210)SourceSYS_io_destroy
SYS_io_destroy :: uintptr = uintptr(207)SourceSYS_io_getevents
SYS_io_getevents :: uintptr = uintptr(208)SourceSYS_io_pgetevents
SYS_io_pgetevents :: uintptr = uintptr(333)SourceSYS_io_setup
SYS_io_setup :: uintptr = uintptr(206)SourceSYS_io_submit
SYS_io_submit :: uintptr = uintptr(209)SourceSYS_io_uring_enter
SYS_io_uring_enter :: uintptr = uintptr(426)SourceSYS_io_uring_register
SYS_io_uring_register :: uintptr = uintptr(427)SourceSYS_io_uring_setup
SYS_io_uring_setup :: uintptr = uintptr(425)SourceSYS_ioctl
SYS_ioctl :: uintptr = uintptr(16)SourceSYS_ioperm
SYS_ioperm :: uintptr = uintptr(173)SourceSYS_iopl
SYS_iopl :: uintptr = uintptr(172)SourceSYS_ioprio_get
SYS_ioprio_get :: uintptr = uintptr(252)SourceSYS_ioprio_set
SYS_ioprio_set :: uintptr = uintptr(251)SourceSYS_kcmp
SYS_kcmp :: uintptr = uintptr(312)SourceSYS_kexec_file_load
SYS_kexec_file_load :: uintptr = uintptr(320)SourceSYS_kexec_load
SYS_kexec_load :: uintptr = uintptr(246)SourceSYS_keyctl
SYS_keyctl :: uintptr = uintptr(250)SourceSYS_kill
SYS_kill :: uintptr = uintptr(62)SourceSYS_landlock_add_rule
SYS_landlock_add_rule :: uintptr = uintptr(445)SourceSYS_landlock_create_ruleset
SYS_landlock_create_ruleset :: uintptr = uintptr(444)SourceSYS_landlock_restrict_self
SYS_landlock_restrict_self :: uintptr = uintptr(446)SourceSYS_lchown
SYS_lchown :: uintptr = uintptr(94)SourceSYS_lgetxattr
SYS_lgetxattr :: uintptr = uintptr(192)SourceSYS_link
SYS_link :: uintptr = uintptr(86)SourceSYS_linkat
SYS_linkat :: uintptr = uintptr(265)SourceSYS_listen
SYS_listen :: uintptr = uintptr(50)SourceSYS_listxattr
SYS_listxattr :: uintptr = uintptr(194)SourceSYS_llistxattr
SYS_llistxattr :: uintptr = uintptr(195)SourceSYS_lookup_dcookie
SYS_lookup_dcookie :: uintptr = uintptr(212)SourceSYS_lremovexattr
SYS_lremovexattr :: uintptr = uintptr(198)SourceSYS_lseek
SYS_lseek :: uintptr = uintptr(8)SourceSYS_lsetxattr
SYS_lsetxattr :: uintptr = uintptr(189)SourceSYS_lstat
SYS_lstat :: uintptr = uintptr(6)SourceSYS_madvise
SYS_madvise :: uintptr = uintptr(28)SourceSYS_map_shadow_stack
SYS_map_shadow_stack :: uintptr = uintptr(453)SourceSYS_mbind
SYS_mbind :: uintptr = uintptr(237)SourceSYS_membarrier
SYS_membarrier :: uintptr = uintptr(324)SourceSYS_memfd_create
SYS_memfd_create :: uintptr = uintptr(319)SourceSYS_memfd_secret
SYS_memfd_secret :: uintptr = uintptr(447)SourceSYS_migrate_pages
SYS_migrate_pages :: uintptr = uintptr(256)SourceSYS_mincore
SYS_mincore :: uintptr = uintptr(27)SourceSYS_mkdir
SYS_mkdir :: uintptr = uintptr(83)SourceSYS_mkdirat
SYS_mkdirat :: uintptr = uintptr(258)SourceSYS_mknod
SYS_mknod :: uintptr = uintptr(133)SourceSYS_mknodat
SYS_mknodat :: uintptr = uintptr(259)SourceSYS_mlock
SYS_mlock :: uintptr = uintptr(149)SourceSYS_mlock2
SYS_mlock2 :: uintptr = uintptr(325)SourceSYS_mlockall
SYS_mlockall :: uintptr = uintptr(151)SourceSYS_mmap
SYS_mmap :: uintptr = uintptr(9)SourceSYS_modify_ldt
SYS_modify_ldt :: uintptr = uintptr(154)SourceSYS_mount
SYS_mount :: uintptr = uintptr(165)SourceSYS_mount_setattr
SYS_mount_setattr :: uintptr = uintptr(442)SourceSYS_move_mount
SYS_move_mount :: uintptr = uintptr(429)SourceSYS_move_pages
SYS_move_pages :: uintptr = uintptr(279)SourceSYS_mprotect
SYS_mprotect :: uintptr = uintptr(10)SourceSYS_mq_getsetattr
SYS_mq_getsetattr :: uintptr = uintptr(245)SourceSYS_mq_notify
SYS_mq_notify :: uintptr = uintptr(244)SourceSYS_mq_open
SYS_mq_open :: uintptr = uintptr(240)SourceSYS_mq_timedreceive
SYS_mq_timedreceive :: uintptr = uintptr(243)SourceSYS_mq_timedsend
SYS_mq_timedsend :: uintptr = uintptr(242)SourceSYS_mq_unlink
SYS_mq_unlink :: uintptr = uintptr(241)SourceSYS_mremap
SYS_mremap :: uintptr = uintptr(25)SourceSYS_msgctl
SYS_msgctl :: uintptr = uintptr(71)SourceSYS_msgget
SYS_msgget :: uintptr = uintptr(68)SourceSYS_msgrcv
SYS_msgrcv :: uintptr = uintptr(70)SourceSYS_msgsnd
SYS_msgsnd :: uintptr = uintptr(69)SourceSYS_msync
SYS_msync :: uintptr = uintptr(26)SourceSYS_munlock
SYS_munlock :: uintptr = uintptr(150)SourceSYS_munlockall
SYS_munlockall :: uintptr = uintptr(152)SourceSYS_munmap
SYS_munmap :: uintptr = uintptr(11)SourceSYS_name_to_handle_at
SYS_name_to_handle_at :: uintptr = uintptr(303)SourceSYS_nanosleep
SYS_nanosleep :: uintptr = uintptr(35)SourceSYS_newfstatat
SYS_newfstatat :: uintptr = uintptr(262)SourceSYS_nfsservctl
SYS_nfsservctl :: uintptr = uintptr(180)SourceSYS_open
SYS_open :: uintptr = uintptr(2)SourceSYS_open_by_handle_at
SYS_open_by_handle_at :: uintptr = uintptr(304)SourceSYS_open_tree
SYS_open_tree :: uintptr = uintptr(428)SourceSYS_openat
SYS_openat :: uintptr = uintptr(257)SourceSYS_openat2
SYS_openat2 :: uintptr = uintptr(437)SourceSYS_pause
SYS_pause :: uintptr = uintptr(34)SourceSYS_perf_event_open
SYS_perf_event_open :: uintptr = uintptr(298)SourceSYS_personality
SYS_personality :: uintptr = uintptr(135)SourceSYS_pidfd_getfd
SYS_pidfd_getfd :: uintptr = uintptr(438)SourceSYS_pidfd_open
SYS_pidfd_open :: uintptr = uintptr(434)SourceSYS_pidfd_send_signal
SYS_pidfd_send_signal :: uintptr = uintptr(424)SourceSYS_pipe
SYS_pipe :: uintptr = uintptr(22)SourceSYS_pipe2
SYS_pipe2 :: uintptr = uintptr(293)SourceSYS_pivot_root
SYS_pivot_root :: uintptr = uintptr(155)SourceSYS_pkey_alloc
SYS_pkey_alloc :: uintptr = uintptr(330)SourceSYS_pkey_free
SYS_pkey_free :: uintptr = uintptr(331)SourceSYS_pkey_mprotect
SYS_pkey_mprotect :: uintptr = uintptr(329)SourceSYS_poll
SYS_poll :: uintptr = uintptr(7)SourceSYS_ppoll
SYS_ppoll :: uintptr = uintptr(271)SourceSYS_prctl
SYS_prctl :: uintptr = uintptr(157)SourceSYS_pread64
SYS_pread64 :: uintptr = uintptr(17)SourceSYS_preadv
SYS_preadv :: uintptr = uintptr(295)SourceSYS_preadv2
SYS_preadv2 :: uintptr = uintptr(327)SourceSYS_prlimit64
SYS_prlimit64 :: uintptr = uintptr(302)SourceSYS_process_madvise
SYS_process_madvise :: uintptr = uintptr(440)SourceSYS_process_mrelease
SYS_process_mrelease :: uintptr = uintptr(448)SourceSYS_process_vm_readv
SYS_process_vm_readv :: uintptr = uintptr(310)SourceSYS_process_vm_writev
SYS_process_vm_writev :: uintptr = uintptr(311)SourceSYS_pselect6
SYS_pselect6 :: uintptr = uintptr(270)SourceSYS_ptrace
SYS_ptrace :: uintptr = uintptr(101)SourceSYS_putpmsg
SYS_putpmsg :: uintptr = uintptr(182)SourceSYS_pwrite64
SYS_pwrite64 :: uintptr = uintptr(18)SourceSYS_pwritev
SYS_pwritev :: uintptr = uintptr(296)SourceSYS_pwritev2
SYS_pwritev2 :: uintptr = uintptr(328)SourceSYS_query_module
SYS_query_module :: uintptr = uintptr(178)SourceSYS_quotactl
SYS_quotactl :: uintptr = uintptr(179)SourceSYS_quotactl_fd
SYS_quotactl_fd :: uintptr = uintptr(443)SourceSYS_read
SYS_read :: uintptr = uintptr(0)SourceAMD64 uses the new way to define syscalls, i.e. one that is different from the other architectures. Instead of using a .tbl file, they define constants to tell which syscalls they want and then include a generic unistd.h file.
SYS_readahead
SYS_readahead :: uintptr = uintptr(187)SourceSYS_readlink
SYS_readlink :: uintptr = uintptr(89)SourceSYS_readlinkat
SYS_readlinkat :: uintptr = uintptr(267)SourceSYS_readv
SYS_readv :: uintptr = uintptr(19)SourceSYS_reboot
SYS_reboot :: uintptr = uintptr(169)SourceSYS_recvfrom
SYS_recvfrom :: uintptr = uintptr(45)SourceSYS_recvmmsg
SYS_recvmmsg :: uintptr = uintptr(299)SourceSYS_recvmsg
SYS_recvmsg :: uintptr = uintptr(47)SourceSYS_remap_file_pages
SYS_remap_file_pages :: uintptr = uintptr(216)SourceSYS_removexattr
SYS_removexattr :: uintptr = uintptr(197)SourceSYS_rename
SYS_rename :: uintptr = uintptr(82)SourceSYS_renameat
SYS_renameat :: uintptr = uintptr(264)SourceSYS_renameat2
SYS_renameat2 :: uintptr = uintptr(316)SourceSYS_request_key
SYS_request_key :: uintptr = uintptr(249)SourceSYS_restart_syscall
SYS_restart_syscall :: uintptr = uintptr(219)SourceSYS_rmdir
SYS_rmdir :: uintptr = uintptr(84)SourceSYS_rseq
SYS_rseq :: uintptr = uintptr(334)SourceSYS_rt_sigaction
SYS_rt_sigaction :: uintptr = uintptr(13)SourceSYS_rt_sigpending
SYS_rt_sigpending :: uintptr = uintptr(127)SourceSYS_rt_sigprocmask
SYS_rt_sigprocmask :: uintptr = uintptr(14)SourceSYS_rt_sigqueueinfo
SYS_rt_sigqueueinfo :: uintptr = uintptr(129)SourceSYS_rt_sigreturn
SYS_rt_sigreturn :: uintptr = uintptr(15)SourceSYS_rt_sigsuspend
SYS_rt_sigsuspend :: uintptr = uintptr(130)SourceSYS_rt_sigtimedwait
SYS_rt_sigtimedwait :: uintptr = uintptr(128)SourceSYS_rt_tgsigqueueinfo
SYS_rt_tgsigqueueinfo :: uintptr = uintptr(297)SourceSYS_sched_get_priority_max
SYS_sched_get_priority_max :: uintptr = uintptr(146)SourceSYS_sched_get_priority_min
SYS_sched_get_priority_min :: uintptr = uintptr(147)SourceSYS_sched_getaffinity
SYS_sched_getaffinity :: uintptr = uintptr(204)SourceSYS_sched_getattr
SYS_sched_getattr :: uintptr = uintptr(315)SourceSYS_sched_getparam
SYS_sched_getparam :: uintptr = uintptr(143)SourceSYS_sched_getscheduler
SYS_sched_getscheduler :: uintptr = uintptr(145)SourceSYS_sched_rr_get_interval
SYS_sched_rr_get_interval :: uintptr = uintptr(148)SourceSYS_sched_setaffinity
SYS_sched_setaffinity :: uintptr = uintptr(203)SourceSYS_sched_setattr
SYS_sched_setattr :: uintptr = uintptr(314)SourceSYS_sched_setparam
SYS_sched_setparam :: uintptr = uintptr(142)SourceSYS_sched_setscheduler
SYS_sched_setscheduler :: uintptr = uintptr(144)SourceSYS_sched_yield
SYS_sched_yield :: uintptr = uintptr(24)SourceSYS_seccomp
SYS_seccomp :: uintptr = uintptr(317)SourceSYS_security
SYS_security :: uintptr = uintptr(185)SourceSYS_select
SYS_select :: uintptr = uintptr(23)SourceSYS_semctl
SYS_semctl :: uintptr = uintptr(66)SourceSYS_semget
SYS_semget :: uintptr = uintptr(64)SourceSYS_semop
SYS_semop :: uintptr = uintptr(65)SourceSYS_semtimedop
SYS_semtimedop :: uintptr = uintptr(220)SourceSYS_sendfile
SYS_sendfile :: uintptr = uintptr(40)SourceSYS_sendmmsg
SYS_sendmmsg :: uintptr = uintptr(307)SourceSYS_sendmsg
SYS_sendmsg :: uintptr = uintptr(46)SourceSYS_sendto
SYS_sendto :: uintptr = uintptr(44)SourceSYS_set_mempolicy
SYS_set_mempolicy :: uintptr = uintptr(238)SourceSYS_set_mempolicy_home_node
SYS_set_mempolicy_home_node :: uintptr = uintptr(450)SourceSYS_set_robust_list
SYS_set_robust_list :: uintptr = uintptr(273)SourceSYS_set_thread_area
SYS_set_thread_area :: uintptr = uintptr(205)SourceSYS_set_tid_address
SYS_set_tid_address :: uintptr = uintptr(218)SourceSYS_setdomainname
SYS_setdomainname :: uintptr = uintptr(171)SourceSYS_setfsgid
SYS_setfsgid :: uintptr = uintptr(123)SourceSYS_setfsuid
SYS_setfsuid :: uintptr = uintptr(122)SourceSYS_setgid
SYS_setgid :: uintptr = uintptr(106)SourceSYS_setgroups
SYS_setgroups :: uintptr = uintptr(116)SourceSYS_sethostname
SYS_sethostname :: uintptr = uintptr(170)SourceSYS_setitimer
SYS_setitimer :: uintptr = uintptr(38)SourceSYS_setns
SYS_setns :: uintptr = uintptr(308)SourceSYS_setpgid
SYS_setpgid :: uintptr = uintptr(109)SourceSYS_setpriority
SYS_setpriority :: uintptr = uintptr(141)SourceSYS_setregid
SYS_setregid :: uintptr = uintptr(114)SourceSYS_setresgid
SYS_setresgid :: uintptr = uintptr(119)SourceSYS_setresuid
SYS_setresuid :: uintptr = uintptr(117)SourceSYS_setreuid
SYS_setreuid :: uintptr = uintptr(113)SourceSYS_setrlimit
SYS_setrlimit :: uintptr = uintptr(160)SourceSYS_setsid
SYS_setsid :: uintptr = uintptr(112)SourceSYS_setsockopt
SYS_setsockopt :: uintptr = uintptr(54)SourceSYS_settimeofday
SYS_settimeofday :: uintptr = uintptr(164)SourceSYS_setuid
SYS_setuid :: uintptr = uintptr(105)SourceSYS_setxattr
SYS_setxattr :: uintptr = uintptr(188)SourceSYS_shmat
SYS_shmat :: uintptr = uintptr(30)SourceSYS_shmctl
SYS_shmctl :: uintptr = uintptr(31)SourceSYS_shmdt
SYS_shmdt :: uintptr = uintptr(67)SourceSYS_shmget
SYS_shmget :: uintptr = uintptr(29)SourceSYS_shutdown
SYS_shutdown :: uintptr = uintptr(48)SourceSYS_sigaltstack
SYS_sigaltstack :: uintptr = uintptr(131)SourceSYS_signalfd
SYS_signalfd :: uintptr = uintptr(282)SourceSYS_signalfd4
SYS_signalfd4 :: uintptr = uintptr(289)SourceSYS_socket
SYS_socket :: uintptr = uintptr(41)SourceSYS_socketpair
SYS_socketpair :: uintptr = uintptr(53)SourceSYS_splice
SYS_splice :: uintptr = uintptr(275)SourceSYS_stat
SYS_stat :: uintptr = uintptr(4)SourceSYS_statfs
SYS_statfs :: uintptr = uintptr(137)SourceSYS_statx
SYS_statx :: uintptr = uintptr(332)SourceSYS_swapoff
SYS_swapoff :: uintptr = uintptr(168)SourceSYS_swapon
SYS_swapon :: uintptr = uintptr(167)SourceSYS_symlink
SYS_symlink :: uintptr = uintptr(88)SourceSYS_symlinkat
SYS_symlinkat :: uintptr = uintptr(266)SourceSYS_sync
SYS_sync :: uintptr = uintptr(162)SourceSYS_sync_file_range
SYS_sync_file_range :: uintptr = uintptr(277)SourceSYS_syncfs
SYS_syncfs :: uintptr = uintptr(306)SourceSYS_sysfs
SYS_sysfs :: uintptr = uintptr(139)SourceSYS_sysinfo
SYS_sysinfo :: uintptr = uintptr(99)SourceSYS_syslog
SYS_syslog :: uintptr = uintptr(103)SourceSYS_tee
SYS_tee :: uintptr = uintptr(276)SourceSYS_tgkill
SYS_tgkill :: uintptr = uintptr(234)SourceSYS_time
SYS_time :: uintptr = uintptr(201)SourceSYS_timer_create
SYS_timer_create :: uintptr = uintptr(222)SourceSYS_timer_delete
SYS_timer_delete :: uintptr = uintptr(226)SourceSYS_timer_getoverrun
SYS_timer_getoverrun :: uintptr = uintptr(225)SourceSYS_timer_gettime
SYS_timer_gettime :: uintptr = uintptr(224)SourceSYS_timer_settime
SYS_timer_settime :: uintptr = uintptr(223)SourceSYS_timerfd_create
SYS_timerfd_create :: uintptr = uintptr(283)SourceSYS_timerfd_gettime
SYS_timerfd_gettime :: uintptr = uintptr(287)SourceSYS_timerfd_settime
SYS_timerfd_settime :: uintptr = uintptr(286)SourceSYS_times
SYS_times :: uintptr = uintptr(100)SourceSYS_tkill
SYS_tkill :: uintptr = uintptr(200)SourceSYS_truncate
SYS_truncate :: uintptr = uintptr(76)SourceSYS_tuxcall
SYS_tuxcall :: uintptr = uintptr(184)SourceSYS_umask
SYS_umask :: uintptr = uintptr(95)SourceSYS_umount2
SYS_umount2 :: uintptr = uintptr(166)SourceSYS_uname
SYS_uname :: uintptr = uintptr(63)SourceSYS_unlink
SYS_unlink :: uintptr = uintptr(87)SourceSYS_unlinkat
SYS_unlinkat :: uintptr = uintptr(263)SourceSYS_unshare
SYS_unshare :: uintptr = uintptr(272)SourceSYS_uselib
SYS_uselib :: uintptr = uintptr(134)SourceSYS_userfaultfd
SYS_userfaultfd :: uintptr = uintptr(323)SourceSYS_ustat
SYS_ustat :: uintptr = uintptr(136)SourceSYS_utime
SYS_utime :: uintptr = uintptr(132)SourceSYS_utimensat
SYS_utimensat :: uintptr = uintptr(280)SourceSYS_utimes
SYS_utimes :: uintptr = uintptr(235)SourceSYS_vfork
SYS_vfork :: uintptr = uintptr(58)SourceSYS_vhangup
SYS_vhangup :: uintptr = uintptr(153)SourceSYS_vmsplice
SYS_vmsplice :: uintptr = uintptr(278)SourceSYS_vserver
SYS_vserver :: uintptr = uintptr(236)SourceSYS_wait4
SYS_wait4 :: uintptr = uintptr(61)SourceSYS_waitid
SYS_waitid :: uintptr = uintptr(247)SourceSYS_write
SYS_write :: uintptr = uintptr(1)SourceSYS_writev
SYS_writev :: uintptr = uintptr(20)SourceS_IFBLK
S_IFBLK :: Mode = Mode{.IFDIR, .IFCHR}SourceS_IFCHR
S_IFCHR :: Mode = Mode{.IFCHR}SourceS_IFDIR
S_IFDIR :: Mode = Mode{.IFDIR}SourceS_IFIFO
S_IFIFO :: Mode = Mode{.IFIFO}SourceS_IFLNK
S_IFLNK :: Mode = Mode{.IFREG, .IFCHR}SourceS_IFMT
S_IFMT :: Mode = Mode{.IFREG, .IFDIR, .IFCHR, .IFIFO}SourceS_IFREG
S_IFREG :: Mode = Mode{.IFREG}SourceS_IFSOCK
S_IFSOCK :: Mode = Mode{.IFREG, .IFDIR}SourceShmid_DS
Shmid_DS :: _Arch_Shmid_DSSourceSystemV shared memory data.
TIOCGWINSZ
TIOCGWINSZ :: 0x5413SourceGet window size
UNAME26
UNAME26 :: 17SourceBits for Personality_Flags
UTIME_NOW
UTIME_NOW :: uint = uint((1 << 30) - 1)SourceSpecial value to put into timespec for utimensat() to set timestamp to the current time.
UTIME_OMIT
UTIME_OMIT :: uint = uint((1 << 30) - 2)SourceSpecial value to put into the timespec for utimensat() to leave the corresponding field of the timestamp unchanged.
WAIT_ANY
WAIT_ANY :: Pid = Pid(-1)SourceFor wait4: Pass this pid to wait for any process.
WAIT_MYPGRP
WAIT_MYPGRP :: Pid = Pid(0)SourceFor wait4: Pass this pid to wait for any process in current process group.
WHOLE_SECONDS
WHOLE_SECONDS :: 25SourceW_OK
W_OK :: Mode = Mode{.IWOTH}SourceFor access.2 syscall family: instruct to check if the file is writeable.
X_OK
X_OK :: Mode = Mode{.IXOTH}SourceFor access.2 syscall family: instruct to check if the file is executable.
_NSIG
_NSIG :: 65SourceProcedures
330S_ISBLK
S_ISBLK :: proc(m: Mode) -> (bool)SourceCheck the Mode bits to see if the file is a block device.
S_ISCHR
S_ISCHR :: proc(m: Mode) -> (bool)SourceCheck the Mode bits to see if the file is a character device.
S_ISDIR
S_ISDIR :: proc(m: Mode) -> (bool)SourceCheck the Mode bits to see if the file is a directory.
S_ISFIFO
S_ISFIFO :: proc(m: Mode) -> (bool)SourceChecks the Mode bits to see if the file is a named pipe (FIFO).
S_ISLNK
S_ISLNK :: proc(m: Mode) -> (bool)SourceCheck the Mode bits to see if the file is a symlink.
S_ISREG
S_ISREG :: proc(m: Mode) -> (bool)SourceCheck the Mode bits to see if the file is a register.
S_ISSOCK
S_ISSOCK :: proc(m: Mode) -> (bool)SourceCheck the Mode bits to see if the file is a socket.
WCOREDUMP
WCOREDUMP :: proc(s: u32) -> (bool)Source/ Check if the process dumped core
WEXITSTATUS
WEXITSTATUS :: proc(s: u32) -> (u32)Source/ Low 8 bits of the exit code / Only retrieve the exit code if WIFEXITED(s) = true
WIFCONTINUED
WIFCONTINUED :: proc(s: u32) -> (bool)Source/ Check if the process is continued by the tracee
WIFEXITED
WIFEXITED :: proc(s: u32) -> (bool)Source/ Check if the process terminated normally (via exit.2)
WIFSIGNALED
WIFSIGNALED :: proc(s: u32) -> (bool)Source/ Check if the process signaled
WIFSTOPPED
WIFSTOPPED :: proc(s: u32) -> (bool)Source/ Check if the process has stopped
WSTOPSIG
WSTOPSIG :: proc(s: u32) -> (u32)Source/ The signal that stopped the child / Only retrieve if WIFSTOPPED(s) = true
WTERMSIG
WTERMSIG :: proc(s: u32) -> (u32)Source/ Termination signal / Only retrieve the code if WIFSIGNALED(s) = true
accept
accept :: proc(sock: Fd, addr: ^T, sockflags: Socket_FD_Flags) -> (Errno, Fd)SourceAccept a pending connection or block until new connection appears.
Depends on Sock_FD_Flags of the `sock` parameter.
Available since Linux 2.0.access
access :: proc(name: cstring, mode: Mode) -> (Errno)SourceCheck user permissions for a file.
If Mode is F_OK, checks whether the file exists.
Similarly, X_OK, W_OK, R_OK check if the file is executable, writeable, readable respectively.
Available since Linux 1.0.
For ARM64 available since Linux 2.6.16.acct
acct :: proc(filename: cstring) -> (Errno)SourceSwitch process accounting on or off
Available since Linux 2.3.23adjtimex
adjtimex :: proc(buf: ^Timex) -> (Errno, Clock_State)SourceDisplay or set the kernel time variables
Available since Linux 1.0.alarm
alarm :: proc(seconds: u32) -> (u32)SourceSet an alarm clock for delivery of a signal.
Available since Linux 1.0.arch_prctl
arch_prctl :: proc(op: i32, addr: uint) -> (Errno)SourceSet architecture-specific thread state
Available since Linux 2.6.19bind
bind :: proc(sock: Fd, addr: ^T) -> (Errno)SourceBind a socket to the given local address.
Available since Linux 2.0.brk
brk :: proc(addr: uintptr) -> (Errno)SourceExtend the data segment size until the address addr. Note: you may be
familiar with sbrk(), which is not actually a syscall, so is not
implemented here.
Available since Linux 1.0.chdir
chdir :: proc(path: cstring) -> (Errno)SourceChange working directory to the directory specified by path.
Available since Linux 1.0.chmod
chmod :: proc(name: cstring, mode: Mode) -> (Errno)SourceChange file permissions.
Available since Linux 1.0.
On ARM64 available since Linux 2.6.16.chown
chown :: proc(name: cstring, uid: Uid, gid: Gid) -> (Errno)SourceChange ownership of a file.
Available since Linux 2.2.
On 32-bit architectures available since Linux 2.4.
On ARM64 available since Linux 2.6.16.chroot
chroot :: proc(pathname: cstring) -> (Errno)SourceChange root directory
Available since Linux 1.0.clock_getres
clock_getres :: proc(clock: Clock_Id) -> (res: Time_Spec, err: Errno)SourceFinds the resolution of the specified clock.
Available since Linux 2.6.clock_gettime
clock_gettime :: proc(clock: Clock_Id) -> (ts: Time_Spec, err: Errno)SourceRetrieve the time of the specified clock.
Available since Linux 2.6.clock_nanosleep
clock_nanosleep :: proc(clock: Clock_Id, flags: ITimer_Flags, request: ^Time_Spec, remain: ^Time_Spec) -> (Errno)SourceSleep for an interval specified with nanosecond precision.
Available since Linux 2.6.clock_settime
clock_settime :: proc(clock: Clock_Id, ts: ^Time_Spec) -> (Errno)SourceSet the time of the specified clock.
Available since Linux 2.6.close
close :: proc(fd: Fd) -> (Errno)SourceClose the file.
Available since Linux 1.0.close_range
close_range :: proc(lo: Fd, hi: Fd, flags: Close_Range_Flags) -> (Errno)SourceTODO(flysand): clone3 (probably not this PR) Close the range of files as an atomic operation.
The range of file descriptors is inclusive, and may contain invalid file descriptors.
Available since Linux 5.9.connect
connect :: proc(sock: Fd, addr: ^T) -> (Errno)SourceConnect the socket to the address.
Available since Linux 2.0.creat
creat :: proc(name: cstring, mode: Mode) -> (Errno, Fd)SourceCreate a file.
Available since Linux 1.0.
On ARM64 available since Linux 2.6.16.delete_module
delete_module :: proc(name: cstring, flags: u32) -> (Errno)SourceUnload a kernel module
Available since Linux 2.2dirent_iterate_buf
dirent_iterate_buf :: proc(buf: []u8, offs: ^int) -> (d: ^Dirent, cont: bool)SourceIterate the results of getdents().
This procedure extracts a directory entry from buf at the offset offs. offs will be modified to store an offset to the possible next directory entry in buf. The procedure only iterates as much data as loaded in the buffer and does not automatically make a request for the buffer to be refilled.
Inputs:
- buf: A byte buffer with data from
getdents() - offs: An offset to the next possible directory entry in
buf
Returns:
- A pointer to a directory entry in
buf, ornil - A bool value denoting if a valid directory entry is returned
import "core:fmt" import "core:sys/linux"
print_names :: proc(dirfd: linux.Fd) { // Get dirents into a buffer. buf: [128]u8 // Loop until there are no more entries. for { written, err := linux.getdents(dirfd, buf[:]) if err != .NONE || written == 0 { break } // Print the names of the files. offset : int for dir in linux.dirent_iterate_buf(buf[:written], &offset) { name := linux.dirent_name(dir) fmt.println(name) } } }
dirent_name
dirent_name :: proc(dirent: ^Dirent) -> (string)SourceObtain the name of dirent as a string.
The lifetime of the returned string is bound to the lifetime of the provided dirent structure.
Inputs:
- dirent: A directory entry
Returns:
- A name of the entry
dup
dup :: proc(fd: Fd) -> (Errno, Fd)SourceAllocate a new file descriptor that refers to the same file as the one provided.
Available since Linux 1.0.dup2
dup2 :: proc(old: Fd, new: Fd) -> (Errno, Fd)SourceAdjust an existing file descriptor to point to the same file as old.
Available since Linux 1.0.
On ARM64 available since Linux 2.6.27.dup3
dup3 :: proc(old: Fd, new: Fd, flags: Open_Flags) -> (Errno, Fd)SourceAdjust an existing file descriptor to point to the same file as old.
In addition to dup2 allows to pass O_CLOEXEC flag.
Available since Linux 2.6.27.epoll_create
epoll_create :: proc(size: i32) -> (Errno, Fd)SourceTODO(flysand): set_thread_area TODO(flysand): io_setup TODO(flysand): io_destroy TODO(flysand): io_getevents TODO(flysand): io_submit TODO(flysand): io_cancel TODO(flysand): get_thread_area TODO(flysand): lookup_dcookie Open an epoll file descriptor.
The `size` argument is ignored but must be greater than zero.
Available since Linux 2.6.epoll_create1
epoll_create1 :: proc(flags: EPoll_Flags) -> (Errno, Fd)SourceTODO(flysand): accept4 TODO(flysand): signalfd4 TODO(flysand): eventfd2
epoll_ctl
epoll_ctl :: proc(epfd: Fd, op: EPoll_Ctl_Opcode, fd: Fd, event: ^EPoll_Event) -> (Errno)SourceControl interface for an epoll file descriptor.
Available since Linux 2.6.epoll_pwait
epoll_pwait :: proc(epfd: Fd, events: [^]EPoll_Event, count: i32, timeout: i32, sigmask: ^Sig_Set) -> (Errno, i32)SourceWait for an I/O event on an epoll file descriptor.
Available since Linux 2.6.epoll_pwait2
epoll_pwait2 :: proc(epfd: Fd, events: [^]EPoll_Event, count: i32, timeout: ^Time_Spec, sigmask: ^Sig_Set) -> (Errno, i32)SourceTODO(flysand): process_madvise Wait for an I/O event on an epoll file descriptor.
Available since Linux 2.6.epoll_wait
epoll_wait :: proc(epfd: Fd, events: [^]EPoll_Event, count: i32, timeout: i32) -> (Errno, i32)SourceWait for an I/O event on an epoll file descriptor.
`timeout` is specified in milliseconds.
Available since Linux 2.6.eventfd
eventfd :: proc(initval: u32, flags: Eventfd_Flags) -> (Errno, Fd)Sourceexecve
execve :: proc(name: cstring, argv: [^]cstring, envp: [^]cstring) -> (Errno)SourceReplace the current process with another program.
Available since Linux 1.0.
On ARM64 available since Linux 3.19.execveat
execveat :: proc(dirfd: Fd, name: cstring, argv: [^]cstring, envp: [^]cstring, flags: Execveat_Flags) -> (Errno)SourceTODO(flysand): kexec_file_load TODO(flysand): bpf Execute program relative to a directory file descriptor.
Available since Linux 3.19.exit
exit :: proc(code: i32) -> ()SourceExit the thread with a given exit code.
Available since Linux 1.0.exit_group
exit_group :: proc(code: i32) -> ()SourceExit the thread group.
Available since Linux 2.6.faccessat
faccessat :: proc(dirfd: Fd, name: cstring, mode: Mode) -> (Errno)SourceChecks the user permissions for a file at specified dirfd.
Available since Linux 2.6.16.faccessat2
faccessat2 :: proc(dirfd: Fd, name: cstring, mode: Mode, flags: FD_Flags) -> (Errno)SourceChecks the user permissions for a file at specified dirfd (with flags).
Available since Linux 5.8.fchdir
fchdir :: proc(fd: Fd) -> (Errno)SourceChange working directory to the directory specified by dirfd.
Available since Linux 1.0.fchmod
fchmod :: proc(fd: Fd, mode: Mode) -> (Errno)SourceChange file permissions through a file descriptor.
Available since Linux 1.0.fchmodat
fchmodat :: proc(dirfd: Fd, name: cstring, mode: Mode, flags: FD_Flags) -> (Errno)SourceChange the file mode at a specified file descriptor.
Available since Linux 2.6.16.fchown
fchown :: proc(fd: Fd, uid: Uid, gid: Gid) -> (Errno)SourceChange ownership of a file by file descriptor.
Available since Linux 1.0.
On 32-bit architecvtures available since Linux 2.4.fchownat
fchownat :: proc(dirfd: Fd, name: cstring, uid: Uid, gid: Gid) -> (Errno)SourceChange the ownership of the file specified relative to directory.
Available since Linux 2.6.16.fcntl_add_seals
fcntl_add_seals :: proc(fd: Fd, cmd: FCntl_Command_ADD_SEALS, seal: Seal) -> (Errno)Sourcefcntl_dupfd
fcntl_dupfd :: proc(fd: Fd, cmd: FCntl_Command_DUPFD, newfd: Fd) -> (Errno, Fd)Sourcefcntl_dupfd_cloexec
fcntl_dupfd_cloexec :: proc(fd: Fd, cmd: FCntl_Command_DUPFD_CLOEXEC, newfd: Fd) -> (Errno, Fd)Sourcefcntl_get_file_rw_hint
fcntl_get_file_rw_hint :: proc(fd: Fd, cmd: FCntl_Command_GET_FILE_RW_HINT, hint: ^RW_Hint) -> (Errno)Sourcefcntl_get_rw_hint
fcntl_get_rw_hint :: proc(fd: Fd, cmd: FCntl_Command_GET_RW_HINT, hint: ^RW_Hint) -> (Errno)Sourcefcntl_get_seals
fcntl_get_seals :: proc(fd: Fd, cmd: FCntl_Command_GET_SEALS) -> (Errno, Seal)Sourcefcntl_getfd
fcntl_getfd :: proc(fd: Fd, cmd: FCntl_Command_GETFD) -> (Errno, Fd)Sourcefcntl_getfl
fcntl_getfl :: proc(fd: Fd, cmd: FCntl_Command_GETFL) -> (Errno, Open_Flags)Sourcefcntl_getlease
fcntl_getlease :: proc(fd: Fd, cmd: FCntl_Command_GETLEASE) -> (Errno, FD_Lease)Sourcefcntl_getlk
fcntl_getlk :: proc(fd: Fd, cmd: FCntl_Command_GETLK, lock: ^FLock) -> (Errno)Sourcefcntl_getown_ex
fcntl_getown_ex :: proc(fd: Fd, cmd: FCntl_Command_GETOWN_EX, owner: ^F_Owner) -> (Errno)Sourcefcntl_getpipe_sz
fcntl_getpipe_sz :: proc(fd: Fd, cmd: FCntl_Command_GETPIPE_SZ) -> (Errno, i32)Sourcefcntl_getsig
fcntl_getsig :: proc(fd: Fd, cmd: FCntl_Command_GETSIG) -> (Errno, Signal)Sourcefcntl_notify
fcntl_notify :: proc(fd: Fd, cmd: FCntl_Command_NOTIFY, notifications: FD_Notifications) -> (Errno)Sourcefcntl_set_file_rw_hint
fcntl_set_file_rw_hint :: proc(fd: Fd, cmd: FCntl_Command_SET_FILE_RW_HINT, hint: ^RW_Hint) -> (Errno)Sourcefcntl_set_rw_hint
fcntl_set_rw_hint :: proc(fd: Fd, cmd: FCntl_Command_SET_RW_HINT, hint: ^RW_Hint) -> (Errno)Sourcefcntl_setfd
fcntl_setfd :: proc(fd: Fd, cmd: FCntl_Command_SETFD, newfd: Fd) -> (Errno)Sourcefcntl_setfl
fcntl_setfl :: proc(fd: Fd, cmd: FCntl_Command_SETFL, flags: Open_Flags) -> (Errno)Sourcefcntl_setlease
fcntl_setlease :: proc(fd: Fd, cmd: FCntl_Command_SETLEASE, lease: FD_Lease) -> (Errno)Sourcefcntl_setlk
fcntl_setlk :: proc(fd: Fd, cmd: FCntl_Command_SETLK, lock: ^FLock) -> (Errno)Sourcefcntl_setlkw
fcntl_setlkw :: proc(fd: Fd, cmd: FCntl_Command_SETLKW, lock: ^FLock) -> (Errno)Sourcefcntl_setown_ex
fcntl_setown_ex :: proc(fd: Fd, cmd: FCntl_Command_SETOWN_EX, owner: ^F_Owner) -> (Errno)Sourcefcntl_setpipe_sz
fcntl_setpipe_sz :: proc(fd: Fd, cmd: FCntl_Command_SETPIPE_SZ, sz: i32) -> (Errno, i32)Sourcefcntl_setsig
fcntl_setsig :: proc(fd: Fd, cmd: FCntl_Command_SETSIG, sig: Signal) -> (Errno)Sourcefdatasync
fdatasync :: proc(fd: Fd) -> (Errno)SourceSynchronize the state of the file with the storage device. Similar to fsync,
except does not flush the metadata.
Available since Linux 2.0.fgetxattr
fgetxattr :: proc(fd: Fd, name: cstring, value: rawptr, size: uint) -> (Errno)SourceRetrieve an extended attribute
Available since Linux 2.6.25flistxattr
flistxattr :: proc(fd: Fd, list: cstring, size: uint) -> (Errno)SourceList extended attribute names
Available since Linux 2.6.25flock
flock :: proc(fd: Fd, operation: FLock_Op) -> (Errno)SourceApply or remove advisory lock on an open file.
Available since Linux 2.0.fork
fork :: proc() -> (Errno, Pid)SourceCreates a copy of the running process.
Available since Linux 1.0.fremovexattr
fremovexattr :: proc(fd: Fd, name: cstring) -> (Errno)SourceRemove an extended attribute
Available since Linux 2.6.25fsetxattr
fsetxattr :: proc(fd: Fd, name: cstring, value: rawptr, size: uint, flags: i32) -> (Errno)SourceSet an extended attribute value
Available since Linux 2.6.25fstat
fstat :: proc(fd: Fd, stat: ^Stat) -> (Errno)SourceGet file status from file descriptor.
Returns information about the file in struct pointed to by `stat` parameter.
Available since Linux 1.0.
For 32-bit systems a different syscall is used that became available since 2.4.fstatat
fstatat :: proc(dirfd: Fd, name: cstring, stat: ^Stat, flags: FD_Flags) -> (Errno)SourceGet information about a file at a specific directory.
Available since Linux 2.6.16.fstatfs
fstatfs :: proc(fd: Fd, statfs: ^Stat_FS) -> (Errno)SourceQuery information about filesystem by file descriptor.
Available since Linux 1.0.
For 32-bit systems a different syscall is used that became available since 2.6.fsync
fsync :: proc(fd: Fd) -> (Errno)SourceSync state of the file with the storage device.
Available since Linux 1.0.ftruncate
ftruncate :: proc(fd: Fd, length: i64) -> (Errno)SourceTruncate a file specified by file descriptor to specified length.
On 32-bit architectures available since 2.4.futex_cmp_requeue
futex_cmp_requeue :: proc(
futex: ^Futex,
op: Futex_Cmp_Requeue_Type,
flags: Futex_Flags,
requeue_threshold: u32,
requeue_max: i32,
requeue_futex: ^Futex,
val: i32,
) -> (Errno, int)SourceNOTE(flysand): futex_fd is racy, so not implemented Requeues processes waiting on futex futex to wait on futex requeue_futex
`requeue_threshold` specifies the maximum amount of waiters to wake up, the rest of the waiters will be requeued
`requeue_max` specifies the maximum amount of waiters that are required at `requeue_futex`
The operation blocks until the `requeue_max` requirement is satisfied
If the value of the mutex is not equal to `val`, fails with EAGAIN before any further checks
Returns the total number of waiters that have been woken up plus the number of waiters requeued.futex_op
futex_op :: proc(arg_op: Futex_Arg_Op, cmp_op: Futex_Cmp_Op, op_arg: u32, cmp_arg: u32) -> (u32)Source/ Constructor for the futex_op argument of a FUTEX_WAKE_OP call
futex_requeue
futex_requeue :: proc(
futex: ^Futex,
op: Futex_Requeue_Type,
flags: Futex_Flags,
requeue_threshold: u32,
requeue_max: i32,
requeue_futex: ^Futex,
) -> (Errno, int)SourceSee futex_cmp_requeue, this function does the same thing but doesn't check the value of the futex.
Returns the total number of waiters that have been woken up.futex_wait
futex_wait :: proc(futex: ^Futex, op: Futex_Wait_Type, flags: Futex_Flags, val: u32, timeout: ^Time_Spec) -> (Errno)SourceWait on a futex until it's signaled.
futex_wait_bitset
futex_wait_bitset :: proc(
futex: ^Futex,
op: Futex_Wait_Bitset_Type,
flags: Futex_Flags,
val: u32,
timeout: ^Time_Spec,
mask: u32,
) -> (Errno, int)SourceSame as wait, but mask specifies bits that must be equal for the mutex to wake up.
futex_wake
futex_wake :: proc(futex: ^Futex, op: Futex_Wake_Type, flags: Futex_Flags, n_wakeup: i32) -> (Errno, int)SourceWake up other threads on a futex
n_wakeup specifies the number of processes to wakeup. Specify max(i32) to wake up all processes waitingfutex_wake_bitset
futex_wake_bitset :: proc(futex: ^Futex, op: Futex_Wake_Bitset_Type, flags: Futex_Flags, n_wakeup: u32, mask: u32) -> (Errno, int)SourceWake up on bitset.
futex_wake_op
futex_wake_op :: proc(
futex: ^Futex,
op: Futex_Wake_Op_Type,
flags: Futex_Flags,
wakeup: i32,
dst_wakeup: ^Futex,
dst: ^Futex,
futex_op: u32,
) -> (Errno, int)SourceOkay, for this one, see the man pages, the description for it is pretty long and very specific. It's sole.
purpose is to allow implementing conditional values sync primitive, it seems like.getcpu
getcpu :: proc(cpu: ^u32, node: ^u32) -> (Errno)SourceTODO(flysand): setns Determine CPU and NUMA node on which the calling thread is running.
Available since Linux 2.6.19.getcwd
getcwd :: proc(buf: []u8) -> (Errno, int)SourceGet current working directory.
Available since Linux 1.0.getdents
getdents :: proc(dirfd: Fd, buf: []u8) -> (Errno, int)SourceRetrieve the contents of the directory specified by dirfd.
Returns the number of bytes written.
Available since Linux 2.4.getegid
getegid :: proc() -> (Gid)SourceGet effective group ID.
Available since Linux 1.0.
On 32-bit platforms available since Linux 2.4.geteuid
geteuid :: proc() -> (Uid)SourceGet effective user ID.
Available since Linux 1.0.
On 32-bit platforms available since Linux 2.4.getgid
getgid :: proc() -> (Gid)SourceGet real group ID.
Available since Linux 1.0.
On 32-bit platforms available since Linux 2.4.getgroups
getgroups :: proc(gids: []Gid) -> (Errno, int)SourceGet supplementary group IDs.
Available since Linux 1.0.
On 32-bit platforms available since Linux 2.4.getitimer
getitimer :: proc(which: ITimer_Which, cur: ^ITimer_Val) -> (Errno)SourceGet the value of an internal timer.
Available since Linux 1.0.getpeername
getpeername :: proc(sock: Fd, addr: ^Sock_Addr_Any) -> (Errno)SourceGet the name of the connected peer socket.
Available since Linux 2.0.getpgid
getpgid :: proc(pid: Pid) -> (Errno, Pid)SourceGet process group.
Available since Linux 1.0.getpgrp
getpgrp :: proc() -> (Errno, Pid)SourceGet process group.
Available since Linux 1.0.getpid
getpid :: proc() -> (Pid)SourceReturns the thread group ID of the current process.
Note that it doesn't return the pid, despite it's name.
Available since Linux 1.0.getppid
getppid :: proc() -> (Pid)SourceGet the parent process ID.
Available since Linux 1.0.getpriority
getpriority :: proc(which: Priority_Which, who: i32) -> (Errno, i32)SourceTODO(flysand): sysfs Get priority on user, process group or process.
Available since Linux 1.0.getrandom
getrandom :: proc(buf: []u8, flags: Get_Random_Flags) -> (Errno, int)SourceTODO(flysand): seccomp
getresgid
getresgid :: proc(real: ^Gid, effective: ^Gid, saved: ^Gid) -> (Errno)SourceGet real, effective and saved group id.
Available since Linux 2.2.
On 32-bit platforms available since Linux 2.4.getresuid
getresuid :: proc(real: ^Uid, effective: ^Uid, saved: ^Uid) -> (Errno)SourceGet real, effective and saved user id.
Available since Linux 2.2.
On 32-bit platforms available since Linux 2.4.getrlimit
getrlimit :: proc(kind: RLimit_Kind, resource: ^RLimit) -> (Errno)SourceGet limits on resources.
Available since Linux 1.0.getrusage
getrusage :: proc(who: RUsage_Who, rusage: ^RUsage) -> (Errno)SourceGet resource usage.
Available since Linux 1.0.getsid
getsid :: proc(pid: Pid) -> (Errno, Pid)SourceGet session ID of the calling process.
Available since Linux 2.0.getsockname
getsockname :: proc(sock: Fd, addr: ^Sock_Addr_Any) -> (Errno)SourceGet socket name (aka it's bound address).
Available since Linux 2.0.getsockopt_base
getsockopt_base :: proc(sock: Fd, level: int, opt: Socket_Option, val: T) -> (Errno, int)Sourcegetsockopt_sock
getsockopt_sock :: proc(sock: Fd, level: Socket_API_Level_Sock, opt: Socket_Option, val: ^T) -> (Errno, int)Sourcegetsockopt_tcp
getsockopt_tcp :: proc(sock: Fd, level: Socket_API_Level_TCP, opt: Socket_TCP_Option, val: ^T) -> (Errno, int)Sourcegetsockopt_udp
getsockopt_udp :: proc(sock: Fd, level: Socket_API_Level_UDP, opt: Socket_UDP_Option, val: ^T) -> (Errno, int)Sourcegettid
gettid :: proc() -> (Pid)SourceTODO(flysand): nfsservctl / No longer present after 3.1 TODO(flysand): getpmsg TODO(flysand): putpmsg TODO(flysand): afs_syscall TODO(flysand): tuxcall TODO(flysand): security Returns the thread ID of the current process
This is what the kernel calls "pid".
Let me insert a tiny rant here, this terminology is confusing:
sometimes pid refers to a thread, and other times it refers
to a thread group (process group?)
Anyway, this syscall is available since Linux 1.0gettimeofday
gettimeofday :: proc(tv: ^Time_Val) -> (Errno)SourceGet current time.
Available since Linux 1.0.getuid
getuid :: proc() -> (Uid)SourceGet real user ID.
Available since Linux 1.0.
On 32-bit platforms available since Linux 2.4.getxattr
getxattr :: proc(path: cstring, name: cstring, value: rawptr, size: uint) -> (Errno)SourceRetrieve an extended attribute
Available since Linux 2.6.25init_module
init_module :: proc(module_image: rawptr, size: u32, param_values: cstring) -> (Errno)SourceLoad a kernel module
Available since Linux 2.2inotify_add_watch
inotify_add_watch :: proc(fd: Fd, pathname: cstring, mask: Inotify_Event_Mask) -> (Errno, Wd)Sourceinotify_init
inotify_init :: proc() -> (Errno, Fd)SourceTODO(flysand): add_key TODO(flysand): request_key TODO(flysand): keyctl TODO(flysand): ioprio_set TODO(flysand): ioprio_get
inotify_init1
inotify_init1 :: proc(flags: Inotify_Init_Flags) -> (Errno, Fd)Sourceinotify_rm_watch
inotify_rm_watch :: proc(fd: Fd, wd: Wd) -> (Errno)Sourceio_uring_enter
io_uring_enter :: proc(fd: Fd, to_submit: u32, min_complete: u32, flags: IO_Uring_Enter_Flags, sig: ^Sig_Set) -> (Errno, int)SourceInitiate and/or complete I/O using the shared submission and completion queues.
Available since Linux 5.1io_uring_enter2
io_uring_enter2 :: proc(fd: Fd, to_submit: u32, min_complete: u32, flags: IO_Uring_Enter_Flags, arg: ^IO_Uring_Getevents_Arg) -> (Errno, int)SourceInitiate and.or complete I/O using the shared submission and completion queues.
Available since Linux 5.11io_uring_register
io_uring_register :: proc(fd: Fd, opcode: IO_Uring_Register_Opcode, arg: rawptr, nr_args: u32) -> (Errno)SourceRegister files or user buffers for asynchronous I/O.
Available since Linux 5.1io_uring_setup
io_uring_setup :: proc(entries: u32, params: ^IO_Uring_Params) -> (Errno, Fd)SourceTODO(flysand): io_pgetevents TODO(flysand): rseq TODO(flysand): pidfd_send_signal Setup a context for performing asynchronous I/O.
Available since Linux 5.1ioctl
ioctl :: proc(fd: Fd, request: u32, arg: uintptr) -> (uintptr)SourceControl devices. The ioctl syscall is a bit special because
its argument is usually a pointer to some driver-specific structure.
The request value is device-specific. Consult your LibC implementation's
ioctls.h file to learn more. The returned value of ioctl *may* be an error
code value instead of a memory address depending on the request type.
Available since Linux 1.0.ioperm
ioperm :: proc(form: u32, num: u32, turn_on: i32) -> (Errno)SourceSet port input/output permissions
Available since Linux 1.0kill
kill :: proc(pid: Pid, signal: Signal) -> (Errno)SourceSend signal to a process.
Available since Linux 1.0.lchown
lchown :: proc(name: cstring, uid: Uid, gid: Gid) -> (Errno)SourceChange ownership of a file. Unlike chown, if a file is a symlink dooesn't dereference it.
Available since Linux 1.0.
On 32-bit architectures available since Linux 2.4.
On ARM64 available since Linux 2.6.16.lgetxattr
lgetxattr :: proc(path: cstring, name: cstring, value: rawptr, size: uint) -> (Errno)SourceRetrieve an extended attribute
Available since Linux 2.6.25link
link :: proc(target: cstring, linkpath: cstring) -> (Errno)SourceCreate a hard link on a file.
Available since Linux 1.0.
On ARM64 available since Linux 2.6.16.linkat
linkat :: proc(target_dirfd: Fd, oldpath: cstring, link_dirfd: Fd, link: cstring, flags: FD_Flags) -> (Errno)SourceCreates a hard link on a file relative to specified dirfd.
Available since Linux 2.6.16.listen
listen :: proc(sock: Fd, queue_len: i32) -> (Errno)SourceMarks the socket as a socket that listen to connections using accept(2).
Available since Linux 2.0.listxattr
listxattr :: proc(path: cstring, list: cstring, size: uint) -> (Errno)SourceList extended attribute names
Available since Linux 2.6.25llistxattr
llistxattr :: proc(path: cstring, list: cstring, size: uint) -> (Errno)SourceList extended attribute names
Available since Linux 2.6.25lremovexattr
lremovexattr :: proc(path: cstring, name: cstring) -> (Errno)SourceRemove an extended attribute
Available since Linux 2.6lseek
lseek :: proc(fd: Fd, off: i64, whence: Seek_Whence) -> (Errno, i64)SourceSeek the file stream to specified offset.
Available since Linux 1.0.
On 32-bit platforms available since Linux 1.2.lsetxattr
lsetxattr :: proc(path: cstring, name: cstring, value: rawptr, size: uint, flags: i32) -> (Errno)SourceSet an extended attribute value
Available since Linux 2.6.25lstat
lstat :: proc(filename: cstring, stat: ^Stat) -> (Errno)SourceGet information about the file that's potentially a symbolic link
The information is returned in a struct pointed to by `stat` parameter.
The difference with stat, fstat is that if the file is a symbolic link,
stat and fstat will dereference the link. lstat doesn't dereference symlinks.
Available since Linux 1.0.
For 32-bit systems a different syscall is used that became available since 2.4.
Not available on arm64.madvise
madvise :: proc(addr: rawptr, size: uint, advice: MAdvice) -> (Errno)SourceGive advice about use of memory.
Available since Linux 2.4.memfd_create
memfd_create :: proc(name: cstring, flags: Memfd_Create_Flags) -> (Errno, Fd)SourceCreate an anonymous file.
Available since Linux 3.17.mincore
mincore :: proc(addr: rawptr, size: uint, vec: []b8) -> (Errno)SourceDetermine if pages are resident in memory.
Available since Linux 2.4.mkdir
mkdir :: proc(name: cstring, mode: Mode) -> (Errno)SourceCreates a directory.
Available since Linux 1.0.
On ARM64 available since Linux 2.6.16.mkdirat
mkdirat :: proc(dirfd: Fd, name: cstring, mode: Mode) -> (Errno)SourceCreate a directory relative to specified dirfd.
Available since Linux 2.6.16.mknod
mknod :: proc(name: cstring, mode: Mode, dev: Dev) -> (Errno)SourceCreate a special or ordinary file.
`mode` parameter contains both the the file mode and the type of the node to create.
-> Add one of S_IFSOCK, S_IFBLK, S_IFFIFO, S_IFCHR to mode.
Available since Linux 1.0.
On ARM64 available since Linux 2.6.16.mknodat
mknodat :: proc(dirfd: Fd, name: cstring, mode: Mode, dev: Dev) -> (Errno)SourceCreate a special or ordinary file wrt given directory specified by dirfd.
Available since Linux 2.6.16.mlock
mlock :: proc(addr: rawptr, size: uint, flags: MLock_Flags) -> (Errno)SourceLock memory.
Available since Linux 2.0.
If flags specified, available since Linux 4.4.mlockall
mlockall :: proc(flags: MLock_Flags) -> (Errno)SourceLock all memory.
Available since Linux 2.0.mmap
mmap :: proc(
addr: uintptr,
size: uint,
prot: Mem_Protection,
flags: Map_Flags,
fd: Fd,
offset: i64,
) -> (Errno, rawptr)SourceMap files into memory.
Available since Linux 1.0.
On 32-bit platforms since Linux 1.0.modify_ldt
modify_ldt :: proc(func: i32, ptr: rawptr, bytecount: uint) -> (Errno, int)SourceGet or set local descriptor table
Available since Linux 2.1mount
mount :: proc(source: cstring, target: cstring, filesystemtype: cstring, mountflags: Mount_Flags, data: rawptr) -> (Errno)SourceMount filesystem
Available since Linux 1.0mprotect
mprotect :: proc(addr: rawptr, size: uint, prot: Mem_Protection) -> (Errno)SourceProtect memory region.
Available since Linux 1.0.mremap
mremap :: proc(old_addr: rawptr, old_size: uint, new_size: uint, flags: MRemap_Flags, new_addr: uintptr) -> (Errno, rawptr)SourceRemap a virtual memory address.
Available since Linux 2.0.msgctl
msgctl :: proc(key: Key, cmd: IPC_Cmd, buf: ^Msqid_DS) -> (Errno, int)SourceSystemV message control operations.
Available since Linux 2.0.msgget
msgget :: proc(key: Key, flags: IPC_Flags) -> (Errno, Key)SourceGet SystemV message queue identifier.
Available since Linux 2.0.msgrcv
msgrcv :: proc(key: Key, buf: rawptr, size: int, type: uint, flags: IPC_Flags) -> (Errno, int)SourceReceive a message from a SystemV message queue.
Available since Linux 2.0.msgsnd
msgsnd :: proc(key: Key, buf: rawptr, size: int, flags: IPC_Flags) -> (Errno)SourceSend message to a SystemV message queue.
Available since Linux 2.0.msync
msync :: proc(addr: rawptr, size: uint, flags: MSync_Flags) -> (Errno)SourceSync file with memory map.
Available since Linux 2.0.munlock
munlock :: proc(addr: rawptr, size: uint) -> (Errno)SourceUnlock memory.
Available since Linux 2.0.munlockall
munlockall :: proc() -> (Errno)SourceUnlock all memory.
Available since Linux 2.0.munmap
munmap :: proc(addr: rawptr, size: uint) -> (Errno)SourceUnmap memory.
Available since Linux 1.0.nanosleep
nanosleep :: proc(req: ^Time_Spec, rem: ^Time_Spec) -> (Errno)SourceHigh-resolution sleep.
Available since Linux 2.0.open
open :: proc(name: cstring, flags: Open_Flags, mode: Mode) -> (Errno, Fd)SourceOpen file, get the file descriptor
Available since Linux 1.0.
On ARM64 available since Linux 2.6.16.openat
openat :: proc(fd: Fd, name: cstring, flags: Open_Flags, mode: Mode) -> (Errno, Fd)SourceTODO(flysand): migrate_pages Open file at the specified file descriptor.
Available since Linux 2.6.16.pause
pause :: proc()SourceWait until the next signal is delivered.
Available since Linux 1.0.
On ARM64 available since Linux 2.6.16.perf_cache_config
perf_cache_config :: proc(id: Perf_Hardware_Cache_Id, op: Perf_Hardware_Cache_Op_Id, res: Perf_Hardware_Cache_Result_Id) -> (u64)Source/ Helper function for constructing the config for caches
perf_event_open
perf_event_open :: proc(attr: ^Perf_Event_Attr, pid: Pid, cpu: int, group_fd: Fd, flags: Perf_Flags) -> (Errno, Fd)SourceSet up performance monitoring.
Available since Linux 2.6.31.personality
personality :: proc(personality: uint) -> (Errno, uint)SourceSet the process execution domain.
Available since Linux 1.2.pidfd_getfd
pidfd_getfd :: proc(pidfd: Pid_FD, fd: Fd, flags: i32) -> (Errno, Fd)SourceTODO(flysand): openat2 Get a file descriptor from another process.
fdrefers to a file descriptor number to get.flagsmust be zero.
Available since Linux 5.3.pidfd_open
pidfd_open :: proc(pid: Pid, flags: Pid_FD_Flags) -> (Errno, Pid_FD)SourceTODO(flysand): open_tree TODO(flysand): move_mount TODO(flysand): fsopen TODO(flysand): fsconfig TODO(flysand): fsmount TODO(flysand): fspick Creates a new PID file descriptor.
The process identified by `pid` must be a pid group leader.
The returned `pidfd` has `CLOEXEC` semantics.
Available since Linux 5.3.pipe2
pipe2 :: proc(pipes: ^[2]Fd, flags: Open_Flags) -> (Errno)SourceCreate a pipe
Available since Linux 2.6.27pivot_root
pivot_root :: proc(new_root: cstring, old_root: cstring) -> (Errno)SourceChange the root mount
Available since Linux 2.3.41poll
poll :: proc(fds: []Poll_Fd, timeout: i32) -> (Errno, i32)SourceWait on event on a file descriptor.
Available since Linux 2.2.ppoll
ppoll :: proc(fds: []Poll_Fd, timeout: ^Time_Spec, sigmask: ^Sig_Set) -> (Errno, i32)SourceWait for events on a file descriptor.
Available since Linux 2.6.16.prctl
prctl :: proc(op: i32, args) -> (Errno)SourceTODO(flysand): _sysctl Deprecated and discouraged Operations on a process or thread
Available since Linux 2.1.57pread
pread :: proc(fd: Fd, buf: []u8, offset: i64) -> (Errno, int)SourceRead the file at a specified offset.
Note, it is not an error to return less bytes than requested.
Available since Linux 2.2.ptrace_attach
ptrace_attach :: proc(rq: PTrace_Attach_Type, pid: Pid) -> (Errno)Sourceptrace_cont
ptrace_cont :: proc(rq: PTrace_Cont_Type, pid: Pid, sig: Signal) -> (Errno)Sourceptrace_detach
ptrace_detach :: proc(rq: PTrace_Detach_Type, pid: Pid, sig: Signal) -> (Errno)SourceTODO(flysand): ptrace_seccomp_get_filter
ptrace_geteventmsg
ptrace_geteventmsg :: proc(rq: PTrace_Geteventmsg_Type, pid: Pid, msg: ^uint) -> (Errno)Sourceptrace_getfpregs
ptrace_getfpregs :: proc(rq: PTrace_Getfpregs_Type, pid: Pid, buf: ^User_FP_Regs) -> (Errno)Sourceptrace_getfpxregs
ptrace_getfpxregs :: proc(rq: PTrace_Getfpxregs_Type, pid: Pid, buf: ^User_FPX_Regs) -> (Errno)Sourceptrace_getregs
ptrace_getregs :: proc(rq: PTrace_Getregs_Type, pid: Pid, buf: ^User_Regs) -> (Errno)Sourceptrace_getregset
ptrace_getregset :: proc(rq: PTrace_Getregset_Type, pid: Pid, note: PTrace_Note_Type, buf: ^IO_Vec) -> (Errno)Sourceptrace_getsiginfo
ptrace_getsiginfo :: proc(rq: PTrace_Getsiginfo_Type, pid: Pid, si: ^Sig_Info) -> (Errno)Sourceptrace_getsigmask
ptrace_getsigmask :: proc(rq: PTrace_Getsigmask_Type, pid: Pid, sigmask: ^Sig_Set) -> (Errno)Sourceptrace_interrupt
ptrace_interrupt :: proc(rq: PTrace_Interrupt_Type, pid: Pid) -> (Errno)Sourceptrace_listen
ptrace_listen :: proc(rq: PTrace_Listen_Type, pid: Pid) -> (Errno)Sourceptrace_peek
ptrace_peek :: proc(rq: PTrace_Peek_Type, pid: Pid, addr: uintptr) -> (Errno, uint)Sourceptrace_peeksiginfo
ptrace_peeksiginfo :: proc(rq: PTrace_Peeksiginfo_Type, pid: Pid, si: ^Sig_Info) -> (Errno)Sourceptrace_poke
ptrace_poke :: proc(rq: PTrace_Poke_Type, pid: Pid, addr: uintptr, data: uint) -> (Errno)Sourceptrace_seize
ptrace_seize :: proc(rq: PTrace_Seize_Type, pid: Pid, opt: PTrace_Options) -> (Errno)Sourceptrace_setfpregs
ptrace_setfpregs :: proc(rq: PTrace_Setfpregs_Type, pid: Pid, buf: ^User_FP_Regs) -> (Errno)Sourceptrace_setfpxregs
ptrace_setfpxregs :: proc(rq: PTrace_Setfpxregs_Type, pid: Pid, buf: ^User_FPX_Regs) -> (Errno)Sourceptrace_setoptions
ptrace_setoptions :: proc(rq: PTrace_Setoptions_Type, pid: Pid, options: PTrace_Options) -> (Errno)Sourceptrace_setregs
ptrace_setregs :: proc(rq: PTrace_Setregs_Type, pid: Pid, buf: ^User_Regs) -> (Errno)Sourceptrace_setregset
ptrace_setregset :: proc(rq: PTrace_Setregset_Type, pid: Pid, note: PTrace_Note_Type, buf: ^IO_Vec) -> (Errno)Sourceptrace_setsigmask
ptrace_setsigmask :: proc(rq: PTrace_Setsigmask_Type, pid: Pid, sigmask: ^Sig_Set) -> (Errno)Sourceptrace_singlestep
ptrace_singlestep :: proc(rq: PTrace_Singlestep_Type, pid: Pid, sig: Signal) -> (Errno)Sourceptrace_syscall
ptrace_syscall :: proc(rq: PTrace_Syscall_Type, pid: Pid, sig: Signal) -> (Errno)Sourceptrace_sysemu
ptrace_sysemu :: proc(rq: PTrace_Sysemu_Type, pid: Pid, sig: Signal) -> (Errno)Sourceptrace_sysemu_singlestep
ptrace_sysemu_singlestep :: proc(rq: PTrace_Sysemu_Singlestep_Type, pid: Pid, sig: Signal) -> (Errno)Sourceptrace_traceme
ptrace_traceme :: proc(rq: PTrace_Traceme_Type) -> (Errno)Sourcepwrite
pwrite :: proc(fd: Fd, buf: []u8, offset: i64) -> (Errno, int)SourceRead the file at a specified offset.
Note, it is not an error to return less bytes than requested.
Available since Linux 2.2.quotactl
quotactl :: proc(op: i32, special: cstring, id: i32, addr: rawptr) -> (Errno)SourceManipulate disk quotas
Available since Linux 2.0read
read :: proc(fd: Fd, buf: []u8) -> (Errno, int)SourceRead data from file into the buffer
Returns the number of bytes successfully read, which may be less than the size
of the buffer even if the termination is successfull.
Available since Linux 1.0.
Before Linux 3.14, this operation is not atomic (i.e. not thread safe).readahead
readahead :: proc(fd: Fd, offset: int, count: uint) -> (Errno)SourceInitiate a file readahead into page cache
Available since Linux 2.1readlink
readlink :: proc(name: cstring, buf: []u8) -> (Errno, int)SourceRead the value of a symbolic link.
Available since Linux 1.0.
On arm64 available since Linux 2.6.16.readlinkat
readlinkat :: proc(dirfd: Fd, name: cstring, buf: []u8) -> (Errno, int)SourceRead the value of a symbolic link at given dirfd.
Available since Linux 2.6.16.readv
readv :: proc(fd: Fd, iov: []IO_Vec) -> (Errno, int)SourceRead the data from file into multiple buffers.
Available since Linux 2.0.reboot
reboot :: proc(magic: Reboot_Magic, magic2: Reboot_Magic, op: Reboot_Operation, arg: rawptr) -> (Errno)SourceReboot or enable/disable Ctrl-Alt-Del
Available since Linux 1.0recvfrom
recvfrom :: proc(sock: Fd, buf: []u8, flags: Socket_Msg, addr: ^T) -> (Errno, int)SourceTODO(flysand): Rewrite recvfrom and sendto to use default parameters
recvmmsg
recvmmsg :: proc(sock: Fd, msg_vec: []MMsg_Hdr, flags: Socket_Msg) -> (Errno, int)SourceReceive multiple messages from a socket.
Available since Linux 2.6.33.recvmsg
recvmsg :: proc(sock: Fd, msghdr: ^Msg_Hdr, flags: Socket_Msg) -> (Errno, int)SourceReceive a message on a socket.
Available since Linux 2.0.removexattr
removexattr :: proc(path: cstring, name: cstring) -> (Errno)SourceRemove an extended attribute
Available since Linux 2.6.25rename
rename :: proc(old: cstring, new: cstring) -> (Errno)SourceRename (move) the file.
Available since Linux 1.0.
On ARM64 available since Linux 2.6.16.renameat
renameat :: proc(oldfd: Fd, old: cstring, newfd: Fd, new: cstring) -> (Errno)SourceRename the file with names relative to the specified dirfd's.
Available since Linux 2.6.16.renameat2
renameat2 :: proc(oldfd: Fd, old: cstring, newfd: Fd, new: cstring, flags: Rename_Flags) -> (Errno)SourceRename the file with names relative to the specified dirfd's with other options.
Available since Linux 3.15.rmdir
rmdir :: proc(name: cstring) -> (Errno)SourceRemove a directory specified by name.
Available since Linux 1.0.
On ARM64 available since Linux 2.6.16.rt_sigaction
rt_sigaction :: proc(sig: Signal, sigaction: ^Sig_Action, old_sigaction: ^Sig_Action) -> (Errno)SourceAlter an action taken by a process.
rt_sigpending
rt_sigpending :: proc(sigs: ^Sig_Set) -> (Errno)SourceTODO(flysand): capget TODO(flysand): capset Examine pending signals.
Available since Linux 2.2.rt_sigprocmask
rt_sigprocmask :: proc(mask_kind: Sig_Mask_Kind, new_set: ^Sig_Set, old_set: ^Sig_Set) -> (Errno)SourceExamime and alter blocked signals.
Available since Linux 2.2.rt_sigqueueinfo
rt_sigqueueinfo :: proc(pid: Pid, sig: Signal, si: ^Sig_Info) -> (Errno)SourceSend signal information to a process.
Available since Linux 2.2.rt_sigreturn
rt_sigreturn :: proc() -> ()SourceReturns from signal handlers on some archs.
rt_sigsuspend
rt_sigsuspend :: proc(sigset: ^Sig_Set) -> (Errno)SourceReplace the signal mask for a value with the new mask until a signal is received.
Available since Linux 2.2.rt_sigtimedwait
rt_sigtimedwait :: proc(sigs: ^Sig_Set, info: ^Sig_Info, time_sus: ^Time_Spec) -> (Errno, Signal)SourceSynchronously wait for queued signals.
Available since Linux 2.2.rt_tgsigqueueinfo
rt_tgsigqueueinfo :: proc(tgid: Pid, pid: Pid, sig: Signal, si: ^Sig_Info) -> (Errno)SourceTODO(flysand): inotify_init1 TODO(flysand): preadv TODO(flysand): pwritev / Send signal information to a thread / Available since Linux 2.2
sched_get_priority_max
sched_get_priority_max :: proc(policy: i32) -> (Errno, i32)SourceGet static priority range.
Available since Linux 2.0.sched_get_priority_min
sched_get_priority_min :: proc(policy: i32) -> (Errno, i32)SourceGet static priority range.
Available since Linux 2.0.sched_getaffinity
sched_getaffinity :: proc(pid: Pid, cpusetsize: uint, mask: rawptr) -> (Errno, int)SourceGet a thread's CPU affinity mask.
Available since Linux 2.6.
If you are running on a system with less than 128 cores you can use `linux.Cpu_Set` as the type for the mask argument.
Otherwise use an array of integers.sched_getattr
sched_getattr :: proc(pid: Pid, attr: ^Sched_Attr, size: u32, flags: Sched_Attr_Flags) -> (Errno)SourceGet scheduling policy and attributes.
Available since Linux 3.14.sched_getparam
sched_getparam :: proc(pid: Pid, param: ^Sched_Param) -> (Errno)SourceGet scheduling parameters.
Available since Linux 2.0.sched_getscheduler
sched_getscheduler :: proc(pid: Pid, policy: i32, param: ^Sched_Param) -> (Errno, i32)SourceGet scheduling policy/parameters.
Available since Linux 2.0.sched_rr_get_interval
sched_rr_get_interval :: proc(pid: Pid, tp: ^Time_Spec) -> (Errno)Sourceget the SCHED_RR interval for the named process.
Available since Linux 2.0.sched_setaffinity
sched_setaffinity :: proc(pid: Pid, cpusetsize: uint, mask: rawptr) -> (Errno, int)SourceSet a thread's CPU affinity mask.
Available since Linux 2.6.
If you are running on a system with less than 128 cores you can use `linux.Cpu_Set` as the type for the mask argument.
Otherwise use an array of integers.sched_setattr
sched_setattr :: proc(pid: Pid, attr: ^Sched_Attr, flags: Sched_Attr_Flags) -> (Errno)SourceTODO(flysand): process_vm_readv TODO(flysand): process_vm_writev TODO(flysand): kcmp TODO(flysand): finit_module Set scheduling policy and attributes.
Available since Linux 3.14.sched_setparam
sched_setparam :: proc(pid: Pid, param: ^Sched_Param) -> (Errno)SourceSet scheduling parameters.
Available since Linux 2.0.sched_setscheduler
sched_setscheduler :: proc(pid: Pid, policy: i32, param: ^Sched_Param) -> (Errno)SourceSet scheduling policy/parameters.
Available since Linux 2.0.sched_yield
sched_yield :: proc()SourceYield the processor.
Available since Linux 2.0.semctl3
semctl3 :: proc(key: Key, semnum: i32, cmd: IPC_Cmd) -> (Errno, int)Sourcesemctl4
semctl4 :: proc(key: Key, semnum: i32, cmd: IPC_Cmd, semun: ^Sem_Un) -> (Errno, int)Sourcesemget
semget :: proc(key: Key, n: i32, flags: IPC_Flags) -> (Errno, Key)SourceGet a SystemV semaphore set identifier.
Available since Linux 2.0.semop
semop :: proc(key: Key, ops: []Sem_Buf) -> (Errno)SourceSystemV semaphore operations.
Available since Linux 2.0.sendfile
sendfile :: proc(out_fd: Fd, in_fd: Fd, offset: ^i64, count: uint) -> (Errno, int)SourceTransfer the data between file descriptors.
Available since Linux 2.2.
On 32-bit platforms available since Linux 2.6.sendmmsg
sendmmsg :: proc(sock: Fd, msg_vec: []MMsg_Hdr, flags: Socket_Msg) -> (Errno, int)SourceTODO(flysand): fanotify_init TODO(flysand): fanotify_mark TODO(flysand): prlimit64 TODO(flysand): name_to_handle_at TODO(flysand): open_by_handle_at TODO(flysand): clock_adjtime TODO(flysand): syncfs Send multiple messages on a socket.
Available since Linux 3.0.sendmsg
sendmsg :: proc(sock: Fd, msghdr: ^Msg_Hdr, flags: Socket_Msg) -> (Errno, int)SourceSend a message on a socket.
Available since Linux 2.0.sendto
sendto :: proc(sock: Fd, buf: []u8, flags: Socket_Msg, addr: ^T) -> (Errno, int)Sourceset_tid_address
set_tid_address :: proc(tidptr: ^u32)SourceTODO(flysand): remap_file_pages Set the address of the futex that's gonna be waken when.
current thread terminates.
Available since Linux 2.6.setdomainname
setdomainname :: proc(name: string) -> (Errno)SourceSet domain name.
Note: to get the domain name, use `uname` syscall.
Available since Linux 2.2.setgid
setgid :: proc(gid: Gid) -> (Errno)SourceSet effective group id.
If the process is privileged also sets real group id.
Available since Linux 1.0.
On 32-bit platforms available since Linux 2.4.setgroups
setgroups :: proc(gids: []Gid) -> (Errno)SourceSet supplementary group IDs.
Available since Linux 1.0.
On 32-bit platforms available since Linux 2.4.sethostname
sethostname :: proc(hostname: string) -> (Errno)SourceSet hostname.
Note: to get the host name, use `uname` syscall.
Available since Linux 1.0.setitimer
setitimer :: proc(which: ITimer_Which, new: ^ITimer_Val, old: ^ITimer_Val) -> (Errno)SourceSet the value of an internal timer.
Available since Linux 1.0.setpgid
setpgid :: proc(pid: Pid, pgid: Pid) -> (Errno)SourceSet process group.
Available since Linux 1.0.setpriority
setpriority :: proc(which: Priority_Which, who: i32, prio: i32) -> (Errno)SourceSet priority on user, process group or process.
Available since Linux 1.0.setregid
setregid :: proc(real: Gid, effective: Gid) -> (Errno)SourceSet real and/or effective group id.
If any of the arguments is -1, the corresponding id is not changed.
Available since Linux 1.0.
On 32-bit platforms available since Linux 2.4.setresgid
setresgid :: proc(real: Gid, effective: Gid, saved: Uid) -> (Errno)SourceSet real, effective and/or saved group id.
If any of the arguments is -1, the corresponding id is not changed.
Available since Linux 2.2.
On 32-bit platforms available since Linux 2.4.setresuid
setresuid :: proc(real: Uid, effective: Uid, saved: Uid) -> (Errno)SourceSet real, effective and/or saved user id.
If any of the arguments is -1, the corresponding id is not changed.
Available since Linux 2.2.
On 32-bit platforms available since Linux 2.4.setreuid
setreuid :: proc(real: Uid, effective: Uid) -> (Errno)SourceSet real and/or effective user id.
If any of the arguments is -1, the corresponding id is not changed.
Available since Linux 1.0.
On 32-bit platforms available since Linux 2.4.setrlimit
setrlimit :: proc(kind: RLimit_Kind, resource: ^RLimit) -> (Errno)SourceSet limits on resources.
Available since Linux 1.0.setsid
setsid :: proc() -> (Errno, Pid)SourceCreate a session and set the process group ID.
Available since Linux 2.0.setsockopt_base
setsockopt_base :: proc(sock: Fd, level: int, opt: int, val: T) -> (Errno)SourceTODO(flysand): the parameters are the same, maybe there's a way to make it into a single proc, sacrificing type safety slightly TODO(flysand): add ability to specify slices
setsockopt_sock
setsockopt_sock :: proc(sock: Fd, level: Socket_API_Level_Sock, opt: Socket_Option, val: T) -> (Errno)Sourcesetsockopt_tcp
setsockopt_tcp :: proc(sock: Fd, level: Socket_API_Level_TCP, opt: Socket_TCP_Option, val: T) -> (Errno)Sourcesetsockopt_udp
setsockopt_udp :: proc(sock: Fd, level: Socket_API_Level_UDP, opt: Socket_UDP_Option, val: T) -> (Errno)Sourcesettimeofday
settimeofday :: proc(tv: ^Time_Val) -> (Errno)SourceSet Time
Available since Linux 1.0setuid
setuid :: proc(uid: Uid) -> (Errno)SourceSet effective User ID.
Available since Linux 1.0.
On 32-bit platforms available since Linux 2.4.setxattr
setxattr :: proc(path: cstring, name: cstring, value: rawptr, size: uint, flags: i32) -> (Errno)SourceSet an extended attribute value
Available since Linux 2.6.25shmat
shmat :: proc(key: Key, addr: rawptr, flags: IPC_Flags) -> (Errno, rawptr)SourceSystemV shared memory segment operations.
Available since Linux 2.0.shmctl_ds
shmctl_ds :: proc(key: Key, cmd: IPC_Cmd, buf: ^Shmid_DS) -> (Errno)Sourceshmctl_info
shmctl_info :: proc(key: Key, cmd: IPC_Cmd, buf: ^Shm_Info) -> (Errno, int)Sourceshmdt
shmdt :: proc(shmaddr: rawptr) -> (Errno)SourceSystemV shared memory operations.
Available since Linux 2.0.shmget
shmget :: proc(key: Key, size: uint, flags: IPC_Flags) -> (Errno, Key)SourceAllocate a SystemV shared memory segment.
Available since Linux 2.0.shutdown
shutdown :: proc(sock: Fd, how: Shutdown_How) -> (Errno)SourceShutdown a socket.
Available since Linux 2.0.sigaltstack
sigaltstack :: proc(stack: ^Sig_Stack, old_stack: ^Sig_Stack) -> (Errno)SourceSet or get signal stack context.
Available since Linux 2.2.socket
socket :: proc(domain: Address_Family, socktype: Socket_Type, sockflags: Socket_FD_Flags, protocol: Protocol) -> (Errno, Fd)SourceCreate a socket file descriptor.
Available since Linux 2.0.socketpair
socketpair :: proc(domain: Protocol_Family, type: Socket_Type, proto: Protocol, pair: ^[2]Fd) -> (Errno)SourceCreate a pair of connected sockets.
Available since Linux 2.0.splice
splice :: proc(
fd_in: Fd,
off_in: ^i64,
fd_out: Fd,
off_out: ^i64,
len: uint,
flags: Splice_Flags,
) -> (Errno, int)SourceTODO(flysand): unshare TODO(flysand): set_robust_list TODO(flysand): get_robust_list Transfer the data between file descriptors.
Available since Linux 2.6.17.stat
stat :: proc(filename: cstring, stat: ^Stat) -> (Errno)SourceGet file status.
Returns information about the file in struct pointed to by `stat` parameter.
Available since Linux 1.0
For 32-bit systems a different syscall is used that became available since 2.4.
Not available on ARM64.statfs
statfs :: proc(path: cstring, statfs: ^Stat_FS) -> (Errno)SourceTODO(flysand): ustat Query information about filesystem.
Available since Linux 1.0.
For 32-bit systems a different syscall is used that became available since 2.6.statx
statx :: proc(dir: Fd, pathname: cstring, flags: FD_Flags, mask: Statx_Mask, statx: ^Statx) -> (Errno)SourceTODO(flysand): userfaultfd TODO(flysand): membarrier TODO(flysand): mlock2 TODO(flysand): copy_file_range TODO(flysand): preadv2 TODO(flysand): pwritev2 TODO(flysand): pkey_mprotect TODO(flysand): pkey_alloc TODO(flysand): pkey_free Query extended information about the file
The file can be specified as:
- absolute pathname: `dir` parameter is ignored
- relatvie pathname: `dir` parameter specifies the base directory's fd
- file descriptor: `AT_EMPTY_PATH` is passed in flags, pathname is empty, `dir` specifies the file descriptor
Available since Linux 4.11swapoff
swapoff :: proc(path: cstring) -> (Errno)SourceStop swapping to file/device
Available since Linux 2.0swapon
swapon :: proc(path: cstring, swapflags: Swap_Flags) -> (Errno)SourceStart swapping to file/device
Available since Linux 2.0symlink
symlink :: proc(target: cstring, linkpath: cstring) -> (Errno)SourceCreate a symbolic link.
Available since Linux 1.0.
On arm64 available since Linux 2.6.16.symlinkat
symlinkat :: proc(target: cstring, dirfd: Fd, linkpath: cstring) -> (Errno)SourceCreate a symbolic link at specified dirfd.
Available since Linux 2.6.16.sync
sync :: proc() -> (Errno)SourceCommit filesystem caches to disk
Available since Linux 1.0.sysinfo
sysinfo :: proc(sysinfo: ^Sys_Info) -> (Errno)SourceGet information about the system.
Available since Linux 1.0.syslog
syslog :: proc(act: Syslog_Action, buf: []u8) -> (Errno, int)SourceRead or clear kernel message ring buffer.
Available since Linux 1.0.tee
tee :: proc(fd_in: Fd, fd_out: Fd, len: uint, flags: Splice_Flags) -> (Errno, int)SourceTransfer the data between file descriptors.
Available since Linux 2.6.16.tgkill
tgkill :: proc(tgid: Pid, tid: Pid, sig: Signal) -> (Errno)SourceSend a signal to a specific thread in a thread group.
Available since Linux 2.6.time
time :: proc(tloc: ^uint) -> (Errno)SourceGet current time in seconds.
Available since Linux 1.0.timer_create
timer_create :: proc(clock_id: Clock_Id, sigevent: ^Sig_Event, timer: ^Timer) -> (Errno)SourceTODO(flysand): semtimedop TODO(flysand): fadvise64 Create POSIX per-process timer.
Available since Linux 2.6.timer_delete
timer_delete :: proc(timer: Timer) -> (Errno)SourceDelete a POSIX per-process timer.
Available since Linux 2.6.timer_getoverrun
timer_getoverrun :: proc(timer: Timer) -> (Errno, int)SourceGet overrun count of the POSIX per-process timer.
Available since Linux 2.6.timer_gettime
timer_gettime :: proc(timer: Timer, curr_value: ^ITimer_Spec) -> (Errno)SourceGet the state of the POSIX per-process timer.
Available since Linux 2.6.timer_settime
timer_settime :: proc(timer: Timer, flags: ITimer_Flags, no_alias, old_value: ^ITimer_Spec) -> (Errno)SourceArm/disarm the state of the POSIX per-process timer.
Available since Linux 2.6.timerfd_create
timerfd_create :: proc(clock_id: Clock_Id, flags: Open_Flags) -> (Errno, Fd)SourceTODO(flysand): signalfd Create Linux file descriptor based timer.
Available since Linux 2.6.25timerfd_gettime
timerfd_gettime :: proc(fd: Fd, curr_value: ^ITimer_Spec) -> (Errno)SourceGet the state of the Linux file descriptor based timer.
Available since Linux 2.6.25timerfd_settime
timerfd_settime :: proc(fd: Fd, flags: ITimer_Flags, new_value: ^ITimer_Spec, old_value: ^ITimer_Spec) -> (Errno)SourceTODO(flysand): fallocate Arm/disarm the state of the Linux file descriptor based timer.
Available since Linux 2.6.25times
times :: proc(tms: ^Tms) -> (Errno)SourceGet current process times.
Available since Linux 1.0.truncate
truncate :: proc(name: cstring, length: i64) -> (Errno)SourceTruncate a file to specified length.
Available since Linux 1.0.
On 32-bit architectures available since Linux 2.4.umask
umask :: proc(mask: Mode) -> (Mode)SourceSet file mode creation mask.
Available since Linux 1.0.umount2
umount2 :: proc(target: cstring, flags: Umount2_Flags) -> (Errno)SourceUnmount filesystem
Available since Linux 2.1uname
uname :: proc(uts_name: ^UTS_Name) -> (Errno)SourceGet system information.
Available since Linux 1.0.unlink
unlink :: proc(name: cstring) -> (Errno)SourceDelete a name, and possible a file it refers to.
Available since Linux 1.0.
On ARM64 available since Linux 2.6.16.unlinkat
unlinkat :: proc(dirfd: Fd, name: cstring, flags: FD_Flags) -> (Errno)SourceRemove a directory entry relative to a directory file descriptor.
Available since Linux 2.6.16.utimensat
utimensat :: proc(dirfd: Fd, name: cstring, utimes: [^]Time_Spec, flags: FD_Flags) -> (Errno)SourceTODO(flysand): sync_file_range TODO(flysand): vmsplice TODO(flysand): move_pages Change file timestamps with nanosecond precision.
**utimes** must point to an array of two `Time_Spec`'s. The "utime" is the
last access time, the second is last modification time.
Available since Linux 2.6.22.vfork
vfork :: proc() -> (Pid)SourceCreate a child process and block parent.
Available since Linux 2.2.vhangup
vhangup :: proc() -> (Errno)SourceVirtually hangup the current terminal
Available since Linux 1.0.wait4
wait4 :: proc(pid: Pid, status: ^u32, options: Wait_Options, rusage: ^RUsage) -> (Errno, Pid)SourceWait for the process to change state.
Available since Linux 1.0.waitid
waitid :: proc(id_type: Id_Type, id: Id, sig_info: ^Sig_Info, options: Wait_Options, rusage: ^RUsage) -> (Errno)SourceTODO(flysand): utimes TODO(flysand): vserver TODO(flysand): mbind TODO(flysand): set_mempolicy TODO(flysand): get_mempolicy TODO(flysand): mq_open TODO(flysand): mq_unlink TODO(flysand): mq_timedsend TODO(flysand): mq_timedreceive TODO(flysand): mq_notify TODO(flysand): mq_getsetattr TODO(flysand): kexec_load Wait on process, process group or pid file descriptor.
Available since Linux 2.6.10.waitpid
waitpid :: proc(pid: Pid, status: ^u32, options: Wait_Options, rusage: ^RUsage) -> (Errno, Pid)SourceSee wait4 for documentation.
write
write :: proc(fd: Fd, buf: []u8) -> (Errno, int)SourceWrite the data from a buffer into the file
Returns the number of bytes successfully written, which may be less than the size
of the buffer, even if the termination is successfull
When using direct I/O, error doesn't mean the write has failed. Partial data may
have been written.
If .Eintr is returned, the write operation has failed due to interrupt. You'll probably
need to restart this syscall
Available since Linux 1.0
Before Linux 3.14 this operation is not atomic (i.e. not thread safe)writev
writev :: proc(fd: Fd, iov: []IO_Vec) -> (Errno, int)SourceWrite the data from multiple buffers into a file.
Available since Linux 2.0.Procedure Groups
10fcntl
fcntl :: proc{fcntl_dupfd, fcntl_dupfd_cloexec, fcntl_getfd, fcntl_setfd, fcntl_getfl, fcntl_setfl, fcntl_setlk, fcntl_setlkw, fcntl_getlk, fcntl_getown_ex, fcntl_setown_ex, fcntl_getsig, fcntl_setsig, fcntl_setlease, fcntl_getlease, fcntl_notify, fcntl_setpipe_sz, fcntl_getpipe_sz, fcntl_add_seals, fcntl_get_seals, fcntl_get_rw_hint, fcntl_set_rw_hint, fcntl_get_file_rw_hint, fcntl_set_file_rw_hint}Sourcefutex
futex :: proc{futex_wait, futex_wake, futex_cmp_requeue, futex_requeue, futex_wake_op, futex_wait_bitset, futex_wake_bitset}SourceTODO(flysand): Priority inheritance (PI) futicees
getsockopt
getsockopt :: proc{getsockopt_sock, getsockopt_tcp, getsockopt_udp, getsockopt_base}SourceGet socket option for a given socket API level.
Available since Linux 2.0.ptrace
ptrace :: proc{ptrace_traceme, ptrace_peek, ptrace_poke, ptrace_getregs, ptrace_getfpregs, ptrace_getfpxregs, ptrace_setregs, ptrace_setfpregs, ptrace_setfpxregs, ptrace_getregset, ptrace_setregset, ptrace_getsiginfo, ptrace_peeksiginfo, ptrace_getsigmask, ptrace_setsigmask, ptrace_setoptions, ptrace_geteventmsg, ptrace_cont, ptrace_singlestep, ptrace_syscall, ptrace_sysemu, ptrace_sysemu_singlestep, ptrace_listen, ptrace_interrupt, ptrace_attach, ptrace_seize, ptrace_detach}SourceTODO(flysand): ptrace_get_thread_area TODO(flysand): ptrace_set_thread_area TODO(flysand): ptrace_get_syscall_info Trace process.
recv
recv :: proc{recvfrom}SourceReceive a message from a socket.
Available since Linux 2.0.semctl
semctl :: proc{semctl3, semctl4}SourceSystemV semaphore control operations.
Available since Linux 2.0.send
send :: proc{sendto}SourceSend a message through a socket.
Available since Linux 2.0.setsockopt
setsockopt :: proc{setsockopt_sock, setsockopt_tcp, setsockopt_udp, setsockopt_base}SourceSet socket option for a given socket API level.
Available since Linux 2.0.shmctl
shmctl :: proc{shmctl_ds, shmctl_info}SourceSystemV shared memory control.
Available since Linux 2.0.syscall
syscall :: proc{}Source