Platform-specific package target: linux_arm64

Collection Info

View Source
Collection
core
Path
sys/linux
Entries
1244

Source Files

(hidden platform specific files)

Constants

555

AT_FDCWD #

Source
AT_FDCWD :: Fd(-100)

Special file descriptor to pass to `*at` functions to specify that relative paths are relative to current directory.

F_ADD_SEALS #

Source
F_ADD_SEALS :: FCntl_Command_ADD_SEALS(.ADD_SEALS)

F_DUPFD_CLOEXEC #

Source
F_DUPFD_CLOEXEC :: FCntl_Command_DUPFD_CLOEXEC(.DUPFD_CLOEXEC)

F_GET_FILE_RW_HINT #

Source
F_GET_FILE_RW_HINT :: FCntl_Command_GET_FILE_RW_HINT(.GET_FILE_RW_HINT)

F_GET_RW_HINT #

Source
F_GET_RW_HINT :: FCntl_Command_GET_RW_HINT(.GET_RW_HINT)

F_GET_SEALS #

Source
F_GET_SEALS :: FCntl_Command_GET_SEALS(.GET_SEALS)

F_GETLK #

Source
F_GETLK :: FCntl_Command_GETLK(.GETLK)

F_GETLK64 :: FCntl_Command_GETLK64(.GETLK64) F_SETLK64 :: FCntl_Command_SETLK64(.SETLK64) F_SETLKW64 :: FCntl_Command_SETLKW64(.SETLKW64)

F_GETOWN_EX #

Source
F_GETOWN_EX :: FCntl_Command_GETOWN_EX(.GETOWN_EX)

F_GETPIPE_SZ #

Source
F_GETPIPE_SZ :: FCntl_Command_GETPIPE_SZ(.GETPIPE_SZ)

F_OK #

Source
F_OK :: Mode{}

For access.2 syscall family: instruct to check if the file exists.

F_SET_FILE_RW_HINT #

Source
F_SET_FILE_RW_HINT :: FCntl_Command_SET_FILE_RW_HINT(.SET_FILE_RW_HINT)

F_SET_RW_HINT #

Source
F_SET_RW_HINT :: FCntl_Command_SET_RW_HINT(.SET_RW_HINT)

F_SETOWN_EX #

Source
F_SETOWN_EX :: FCntl_Command_SETOWN_EX(.SETOWN_EX)

F_SETPIPE_SZ #

Source
F_SETPIPE_SZ :: FCntl_Command_SETPIPE_SZ(.SETPIPE_SZ)

FUTEX_CMP_REQUEUE #

Source
FUTEX_CMP_REQUEUE :: Futex_Cmp_Requeue_Type(.CMP_REQUEUE)

Requeue waiters from one futex to another if the value at mutex matches.

FUTEX_CMP_REQUEUE_PI #

Source
FUTEX_CMP_REQUEUE_PI :: Futex_Cmp_requeue_Pi_Type(.CMP_REQUEUE_PI)

FUTEX_FD #

Source
FUTEX_FD :: Futex_Fd_Type(.FD)

Not implemented. Basically, since.

FUTEX_LOCK_PI #

Source
FUTEX_LOCK_PI :: Futex_Lock_Pi_Type(.LOCK_PI)

TODO(flysand): Priority inversion futexes

FUTEX_LOCK_PI2 #

Source
FUTEX_LOCK_PI2 :: Futex_Lock_Pi2_Type(.LOCK_PI2)

FUTEX_REQUEUE #

Source
FUTEX_REQUEUE :: Futex_Requeue_Type(.REQUEUE)

Requeue waiters from one futex to another.

FUTEX_TRYLOCK_PI #

Source
FUTEX_TRYLOCK_PI :: Futex_Trylock_Pi_Type(.TRYLOCK_PI)

FUTEX_UNLOCK_PI #

Source
FUTEX_UNLOCK_PI :: Futex_Unlock_Pi_Type(.UNLOCK_PI)

FUTEX_WAIT #

Source
FUTEX_WAIT :: Futex_Wait_Type(.WAIT)

Wait on futex wakeup signal.

FUTEX_WAIT_BITSET #

Source
FUTEX_WAIT_BITSET :: Futex_Wait_Bitset_Type(.WAIT_BITSET)

Wait on a futex, but the value is a bitset.

FUTEX_WAIT_REQUEUE_PI #

Source
FUTEX_WAIT_REQUEUE_PI :: Futex_Wait_requeue_Pi_Type(.WAIT_REQUEUE_PI)

FUTEX_WAKE #

Source
FUTEX_WAKE :: Futex_Wake_Type(.WAKE)

Wake up other processes waiting on the futex.

FUTEX_WAKE_BITSET #

Source
FUTEX_WAKE_BITSET :: Futex_Wake_Bitset_Type(.WAKE_BITSET)

Wait on a futex, but the value is a bitset.

FUTEX_WAKE_OP #

Source
FUTEX_WAKE_OP :: Futex_Wake_Op_Type(.WAKE_OP)

See man pages, I'm not describing it here.

IN_ALL_EVENTS #

Source
IN_ALL_EVENTS :: Inotify_Event_Mask{.ACCESS, .MODIFY, .ATTRIB, .CLOSE_WRITE, .CLOSE_NOWRITE, .OPEN, .MOVED_FROM, .MOVED_TO, .CREATE, .DELETE, .DELETE_SELF, .MOVE_SELF}

IN_CLOSE #

Source
IN_CLOSE :: Inotify_Event_Mask{.CLOSE_WRITE, .CLOSE_NOWRITE}

IN_MOVE #

Source
IN_MOVE :: Inotify_Event_Mask{.MOVED_FROM, .MOVED_TO}

IORING_TIMEOUT_CLOCK_MASK #

Source
IORING_TIMEOUT_CLOCK_MASK :: IO_Uring_Timeout_Flags{.BOOTTIME, .REALTIME}

IORING_TIMEOUT_UPDATE_MASK #

Source
IORING_TIMEOUT_UPDATE_MASK :: IO_Uring_Timeout_Flags{.UPDATE, .LINK_TIMEOUT_UPDATE}

IPC_PRIVATE #

Source
IPC_PRIVATE :: Key(0)

Tell `shmget` to create a new key

MAP_HUGE_16GB #

Source
MAP_HUGE_16GB :: transmute(Map_Flags)(u32(34) << MAP_HUGE_SHIFT)

MAP_HUGE_16KB #

Source
MAP_HUGE_16KB :: transmute(Map_Flags)(u32(14) << MAP_HUGE_SHIFT)

MAP_HUGE_16MB #

Source
MAP_HUGE_16MB :: transmute(Map_Flags)(u32(24) << MAP_HUGE_SHIFT)

MAP_HUGE_1GB #

Source
MAP_HUGE_1GB :: transmute(Map_Flags)(u32(30) << MAP_HUGE_SHIFT)

MAP_HUGE_1MB #

Source
MAP_HUGE_1MB :: transmute(Map_Flags)(u32(20) << MAP_HUGE_SHIFT)

MAP_HUGE_256MB #

Source
MAP_HUGE_256MB :: transmute(Map_Flags)(u32(28) << MAP_HUGE_SHIFT)

MAP_HUGE_2GB #

Source
MAP_HUGE_2GB :: transmute(Map_Flags)(u32(31) << MAP_HUGE_SHIFT)

MAP_HUGE_2MB #

Source
MAP_HUGE_2MB :: transmute(Map_Flags)(u32(21) << MAP_HUGE_SHIFT)

MAP_HUGE_32MB #

Source
MAP_HUGE_32MB :: transmute(Map_Flags)(u32(25) << MAP_HUGE_SHIFT)

MAP_HUGE_512KB #

Source
MAP_HUGE_512KB :: transmute(Map_Flags)(u32(19) << MAP_HUGE_SHIFT)

MAP_HUGE_512MB #

Source
MAP_HUGE_512MB :: transmute(Map_Flags)(u32(29) << MAP_HUGE_SHIFT)

MAP_HUGE_64KB #

Source
MAP_HUGE_64KB :: transmute(Map_Flags)(u32(16) << MAP_HUGE_SHIFT)

MAP_HUGE_8MB #

Source
MAP_HUGE_8MB :: transmute(Map_Flags)(u32(23) << MAP_HUGE_SHIFT)

MAP_SHARED_VALIDATE #

Source
MAP_SHARED_VALIDATE :: Map_Flags{.SHARED, .PRIVATE}

MFD_HUGE_16GB #

Source
MFD_HUGE_16GB :: transmute(Memfd_Create_Flags)(u32(34) << MAP_HUGE_SHIFT)

MFD_HUGE_16KB #

Source
MFD_HUGE_16KB :: transmute(Memfd_Create_Flags)(u32(14) << MAP_HUGE_SHIFT)

MFD_HUGE_16MB #

Source
MFD_HUGE_16MB :: transmute(Memfd_Create_Flags)(u32(24) << MAP_HUGE_SHIFT)

MFD_HUGE_1GB #

Source
MFD_HUGE_1GB :: transmute(Memfd_Create_Flags)(u32(30) << MAP_HUGE_SHIFT)

MFD_HUGE_1MB #

Source
MFD_HUGE_1MB :: transmute(Memfd_Create_Flags)(u32(20) << MAP_HUGE_SHIFT)

MFD_HUGE_256MB #

Source
MFD_HUGE_256MB :: transmute(Memfd_Create_Flags)(u32(28) << MAP_HUGE_SHIFT)

MFD_HUGE_2GB #

Source
MFD_HUGE_2GB :: transmute(Memfd_Create_Flags)(u32(31) << MAP_HUGE_SHIFT)

MFD_HUGE_2MB #

Source
MFD_HUGE_2MB :: transmute(Memfd_Create_Flags)(u32(21) << MAP_HUGE_SHIFT)

MFD_HUGE_32MB #

Source
MFD_HUGE_32MB :: transmute(Memfd_Create_Flags)(u32(25) << MAP_HUGE_SHIFT)

MFD_HUGE_512KB #

Source
MFD_HUGE_512KB :: transmute(Memfd_Create_Flags)(u32(19) << MAP_HUGE_SHIFT)

MFD_HUGE_512MB #

Source
MFD_HUGE_512MB :: transmute(Memfd_Create_Flags)(u32(29) << MAP_HUGE_SHIFT)

MFD_HUGE_64KB #

Source
MFD_HUGE_64KB :: transmute(Memfd_Create_Flags)(u32(16) << MAP_HUGE_SHIFT)

MFD_HUGE_8MB #

Source
MFD_HUGE_8MB :: transmute(Memfd_Create_Flags)(u32(23) << MAP_HUGE_SHIFT)

PER_LINUX #

Source
PER_LINUX :: 0x0000

Personality type These go into the bottom 8 bits of the personality value

PER_LINUX_32BIT #

Source
PER_LINUX_32BIT :: 0x0000 | ADDR_LIMIT_32BIT

PER_OSR5 #

Source
PER_OSR5 :: 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS

PER_SCOSVR3 #

Source
PER_SCOSVR3 :: 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE

PER_SVR4 #

Source
PER_SVR4 :: 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO

PER_UW7 #

Source
PER_UW7 :: 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO

PER_WYSEV386 #

Source
PER_WYSEV386 :: 0x0004 | STICKY_TIMEOUTS | SHORT_INODE

PER_XENIX #

Source
PER_XENIX :: 0x0007 | STICKY_TIMEOUTS | SHORT_INODE

PRIO_MAX #

Source
PRIO_MAX :: 20

Maximum priority (aka nice value) for the process.

PRIO_MIN #

Source
PRIO_MIN :: -20

Minimum priority (aka nice value) for the process.

PTRACE_ARCH_PRCTL #

Source
PTRACE_ARCH_PRCTL :: PTrace_Arch_Prctl_Type(.ARCH_PRCTL)

PTRACE_GET_RSEQ_CONFIGURATION #

Source
PTRACE_GET_RSEQ_CONFIGURATION :: PTrace_Get_RSeq_Configuration_Type(.GET_RSEQ_CONFIGURATION)

PTRACE_GET_SYSCALL_INFO #

Source
PTRACE_GET_SYSCALL_INFO :: PTrace_Get_Syscall_Info_Type(.GET_SYSCALL_INFO)

PTRACE_GET_THREAD_AREA #

Source
PTRACE_GET_THREAD_AREA :: PTrace_Get_Thread_Area_Type(.GET_THREAD_AREA)

PTRACE_GETEVENTMSG #

Source
PTRACE_GETEVENTMSG :: PTrace_Geteventmsg_Type(.GETEVENTMSG)

PTRACE_GETFPREGS #

Source
PTRACE_GETFPREGS :: PTrace_Getfpregs_Type(.GETFPREGS)

PTRACE_GETFPXREGS #

Source
PTRACE_GETFPXREGS :: PTrace_Getfpxregs_Type(.GETFPXREGS)

PTRACE_GETREGS #

Source
PTRACE_GETREGS :: PTrace_Getregs_Type(.GETREGS)

PTRACE_GETREGSET #

Source
PTRACE_GETREGSET :: PTrace_Getregset_Type(.GETREGSET)

PTRACE_GETSIGINFO #

Source
PTRACE_GETSIGINFO :: PTrace_Getsiginfo_Type(.GETSIGINFO)

PTRACE_GETSIGMASK #

Source
PTRACE_GETSIGMASK :: PTrace_Getsigmask_Type(.GETSIGMASK)

PTRACE_INTERRUPT #

Source
PTRACE_INTERRUPT :: PTrace_Interrupt_Type(.INTERRUPT)

PTRACE_PEEKDATA #

Source
PTRACE_PEEKDATA :: PTrace_Peek_Type(.PEEKDATA)

PTRACE_PEEKSIGINFO #

Source
PTRACE_PEEKSIGINFO :: PTrace_Peeksiginfo_Type(.PEEKSIGINFO)

PTRACE_PEEKTEXT #

Source
PTRACE_PEEKTEXT :: PTrace_Peek_Type(.PEEKTEXT)

PTRACE_PEEKUSER #

Source
PTRACE_PEEKUSER :: PTrace_Peek_Type(.PEEKUSER)

PTRACE_POKEDATA #

Source
PTRACE_POKEDATA :: PTrace_Poke_Type(.POKEDATA)

PTRACE_POKETEXT #

Source
PTRACE_POKETEXT :: PTrace_Poke_Type(.POKETEXT)

PTRACE_POKEUSER #

Source
PTRACE_POKEUSER :: PTrace_Poke_Type(.POKEUSER)

PTRACE_SECCOMP_GET_FILTER #

Source
PTRACE_SECCOMP_GET_FILTER :: PTrace_Seccomp_Get_Filter_Type(.SECCOMP_GET_FILTER)

PTRACE_SECCOMP_GET_METADATA #

Source
PTRACE_SECCOMP_GET_METADATA :: PTrace_Seccomp_Get_Metadata_Type(.SECCOMP_GET_METADATA)

PTRACE_SET_THREAD_AREA #

Source
PTRACE_SET_THREAD_AREA :: PTrace_Set_Thread_Area_Type(.SET_THREAD_AREA)

PTRACE_SETFPREGS #

Source
PTRACE_SETFPREGS :: PTrace_Setfpregs_Type(.SETFPREGS)

PTRACE_SETFPXREGS #

Source
PTRACE_SETFPXREGS :: PTrace_Setfpxregs_Type(.SETFPXREGS)

PTRACE_SETOPTIONS #

Source
PTRACE_SETOPTIONS :: PTrace_Setoptions_Type(.SETOPTIONS)

PTRACE_SETREGS #

Source
PTRACE_SETREGS :: PTrace_Setregs_Type(.SETREGS)

PTRACE_SETREGSET #

Source
PTRACE_SETREGSET :: PTrace_Setregset_Type(.SETREGSET)

PTRACE_SETSIGINFO #

Source
PTRACE_SETSIGINFO :: PTrace_Setsiginfo_Type(.SETSIGINFO)

PTRACE_SETSIGMASK #

Source
PTRACE_SETSIGMASK :: PTrace_Setsigmask_Type(.SETSIGMASK)

PTRACE_SINGLEBLOCK #

Source
PTRACE_SINGLEBLOCK :: PTrace_Singleblock_Type(.SINGLEBLOCK)

PTRACE_SINGLESTEP #

Source
PTRACE_SINGLESTEP :: PTrace_Singlestep_Type(.SINGLESTEP)

PTRACE_SYSCALL #

Source
PTRACE_SYSCALL :: PTrace_Syscall_Type(.SYSCALL)

PTRACE_SYSEMU_SINGLESTEP #

Source
PTRACE_SYSEMU_SINGLESTEP :: PTrace_Sysemu_Singlestep_Type(.SYSEMU_SINGLESTEP)

PTRACE_TRACEME #

Source
PTRACE_TRACEME :: PTrace_Traceme_Type(.TRACEME)

R_OK #

Source
R_OK :: Mode{.IROTH}

For access.2 syscall family: instruct to check if the file is readable.

SIGEV_PAD_SIZE #

Source
SIGEV_PAD_SIZE :: (SIGEV_MAX_SIZE - size_of(i32) * 2 + size_of(Sig_Val)) / size_of(i32)

STATX_BASIC_STATS #

Source
STATX_BASIC_STATS :: Statx_Mask{.TYPE, .MODE, .NLINK, .UID, .GID, .ATIME, .MTIME, .CTIME, .INO, .SIZE, .BLOCKS}

The stats you get by calling `stat`.

STDERR_FILENO #

Source
STDERR_FILENO :: Fd(2)

Standard error file descriptor

STDIN_FILENO #

Source
STDIN_FILENO :: Fd(0)

Standard input file descriptor

STDOUT_FILENO #

Source
STDOUT_FILENO :: Fd(1)

Standard output file descriptor

SYS_landlock_create_ruleset #

Source
SYS_landlock_create_ruleset :: uintptr(444)

SYS_landlock_restrict_self #

Source
SYS_landlock_restrict_self :: uintptr(446)

SYS_sched_get_priority_max #

Source
SYS_sched_get_priority_max :: uintptr(146)

SYS_sched_get_priority_min #

Source
SYS_sched_get_priority_min :: uintptr(147)

SYS_sched_getscheduler #

Source
SYS_sched_getscheduler :: uintptr(145)

SYS_sched_rr_get_interval #

Source
SYS_sched_rr_get_interval :: uintptr(148)

SYS_sched_setscheduler #

Source
SYS_sched_setscheduler :: uintptr(144)

SYS_set_mempolicy_home_node #

Source
SYS_set_mempolicy_home_node :: uintptr(450)

UTIME_NOW #

Source
UTIME_NOW :: uint((1 << 30) - 1)

Special value to put into timespec for utimensat() to set timestamp to the current time.

UTIME_OMIT #

Source
UTIME_OMIT :: uint((1 << 30) - 2)

Special value to put into the timespec for utimensat() to leave the corresponding field of the timestamp unchanged.

W_OK #

Source
W_OK :: Mode{.IWOTH}

For access.2 syscall family: instruct to check if the file is writeable.

WAIT_ANY #

Source
WAIT_ANY :: Pid(-1)

For wait4: Pass this pid to wait for any process.

WAIT_MYPGRP #

Source
WAIT_MYPGRP :: Pid(0)

For wait4: Pass this pid to wait for any process in current process group.

X_OK #

Source
X_OK :: Mode{.IXOTH}

For access.2 syscall family: instruct to check if the file is executable.

Types

349

Address_Family #

Source
Address_Family :: Address_Family

Address family for the socket. Typically there's one address family for every protocol family.

Dirent #

Source
Dirent :: Dirent

Directory entry record. Recommended to iterate these with `dirent_iterate_buf()`, and obtain the name via `dirent_name()`.

FLock_Op #

Source
FLock_Op :: bit_set[FLock_Op_Bits]

File locking operations. Use one of `EX`, `RW` or `UN` to specify the operation, and add `UN` if you need a non-blocking operation.

Inode #

Source
Inode :: distinct Inode

Type for 64-bit inode number for files. Used pretty much only in struct Stat64 for 32-bit platforms.

IPC_Flags_Bits #

Source
IPC_Flags_Bits :: IPC_Flags_Bits

Bits 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).

Key #

Source
Key :: distinct Key

Shared memory identifiers used by shmget(2) and other calls.

Map_Flags #

Source
Map_Flags :: bit_set[Map_Flags_Bits]

Flags for mmap. See `constants.odin` for `MAP_SHARED_VALIDATE` and `MAP_HUGE_16KB`, et al.

Map_Flags_Bits #

Source
Map_Flags_Bits :: Map_Flags_Bits

Bits for Map_Flags See `constants.odin` for `MAP_SHARED_VALIDATE` and `MAP_HUGE_16KB`, et al.

Mode #

Source
Mode :: bit_set[Mode_Bits]

Represents 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_IRWXG ``` This would generate a mode that has full permissions for the file's owner and group, and only "read" and "execute" bits for others.

Protocol #

Source
Protocol :: Protocol

The 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/protocols

PTrace_Note_Type #

Source
PTrace_Note_Type :: PTrace_Note_Type

Note types for PTRACE_GETREGSET. Mirrors constants in `elf` definition, files though this enum only contains the constants defined for architectures Odin can compile to.

Socket_FD_Flags #

Source
Socket_FD_Flags :: bit_set[Socket_FD_Flags_Bits]

Flags 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_Option #

Source
Socket_Option :: Socket_Option

If Socket_API_Level == .SOCKET, these are the options you can specify in getsockopt(2)/setsockopt(2)

Socket_Type #

Source
Socket_Type :: Socket_Type

Type of socket to create - For TCP you want to use SOCK_STREAM - For UDP you want to use SOCK_DGRAM Also see `Protocol`

Stat #

Source
Stat :: Stat

Represents the file state. If you're on 32-bit platform, consider using Stat64 instead.

Statx_Attr #

Source
Statx_Attr :: bit_set[Statx_Attr_Bits]

File attributes, returned by statx. This bitset is also used to specify which attributes are present, not just their value.

Procedures

330

accept #

Source
accept :: proc "contextless" (sock: Fd, addr: ^$T, sockflags: bit_set[Socket_FD_Flags_Bits] = {}) -> (Fd, Errno) {…}

Accept a pending connection or block until new connection appears. Depends on Sock_FD_Flags of the `sock` parameter. Available since Linux 2.0.

access #

Source
access :: proc "contextless" (name: cstring, mode: bit_set[Mode_Bits] = F_OK) -> Errno {…}

Check 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 #

Source
acct :: proc "contextless" (filename: cstring) -> Errno {…}

Switch process accounting on or off Available since Linux 2.3.23

alarm #

Source
alarm :: proc "contextless" (seconds: u32) -> u32 {…}

Set an alarm clock for delivery of a signal. Available since Linux 1.0.

arch_prctl #

Source
arch_prctl :: proc "contextless" (op: i32, addr: uint) -> Errno {…}

Set architecture-specific thread state Available since Linux 2.6.19

bind #

Source
bind :: proc "contextless" (sock: Fd, addr: ^$T) -> Errno {…}

Bind a socket to the given local address. Available since Linux 2.0.

brk #

Source
brk :: proc "contextless" (addr: uintptr) -> Errno {…}

Extend 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 #

Source
chdir :: proc "contextless" (path: cstring) -> Errno {…}

Change working directory to the directory specified by path. Available since Linux 1.0.

chmod #

Source
chmod :: proc "contextless" (name: cstring, mode: bit_set[Mode_Bits]) -> Errno {…}

Change file permissions. Available since Linux 1.0. On ARM64 available since Linux 2.6.16.

chown #

Source
chown :: proc "contextless" (name: cstring, uid: Uid, gid: Gid) -> Errno {…}

Change 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.

clock_getres #

Source
clock_getres :: proc "contextless" (clock: Clock_Id) -> (res: Time_Spec, err: Errno) {…}

Finds the resolution of the specified clock. Available since Linux 2.6.

clock_gettime #

Source
clock_gettime :: proc "contextless" (clock: Clock_Id) -> (ts: Time_Spec, err: Errno) {…}

Retrieve the time of the specified clock. Available since Linux 2.6.

close #

Source
close :: proc "contextless" (fd: Fd) -> Errno {…}

Close the file. Available since Linux 1.0.

close_range #

Source
close_range :: proc "contextless" (lo: Fd, hi: Fd, flags: bit_set[Close_Range_Flags_Bits]) -> Errno {…}

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 #

Source
connect :: proc "contextless" (sock: Fd, addr: ^$T) -> Errno {…}

Connect the socket to the address. Available since Linux 2.0.

creat #

Source
creat :: proc "contextless" (name: cstring, mode: bit_set[Mode_Bits]) -> (Fd, Errno) {…}

Create a file. Available since Linux 1.0. On ARM64 available since Linux 2.6.16.

delete_module #

Source
delete_module :: proc "contextless" (name: cstring, flags: u32) -> Errno {…}

Unload a kernel module Available since Linux 2.2

dirent_iterate_buf #

Source
dirent_iterate_buf :: proc "contextless" (buf: []u8, offs: ^int) -> (d: ^Dirent, cont: bool) {…}

Iterate 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`, or `nil` - A bool value denoting if a valid directory entry is returned Example: 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 #

Source
dirent_name :: proc "contextless" (dirent: ^Dirent) -> string {…}

Obtain 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 #

Source
dup :: proc "contextless" (fd: Fd) -> (Fd, Errno) {…}

Allocate a new file descriptor that refers to the same file as the one provided. Available since Linux 1.0.

dup2 #

Source
dup2 :: proc "contextless" (old: Fd, new: Fd) -> (Fd, Errno) {…}

Adjust 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 #

Source
dup3 :: proc "contextless" (old: Fd, new: Fd, flags: bit_set[Open_Flags_Bits]) -> (Fd, Errno) {…}

Adjust 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 #

Source
epoll_create :: proc(size: i32 = 1) -> (Fd, Errno) {…}

Open an epoll file descriptor. The `size` argument is ignored but must be greater than zero. Available since Linux 2.6.

epoll_wait #

Source
epoll_wait :: proc(epfd: Fd, events: [^]EPoll_Event, count: i32, timeout: i32) -> (i32, Errno) {…}

Wait for an I/O event on an epoll file descriptor. `timeout` is specified in milliseconds. Available since Linux 2.6.

execve #

Source
execve :: proc "contextless" (name: cstring, argv: [^]cstring, envp: [^]cstring) -> Errno {…}

Replace the current process with another program. Available since Linux 1.0. On ARM64 available since Linux 3.19.

exit #

Source
exit :: proc "contextless" (code: i32) -> ! {…}

Exit the thread with a given exit code. Available since Linux 1.0.

exit_group #

Source
exit_group :: proc "contextless" (code: i32) -> ! {…}

Exit the thread group. Available since Linux 2.6.

faccessat #

Source
faccessat :: proc "contextless" (dirfd: Fd, name: cstring, mode: bit_set[Mode_Bits] = F_OK) -> Errno {…}

Checks the user permissions for a file at specified dirfd. Available since Linux 2.6.16.

faccessat2 #

Source
faccessat2 :: proc "contextless" (dirfd: Fd, name: cstring, mode: bit_set[Mode_Bits] = F_OK, flags: bit_set[FD_Flags_Bits] = FD_Flags{}) -> Errno {…}

Checks the user permissions for a file at specified dirfd (with flags). Available since Linux 5.8.

fchdir #

Source
fchdir :: proc "contextless" (fd: Fd) -> Errno {…}

Change working directory to the directory specified by dirfd. Available since Linux 1.0.

fchmod #

Source
fchmod :: proc "contextless" (fd: Fd, mode: bit_set[Mode_Bits]) -> Errno {…}

Change file permissions through a file descriptor. Available since Linux 1.0.

fchown #

Source
fchown :: proc "contextless" (fd: Fd, uid: Uid, gid: Gid) -> Errno {…}

Change ownership of a file by file descriptor. Available since Linux 1.0. On 32-bit architecvtures available since Linux 2.4.

fchownat #

Source
fchownat :: proc "contextless" (dirfd: Fd, name: cstring, uid: Uid, gid: Gid) -> Errno {…}

Change the ownership of the file specified relative to directory. Available since Linux 2.6.16.

fdatasync #

Source
fdatasync :: proc "contextless" (fd: Fd) -> Errno {…}

Synchronize the state of the file with the storage device. Similar to `fsync`, except does not flush the metadata. Available since Linux 2.0.

flistxattr #

Source
flistxattr :: proc "contextless" (fd: Fd, list: cstring, size: uint) -> Errno {…}

List extended attribute names Available since Linux 2.6.25

flock #

Source
flock :: proc "contextless" (fd: Fd, operation: bit_set[FLock_Op_Bits]) -> Errno {…}

Apply or remove advisory lock on an open file. Available since Linux 2.0.

fork #

Source
fork :: proc "contextless" () -> (Pid, Errno) {…}

Creates a copy of the running process. Available since Linux 1.0.

fremovexattr #

Source
fremovexattr :: proc "contextless" (fd: Fd, name: cstring) -> Errno {…}

Remove an extended attribute Available since Linux 2.6.25

fstat #

Source
fstat :: proc "contextless" (fd: Fd, stat: ^Stat) -> Errno {…}

Get 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.

fstatfs #

Source
fstatfs :: proc "contextless" (fd: Fd, statfs: ^Stat_FS) -> Errno {…}

Query 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 #

Source
fsync :: proc "contextless" (fd: Fd) -> Errno {…}

Sync state of the file with the storage device. Available since Linux 1.0.

ftruncate #

Source
ftruncate :: proc "contextless" (fd: Fd, length: i64) -> Errno {…}

Truncate a file specified by file descriptor to specified length. On 32-bit architectures available since 2.4.

futex_cmp_requeue #

Source
futex_cmp_requeue :: proc "contextless" (
	futex:             ^u32, 
	op:                Futex_Cmp_Requeue_Type, 
	flags:             bit_set[Futex_Flags_Bits], 
	requeue_threshold: u32, 
	requeue_max:       i32, 
	requeue_futex:     ^u32, 
	val:               i32, 
) -> (int, Errno) {…}

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_requeue #

Source
futex_requeue :: proc "contextless" (
	futex:             ^u32, 
	op:                Futex_Requeue_Type, 
	flags:             bit_set[Futex_Flags_Bits], 
	requeue_threshold: u32, 
	requeue_max:       i32, 
	requeue_futex:     ^u32, 
) -> (int, Errno) {…}

See `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_wake #

Source
futex_wake :: proc "contextless" (futex: ^u32, op: Futex_Wake_Type, flags: bit_set[Futex_Flags_Bits], n_wakeup: i32) -> (int, Errno) {…}

Wake up other threads on a futex n_wakeup specifies the number of processes to wakeup. Specify max(i32) to wake up all processes waiting

futex_wake_op #

Source
futex_wake_op :: proc "contextless" (
	futex:           ^u32, 
	op:              Futex_Wake_Op_Type, 
	flags:           bit_set[Futex_Flags_Bits], 
	wakeup:          i32, 
	dst_wakeup, dst: ^u32, 
	futex_op:        u32, 
) -> (int, Errno) {…}

Okay, 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 #

Source
getcpu :: proc "contextless" (cpu, node: ^u32) -> Errno {…}

Determine CPU and NUMA node on which the calling thread is running. Available since Linux 2.6.19.

getcwd #

Source
getcwd :: proc "contextless" (buf: []u8) -> (int, Errno) {…}

Get current working directory. Available since Linux 1.0.

getdents #

Source
getdents :: proc "contextless" (dirfd: Fd, buf: []u8) -> (int, Errno) {…}

Retrieve the contents of the directory specified by dirfd. Returns the number of bytes written. Available since Linux 2.4.

getegid #

Source
getegid :: proc "contextless" () -> Gid {…}

Get effective group ID. Available since Linux 1.0. On 32-bit platforms available since Linux 2.4.

geteuid #

Source
geteuid :: proc "contextless" () -> Uid {…}

Get effective user ID. Available since Linux 1.0. On 32-bit platforms available since Linux 2.4.

getgid #

Source
getgid :: proc "contextless" () -> Gid {…}

Get real group ID. Available since Linux 1.0. On 32-bit platforms available since Linux 2.4.

getgroups #

Source
getgroups :: proc "contextless" (gids: []Gid) -> (int, Errno) {…}

Get supplementary group IDs. Available since Linux 1.0. On 32-bit platforms available since Linux 2.4.

getpeername #

Source
getpeername :: proc "contextless" (sock: Fd, addr: ^Sock_Addr_Any) -> Errno {…}

Get the name of the connected peer socket. Available since Linux 2.0.

getpgid #

Source
getpgid :: proc "contextless" (pid: Pid) -> (Pid, Errno) {…}

Get process group. Available since Linux 1.0.

getpgrp #

Source
getpgrp :: proc "contextless" () -> (Pid, Errno) {…}

Get process group. Available since Linux 1.0.

getpid #

Source
getpid :: proc "contextless" () -> Pid {…}

Returns 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 #

Source
getppid :: proc "contextless" () -> Pid {…}

Get the parent process ID. Available since Linux 1.0.

getresgid #

Source
getresgid :: proc "contextless" (real: ^Gid, effective: ^Gid, saved: ^Gid) -> Errno {…}

Get real, effective and saved group id. Available since Linux 2.2. On 32-bit platforms available since Linux 2.4.

getresuid #

Source
getresuid :: proc "contextless" (real: ^Uid, effective: ^Uid, saved: ^Uid) -> Errno {…}

Get real, effective and saved user id. Available since Linux 2.2. On 32-bit platforms available since Linux 2.4.

getsid #

Source
getsid :: proc "contextless" (pid: Pid) -> (Pid, Errno) {…}

Get session ID of the calling process. Available since Linux 2.0.

getsockname #

Source
getsockname :: proc "contextless" (sock: Fd, addr: ^Sock_Addr_Any) -> Errno {…}

Get socket name (aka it's bound address). Available since Linux 2.0.

gettid #

Source
gettid :: proc "contextless" () -> Pid {…}

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.0

getuid #

Source
getuid :: proc "contextless" () -> Uid {…}

Get real user ID. Available since Linux 1.0. On 32-bit platforms available since Linux 2.4.

io_uring_setup #

Source
io_uring_setup :: proc "contextless" (entries: u32, params: ^IO_Uring_Params) -> (Fd, Errno) {…}

Setup a context for performing asynchronous I/O. Available since Linux 5.1

ioctl #

Source
ioctl :: proc "contextless" (fd: Fd, request: u32, arg: uintptr) -> uintptr {…}

Control 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 #

Source
ioperm :: proc "contextless" (form: u32, num: u32, turn_on: i32) -> Errno {…}

Set port input/output permissions Available since Linux 1.0

lchown #

Source
lchown :: proc "contextless" (name: cstring, uid: Uid, gid: Gid) -> Errno {…}

Change 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.

link #

Source
link :: proc "contextless" (target: cstring, linkpath: cstring) -> Errno {…}

Create a hard link on a file. Available since Linux 1.0. On ARM64 available since Linux 2.6.16.

listen #

Source
listen :: proc "contextless" (sock: Fd, queue_len: i32) -> Errno {…}

Marks the socket as a socket that listen to connections using accept(2). Available since Linux 2.0.

lseek #

Source
lseek :: proc "contextless" (fd: Fd, off: i64, whence: Seek_Whence) -> (i64, Errno) {…}

Seek the file stream to specified offset. Available since Linux 1.0. On 32-bit platforms available since Linux 1.2.

lstat #

Source
lstat :: proc "contextless" (filename: cstring, stat: ^Stat) -> Errno {…}

Get 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.

mincore #

Source
mincore :: proc "contextless" (addr: rawptr, size: uint, vec: []b8) -> Errno {…}

Determine if pages are resident in memory. Available since Linux 2.4.

mkdir #

Source
mkdir :: proc "contextless" (name: cstring, mode: bit_set[Mode_Bits]) -> Errno {…}

Creates a directory. Available since Linux 1.0. On ARM64 available since Linux 2.6.16.

mkdirat #

Source
mkdirat :: proc "contextless" (dirfd: Fd, name: cstring, mode: bit_set[Mode_Bits]) -> Errno {…}

Create a directory relative to specified dirfd. Available since Linux 2.6.16.

mknod #

Source
mknod :: proc "contextless" (name: cstring, mode: bit_set[Mode_Bits], dev: Dev) -> Errno {…}

Create 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 #

Source
mknodat :: proc "contextless" (dirfd: Fd, name: cstring, mode: bit_set[Mode_Bits], dev: Dev) -> Errno {…}

Create a special or ordinary file wrt given directory specified by dirfd. Available since Linux 2.6.16.

modify_ldt #

Source
modify_ldt :: proc "contextless" (func: i32, ptr: rawptr, bytecount: uint) -> (int, Errno) {…}

Get or set local descriptor table Available since Linux 2.1

munlockall #

Source
munlockall :: proc "contextless" () -> Errno {…}

Unlock all memory. Available since Linux 2.0.

pause #

Source
pause :: proc "contextless" () {…}

Wait until the next signal is delivered. Available since Linux 1.0. On ARM64 available since Linux 2.6.16.

personality #

Source
personality :: proc "contextless" (personality: uint) -> (uint, Errno) {…}

Set the process execution domain. Available since Linux 1.2.

pidfd_getfd #

Source
pidfd_getfd :: proc "contextless" (pidfd: Pid_FD, fd: Fd, flags: i32 = 0) -> (Fd, Errno) {…}

Get a file descriptor from another process. - `fd` refers to a file descriptor number to get. - `flags` must be zero. Available since Linux 5.3.

pidfd_open #

Source
pidfd_open :: proc "contextless" (pid: Pid, flags: bit_set[Pid_FD_Flags_Bits]) -> (Pid_FD, Errno) {…}

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.

prctl #

Source
prctl :: proc "contextless" (op: i32, args: ..uint) -> Errno {…}

Operations on a process or thread Available since Linux 2.1.57

pread #

Source
pread :: proc "contextless" (fd: Fd, buf: []u8, offset: i64) -> (int, Errno) {…}

Read the file at a specified offset. Note, it is not an error to return less bytes than requested. Available since Linux 2.2.

pwrite #

Source
pwrite :: proc "contextless" (fd: Fd, buf: []u8, offset: i64) -> (int, Errno) {…}

Read the file at a specified offset. Note, it is not an error to return less bytes than requested. Available since Linux 2.2.

read #

Source
read :: proc "contextless" (fd: Fd, buf: []u8) -> (int, Errno) {…}

Read 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 #

Source
readahead :: proc "contextless" (fd: Fd, offset: int, count: uint) -> Errno {…}

Initiate a file readahead into page cache Available since Linux 2.1

readlink #

Source
readlink :: proc "contextless" (name: cstring, buf: []u8) -> (int, Errno) {…}

Read the value of a symbolic link. Available since Linux 1.0. On arm64 available since Linux 2.6.16.

readlinkat #

Source
readlinkat :: proc "contextless" (dirfd: Fd, name: cstring, buf: []u8) -> (int, Errno) {…}

Read the value of a symbolic link at given dirfd. Available since Linux 2.6.16.

readv #

Source
readv :: proc "contextless" (fd: Fd, iov: []IO_Vec) -> (int, Errno) {…}

Read the data from file into multiple buffers. Available since Linux 2.0.

recvfrom #

Source
recvfrom :: proc "contextless" (sock: Fd, buf: []u8, flags: bit_set[Socket_Msg_Bits], addr: ^$T) -> (int, Errno) {…}

TODO(flysand): Rewrite recvfrom and sendto to use default parameters

rename #

Source
rename :: proc "contextless" (old: cstring, new: cstring) -> Errno {…}

Rename (move) the file. Available since Linux 1.0. On ARM64 available since Linux 2.6.16.

renameat #

Source
renameat :: proc "contextless" (oldfd: Fd, old: cstring, newfd: Fd, new: cstring) -> Errno {…}

Rename the file with names relative to the specified dirfd's. Available since Linux 2.6.16.

rmdir #

Source
rmdir :: proc "contextless" (name: cstring) -> Errno {…}

Remove a directory specified by name. Available since Linux 1.0. On ARM64 available since Linux 2.6.16.

rt_sigpending #

Source
rt_sigpending :: proc "contextless" (sigs: ^[1]uint) -> Errno {…}

Examine pending signals. Available since Linux 2.2.

rt_sigprocmask #

Source
rt_sigprocmask :: proc "contextless" (mask_kind: Sig_Mask_Kind, new_set: ^[1]uint, old_set: ^[1]uint) -> Errno {…}

Examime and alter blocked signals. Available since Linux 2.2.

rt_sigqueueinfo #

Source
rt_sigqueueinfo :: proc "contextless" (pid: Pid, sig: Signal, si: ^Sig_Info) -> Errno {…}

Send signal information to a process. Available since Linux 2.2.

rt_sigreturn #

Source
rt_sigreturn :: proc "c" () -> ! {…}

Returns from signal handlers on some archs.

rt_sigsuspend #

Source
rt_sigsuspend :: proc "contextless" (sigset: ^[1]uint) -> Errno {…}

Replace the signal mask for a value with the new mask until a signal is received. Available since Linux 2.2.

rt_tgsigqueueinfo #

Source
rt_tgsigqueueinfo :: proc "contextless" (tgid: Pid, pid: Pid, sig: Signal, si: ^Sig_Info) -> Errno {…}

/ Send signal information to a thread / Available since Linux 2.2

S_ISBLK #

Source
S_ISBLK :: proc "contextless" (m: bit_set[Mode_Bits]) -> bool {…}

Check the Mode bits to see if the file is a block device.

S_ISCHR #

Source
S_ISCHR :: proc "contextless" (m: bit_set[Mode_Bits]) -> bool {…}

Check the Mode bits to see if the file is a character device.

S_ISDIR #

Source
S_ISDIR :: proc "contextless" (m: bit_set[Mode_Bits]) -> bool {…}

Check the Mode bits to see if the file is a directory.

S_ISFIFO #

Source
S_ISFIFO :: proc "contextless" (m: bit_set[Mode_Bits]) -> bool {…}

Checks the Mode bits to see if the file is a named pipe (FIFO).

S_ISLNK #

Source
S_ISLNK :: proc "contextless" (m: bit_set[Mode_Bits]) -> bool {…}

Check the Mode bits to see if the file is a symlink.

S_ISREG #

Source
S_ISREG :: proc "contextless" (m: bit_set[Mode_Bits]) -> bool {…}

Check the Mode bits to see if the file is a register.

S_ISSOCK #

Source
S_ISSOCK :: proc "contextless" (m: bit_set[Mode_Bits]) -> bool {…}

Check the Mode bits to see if the file is a socket.

sched_get_priority_max #

Source
sched_get_priority_max :: proc "contextless" (policy: i32) -> (i32, Errno) {…}

Get static priority range. Available since Linux 2.0.

sched_get_priority_min #

Source
sched_get_priority_min :: proc "contextless" (policy: i32) -> (i32, Errno) {…}

Get static priority range. Available since Linux 2.0.

sched_getaffinity #

Source
sched_getaffinity :: proc "contextless" (pid: Pid, cpusetsize: uint, mask: rawptr) -> (int, Errno) {…}

Get 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_getscheduler #

Source
sched_getscheduler :: proc "contextless" (pid: Pid, policy: i32, param: ^Sched_Param) -> (i32, Errno) {…}

Get scheduling policy/parameters. Available since Linux 2.0.

sched_rr_get_interval #

Source
sched_rr_get_interval :: proc "contextless" (pid: Pid, tp: ^Time_Spec) -> Errno {…}

get the SCHED_RR interval for the named process. Available since Linux 2.0.

sched_setaffinity #

Source
sched_setaffinity :: proc "contextless" (pid: Pid, cpusetsize: uint, mask: rawptr) -> (int, Errno) {…}

Set 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_setscheduler #

Source
sched_setscheduler :: proc "contextless" (pid: Pid, policy: i32, param: ^Sched_Param) -> Errno {…}

Set scheduling policy/parameters. Available since Linux 2.0.

sched_yield #

Source
sched_yield :: proc "contextless" () {…}

Yield the processor. Available since Linux 2.0.

sendfile #

Source
sendfile :: proc "contextless" (out_fd: Fd, in_fd: Fd, offset: ^i64, count: uint) -> (int, Errno) {…}

Transfer the data between file descriptors. Available since Linux 2.2. On 32-bit platforms available since Linux 2.6.

set_tid_address #

Source
set_tid_address :: proc "contextless" (tidptr: ^u32) {…}

Set the address of the futex that's gonna be waken when. current thread terminates. Available since Linux 2.6.

setdomainname #

Source
setdomainname :: proc "contextless" (name: string) -> Errno {…}

Set domain name. Note: to get the domain name, use `uname` syscall. Available since Linux 2.2.

setgid #

Source
@(require_results)
setgid :: proc "contextless" (gid: Gid) -> Errno {…}

Set 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 #

Source
setgroups :: proc "contextless" (gids: []Gid) -> Errno {…}

Set supplementary group IDs. Available since Linux 1.0. On 32-bit platforms available since Linux 2.4.

sethostname #

Source
sethostname :: proc "contextless" (hostname: string) -> Errno {…}

Set hostname. Note: to get the host name, use `uname` syscall. Available since Linux 1.0.

setpgid #

Source
setpgid :: proc "contextless" (pid: Pid, pgid: Pid) -> Errno {…}

Set process group. Available since Linux 1.0.

setregid #

Source
@(require_results)
setregid :: proc "contextless" (real: Gid, effective: Gid) -> Errno {…}

Set 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 #

Source
@(require_results)
setresgid :: proc "contextless" (real: Gid, effective: Gid, saved: Uid) -> Errno {…}

Set 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 #

Source
@(require_results)
setresuid :: proc "contextless" (real: Uid, effective: Uid, saved: Uid) -> Errno {…}

Set 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 #

Source
@(require_results)
setreuid :: proc "contextless" (real: Uid, effective: Uid) -> Errno {…}

Set 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.

setsid #

Source
setsid :: proc "contextless" () -> (Pid, Errno) {…}

Create a session and set the process group ID. Available since Linux 2.0.

setsockopt_base #

Source
setsockopt_base :: proc "contextless" (sock: Fd, level: int, opt: int, val: $T) -> Errno {…}

TODO(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

setuid #

Source
@(require_results)
setuid :: proc "contextless" (uid: Uid) -> Errno {…}

Set effective User ID. Available since Linux 1.0. On 32-bit platforms available since Linux 2.4.

shmdt #

Source
shmdt :: proc "contextless" (shmaddr: rawptr) -> Errno {…}

SystemV shared memory operations. Available since Linux 2.0.

stat #

Source
stat :: proc "contextless" (filename: cstring, stat: ^Stat) -> Errno {…}

Get 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 #

Source
statfs :: proc "contextless" (path: cstring, statfs: ^Stat_FS) -> Errno {…}

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 #

Source
statx :: proc "contextless" (dir: Fd, pathname: cstring, flags: bit_set[FD_Flags_Bits], mask: bit_set[Statx_Mask_Bits], statx: ^Statx) -> Errno {…}

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.11

swapoff #

Source
swapoff :: proc "contextless" (path: cstring) -> Errno {…}

Stop swapping to file/device Available since Linux 2.0

symlink #

Source
symlink :: proc "contextless" (target: cstring, linkpath: cstring) -> Errno {…}

Create a symbolic link. Available since Linux 1.0. On arm64 available since Linux 2.6.16.

symlinkat #

Source
symlinkat :: proc "contextless" (target: cstring, dirfd: Fd, linkpath: cstring) -> Errno {…}

Create a symbolic link at specified dirfd. Available since Linux 2.6.16.

sync #

Source
sync :: proc "contextless" () -> Errno {…}

Commit filesystem caches to disk Available since Linux 1.0.

sysinfo #

Source
sysinfo :: proc "contextless" (sysinfo: ^Sys_Info) -> Errno {…}

Get information about the system. Available since Linux 1.0.

tgkill #

Source
tgkill :: proc "contextless" (tgid, tid: Pid, sig: Signal) -> Errno {…}

Send a signal to a specific thread in a thread group. Available since Linux 2.6.

time #

Source
time :: proc "contextless" (tloc: ^uint) -> Errno {…}

Get current time in seconds. Available since Linux 1.0.

timer_delete #

Source
timer_delete :: proc "contextless" (timer: Timer) -> Errno {…}

Delete a POSIX per-process timer. Available since Linux 2.6.

timer_getoverrun #

Source
timer_getoverrun :: proc "contextless" (timer: Timer) -> (int, Errno) {…}

Get overrun count of the POSIX per-process timer. Available since Linux 2.6.

timer_gettime #

Source
timer_gettime :: proc "contextless" (timer: Timer, curr_value: ^ITimer_Spec) -> Errno {…}

Get the state of the POSIX per-process timer. Available since Linux 2.6.

timer_settime #

Source
timer_settime :: proc "contextless" (timer: Timer, flags: bit_set[ITimer_Flags_Bits], #no_alias new_value, #no_alias old_value: ^ITimer_Spec) -> Errno {…}

Arm/disarm the state of the POSIX per-process timer. Available since Linux 2.6.

timerfd_gettime #

Source
timerfd_gettime :: proc "contextless" (fd: Fd, curr_value: ^ITimer_Spec) -> Errno {…}

Get the state of the Linux file descriptor based timer. Available since Linux 2.6.25

times #

Source
times :: proc "contextless" (tms: ^Tms) -> Errno {…}

Get current process times. Available since Linux 1.0.

truncate #

Source
truncate :: proc "contextless" (name: cstring, length: i64) -> Errno {…}

Truncate a file to specified length. Available since Linux 1.0. On 32-bit architectures available since Linux 2.4.

unlink #

Source
unlink :: proc "contextless" (name: cstring) -> Errno {…}

Delete a name, and possible a file it refers to. Available since Linux 1.0. On ARM64 available since Linux 2.6.16.

unlinkat #

Source
unlinkat :: proc "contextless" (dirfd: Fd, name: cstring, flags: bit_set[FD_Flags_Bits]) -> Errno {…}

Remove a directory entry relative to a directory file descriptor. Available since Linux 2.6.16.

utimensat #

Source
utimensat :: proc "contextless" (dirfd: Fd, name: cstring, utimes: [^]Time_Spec, flags: bit_set[FD_Flags_Bits]) -> Errno {…}

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 #

Source
vfork :: proc "contextless" () -> Pid {…}

Create a child process and block parent. Available since Linux 2.2.

vhangup #

Source
vhangup :: proc "contextless" () -> Errno {…}

Virtually hangup the current terminal Available since Linux 1.0.

WCOREDUMP #

Source
WCOREDUMP :: proc "contextless" (s: u32) -> bool {…}

/ Check if the process dumped core

WEXITSTATUS #

Source
WEXITSTATUS :: proc "contextless" (s: u32) -> u32 {…}

/ Low 8 bits of the exit code / Only retrieve the exit code if WIFEXITED(s) = true

WIFCONTINUED #

Source
WIFCONTINUED :: proc "contextless" (s: u32) -> bool {…}

/ Check if the process is continued by the tracee

WIFEXITED #

Source
WIFEXITED :: proc "contextless" (s: u32) -> bool {…}

/ Check if the process terminated normally (via exit.2)

WIFSIGNALED #

Source
WIFSIGNALED :: proc "contextless" (s: u32) -> bool {…}

/ Check if the process signaled

WIFSTOPPED #

Source
WIFSTOPPED :: proc "contextless" (s: u32) -> bool {…}

/ Check if the process has stopped

write #

Source
write :: proc "contextless" (fd: Fd, buf: []u8) -> (int, Errno) {…}

Write 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 #

Source
writev :: proc "contextless" (fd: Fd, iov: []IO_Vec) -> (int, Errno) {…}

Write the data from multiple buffers into a file. Available since Linux 2.0.

WSTOPSIG #

Source
WSTOPSIG :: proc "contextless" (s: u32) -> u32 {…}

/ The signal that stopped the child / Only retrieve if WIFSTOPPED(s) = true

WTERMSIG #

Source
WTERMSIG :: proc "contextless" (s: u32) -> u32 {…}

/ Termination signal / Only retrieve the code if WIFSIGNALED(s) = true

Procedure Groups

10

ptrace #

Source
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,
}

Trace process.

recv #

Source
recv :: proc{
	recvfrom,
	recv_noaddr,
}

Receive a message from a socket. Available since Linux 2.0.

send #

Source
send :: proc{
	sendto,
	send_noaddr,
}

Send a message through a socket. Available since Linux 2.0.

syscall #

Source
syscall :: proc{
	syscall0,
	syscall1,
	syscall2,
	syscall3,
	syscall4,
	syscall5,
	syscall6,
}