gizlang/linux-abi
The records of the Linux ABI that native code reads and writes in memory: the structs of system calls and messages. gizlang/linux keeps the numbers and stays portable; this module needs gizlang/target, so it is native only.
import * as Linux-abi from "gizlang/linux-abi";Types
Timespec
@Packed export type Timespec = { seconds: i64; nanoseconds: i64; }struct timespec: seconds and nanoseconds.
seconds:i64nanoseconds:i64
Timeval
@Packed export type Timeval = { seconds: i64; microseconds: i64; }struct timeval: seconds and microseconds.
seconds:i64microseconds:i64
Itimerspec
@Packed export type Itimerspec = { interval: Timespec; value: Timespec; }struct itimerspec: the interval, then the first expiry.
interval:gizlang_linux_abi.Timespecvalue:gizlang_linux_abi.Timespec
PollFd
@Packed export type PollFd = { fd: i32; events: u16; revents: u16; }struct pollfd: a descriptor (-1: not asked), the events asked for, and those that came.
fd:i32events:u16revents:u16
FdPair
@Packed export type FdPair = { first: i32; second: i32; }The two descriptors pipe2(2) and socketpair(2) write.
first:i32second:i32
SockaddrUn
@Packed export type SockaddrUn = { family: u16; path: Fixed<u8, 108>; }struct sockaddr_un: the family, then the path with its NUL.
family:u16path:gizlang_target.Fixed<u8, 108>
StatxTime
@Packed export type StatxTimestruct statx_timestamp.
seconds:i64nanoseconds:u32
Statx
@Packed export type Statxstruct statx (statx(2)).
mask:u32blockSize:u32attributes:u64links:u32uid:u32gid:u32mode:u16inode:u64size:u64blocks:u64attributesMask:u64accessed:gizlang_linux_abi.StatxTimebtime:gizlang_linux_abi.StatxTimechanged:gizlang_linux_abi.StatxTimemodified:gizlang_linux_abi.StatxTimerdevMajor:u32rdevMinor:u32devMajor:u32devMinor:u32mountId:u64memoryAlign:u32offsetAlign:u32
Rusage
@Packed export type Rusage = { user: Timeval; system: Timeval; maxResidentKb: i64; sharedKb: i64; dataKb: i64; stackKb: i64; minorFaults: i64; majorFaults: i64; swaps: i64; blocksIn: i64; blocksOut: i64; messagesSent: i64; messagesReceived: i64; signals: i64; voluntarySwitches: i64; involuntarySwitches: i64; }struct rusage (getrusage(2)): the user and system times, then the counters; sizes in KB.
user:gizlang_linux_abi.Timevalsystem:gizlang_linux_abi.TimevalmaxResidentKb:i64sharedKb:i64dataKb:i64stackKb:i64minorFaults:i64majorFaults:i64swaps:i64blocksIn:i64blocksOut:i64messagesSent:i64messagesReceived:i64signals:i64voluntarySwitches:i64involuntarySwitches:i64
Iovec
@Packed export type Iovec = { base: u64; length: u64; }struct iovec: one buffer of a vectored call or message, its address then its length.
base:u64length:u64
Msghdr
@Packed export type Msghdr = { address: u64; addressSize: u64; vector: u64; vectorCount: u64; control: u64; controlSize: u64; flags: u64; }struct msghdr on a 64-bit ABI; its int fields are written as whole 64-bit words, padding included.
address:u64addressSize:u64vector:u64vectorCount:u64control:u64controlSize:u64flags:u64
Cmsghdr
@Packed export type Cmsghdr = { size: u64; level: u32; kind: u32; }struct cmsghdr: the size of a control message with its header, its level and its kind.
size:u64level:u32kind:u32
ScmRights
@Packed export type ScmRights = { header: Cmsghdr; descriptor: u32; }A control message that passes one descriptor (SCM_RIGHTS): its header, then the descriptor.
header:gizlang_linux_abi.Cmsghdrdescriptor:u32