|
// wasi_snapshot_preview1 spec available (in witx format) here: // * typenames -- https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/witx/typenames.witx // * module -- https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/witx/wasi_snapshot_preview1.witx const builtin = @import("builtin"); const std = @import("std"); const assert = std.debug.assert; |
F_OKWhen linking libc, we follow their convention and use -2 for current working directory.
However, without libc, Zig does a different convention: it assumes the
current working directory is the first preopen. This behavior can be
overridden with a public function called |
comptime { assert(@alignOf(i8) == 1); assert(@alignOf(u8) == 1); assert(@alignOf(i16) == 2); assert(@alignOf(u16) == 2); assert(@alignOf(i32) == 4); assert(@alignOf(u32) == 4); // assert(@alignOf(i64) == 8); // assert(@alignOf(u64) == 8); |
whence_tThis is also the error code used for |
} |
W_OKThis is also the code used for |
pub const F_OK = 0; pub const X_OK = 1; pub const W_OK = 2; |
R_OKAlso known as |
pub const R_OK = 4; |
iovec_tAlso known as |
pub const iovec_t = std.os.iovec; |
ciovec_t |
pub const ciovec_t = std.os.iovec_const; |
getErrno() |
pub extern "wasi_snapshot_preview1" fn args_get(argv: [*][*:0]u8, argv_buf: [*]u8) errno_t; pub extern "wasi_snapshot_preview1" fn args_sizes_get(argc: *usize, argv_buf_size: *usize) errno_t; |
STDIN_FILENO |
pub extern "wasi_snapshot_preview1" fn clock_res_get(clock_id: clockid_t, resolution: *timestamp_t) errno_t; pub extern "wasi_snapshot_preview1" fn clock_time_get(clock_id: clockid_t, precision: timestamp_t, timestamp: *timestamp_t) errno_t; |
STDOUT_FILENO |
pub extern "wasi_snapshot_preview1" fn environ_get(environ: [*][*:0]u8, environ_buf: [*]u8) errno_t; pub extern "wasi_snapshot_preview1" fn environ_sizes_get(environ_count: *usize, environ_buf_size: *usize) errno_t; |
STDERR_FILENO |
pub extern "wasi_snapshot_preview1" fn fd_advise(fd: fd_t, offset: filesize_t, len: filesize_t, advice: advice_t) errno_t; pub extern "wasi_snapshot_preview1" fn fd_allocate(fd: fd_t, offset: filesize_t, len: filesize_t) errno_t; pub extern "wasi_snapshot_preview1" fn fd_close(fd: fd_t) errno_t; pub extern "wasi_snapshot_preview1" fn fd_datasync(fd: fd_t) errno_t; pub extern "wasi_snapshot_preview1" fn fd_pread(fd: fd_t, iovs: [*]const iovec_t, iovs_len: usize, offset: filesize_t, nread: *usize) errno_t; pub extern "wasi_snapshot_preview1" fn fd_pwrite(fd: fd_t, iovs: [*]const ciovec_t, iovs_len: usize, offset: filesize_t, nwritten: *usize) errno_t; pub extern "wasi_snapshot_preview1" fn fd_read(fd: fd_t, iovs: [*]const iovec_t, iovs_len: usize, nread: *usize) errno_t; pub extern "wasi_snapshot_preview1" fn fd_readdir(fd: fd_t, buf: [*]u8, buf_len: usize, cookie: dircookie_t, bufused: *usize) errno_t; pub extern "wasi_snapshot_preview1" fn fd_renumber(from: fd_t, to: fd_t) errno_t; pub extern "wasi_snapshot_preview1" fn fd_seek(fd: fd_t, offset: filedelta_t, whence: whence_t, newoffset: *filesize_t) errno_t; pub extern "wasi_snapshot_preview1" fn fd_sync(fd: fd_t) errno_t; pub extern "wasi_snapshot_preview1" fn fd_tell(fd: fd_t, newoffset: *filesize_t) errno_t; pub extern "wasi_snapshot_preview1" fn fd_write(fd: fd_t, iovs: [*]const ciovec_t, iovs_len: usize, nwritten: *usize) errno_t; |
mode_t |
pub extern "wasi_snapshot_preview1" fn fd_fdstat_get(fd: fd_t, buf: *fdstat_t) errno_t; pub extern "wasi_snapshot_preview1" fn fd_fdstat_set_flags(fd: fd_t, flags: fdflags_t) errno_t; pub extern "wasi_snapshot_preview1" fn fd_fdstat_set_rights(fd: fd_t, fs_rights_base: rights_t, fs_rights_inheriting: rights_t) errno_t; |
time_t |
pub extern "wasi_snapshot_preview1" fn fd_filestat_get(fd: fd_t, buf: *filestat_t) errno_t; pub extern "wasi_snapshot_preview1" fn fd_filestat_set_size(fd: fd_t, st_size: filesize_t) errno_t; pub extern "wasi_snapshot_preview1" fn fd_filestat_set_times(fd: fd_t, st_atim: timestamp_t, st_mtim: timestamp_t, fstflags: fstflags_t) errno_t; |
timespec |
pub extern "wasi_snapshot_preview1" fn fd_prestat_get(fd: fd_t, buf: *prestat_t) errno_t; pub extern "wasi_snapshot_preview1" fn fd_prestat_dir_name(fd: fd_t, path: [*]u8, path_len: usize) errno_t; |
fromTimestamp() |
pub extern "wasi_snapshot_preview1" fn path_create_directory(fd: fd_t, path: [*]const u8, path_len: usize) errno_t; pub extern "wasi_snapshot_preview1" fn path_filestat_get(fd: fd_t, flags: lookupflags_t, path: [*]const u8, path_len: usize, buf: *filestat_t) errno_t; pub extern "wasi_snapshot_preview1" fn path_filestat_set_times(fd: fd_t, flags: lookupflags_t, path: [*]const u8, path_len: usize, st_atim: timestamp_t, st_mtim: timestamp_t, fstflags: fstflags_t) errno_t; pub extern "wasi_snapshot_preview1" fn path_link(old_fd: fd_t, old_flags: lookupflags_t, old_path: [*]const u8, old_path_len: usize, new_fd: fd_t, new_path: [*]const u8, new_path_len: usize) errno_t; pub extern "wasi_snapshot_preview1" fn path_open(dirfd: fd_t, dirflags: lookupflags_t, path: [*]const u8, path_len: usize, oflags: oflags_t, fs_rights_base: rights_t, fs_rights_inheriting: rights_t, fs_flags: fdflags_t, fd: *fd_t) errno_t; pub extern "wasi_snapshot_preview1" fn path_readlink(fd: fd_t, path: [*]const u8, path_len: usize, buf: [*]u8, buf_len: usize, bufused: *usize) errno_t; pub extern "wasi_snapshot_preview1" fn path_remove_directory(fd: fd_t, path: [*]const u8, path_len: usize) errno_t; pub extern "wasi_snapshot_preview1" fn path_rename(old_fd: fd_t, old_path: [*]const u8, old_path_len: usize, new_fd: fd_t, new_path: [*]const u8, new_path_len: usize) errno_t; pub extern "wasi_snapshot_preview1" fn path_symlink(old_path: [*]const u8, old_path_len: usize, fd: fd_t, new_path: [*]const u8, new_path_len: usize) errno_t; pub extern "wasi_snapshot_preview1" fn path_unlink_file(fd: fd_t, path: [*]const u8, path_len: usize) errno_t; |
toTimestamp() |
pub extern "wasi_snapshot_preview1" fn poll_oneoff(in: *const subscription_t, out: *event_t, nsubscriptions: usize, nevents: *usize) errno_t; |
Stat |
pub extern "wasi_snapshot_preview1" fn proc_exit(rval: exitcode_t) noreturn; |
fromFilestat() |
pub extern "wasi_snapshot_preview1" fn random_get(buf: [*]u8, buf_len: usize) errno_t; |
atime() |
pub extern "wasi_snapshot_preview1" fn sched_yield() errno_t; |
mtime() |
pub extern "wasi_snapshot_preview1" fn sock_accept(sock: fd_t, flags: fdflags_t, result_fd: *fd_t) errno_t; pub extern "wasi_snapshot_preview1" fn sock_recv(sock: fd_t, ri_data: *const iovec_t, ri_data_len: usize, ri_flags: riflags_t, ro_datalen: *usize, ro_flags: *roflags_t) errno_t; pub extern "wasi_snapshot_preview1" fn sock_send(sock: fd_t, si_data: *const ciovec_t, si_data_len: usize, si_flags: siflags_t, so_datalen: *usize) errno_t; pub extern "wasi_snapshot_preview1" fn sock_shutdown(sock: fd_t, how: sdflags_t) errno_t; |
ctime() |
/// Get the errno from a syscall return value, or 0 for no error. pub fn getErrno(r: errno_t) errno_t { return r; |
whence_t |
} |
AT |
pub const STDIN_FILENO = 0; pub const STDOUT_FILENO = 1; pub const STDERR_FILENO = 2; |
REMOVEDIR: |
pub const mode_t = u32; |
FDCWD: |
pub const time_t = i64; // match https://github.com/CraneStation/wasi-libc |
advice_t |
pub const timespec = extern struct { tv_sec: time_t, tv_nsec: isize, |
ADVICE_NORMAL: |
pub fn fromTimestamp(tm: timestamp_t) timespec { const tv_sec: timestamp_t = tm / 1_000_000_000; const tv_nsec = tm - tv_sec * 1_000_000_000; return timespec{ .tv_sec = @as(time_t, @intCast(tv_sec)), .tv_nsec = @as(isize, @intCast(tv_nsec)), }; } |
ADVICE_SEQUENTIAL: |
pub fn toTimestamp(ts: timespec) timestamp_t { const tm = @as(timestamp_t, @intCast(ts.tv_sec * 1_000_000_000)) + @as(timestamp_t, @intCast(ts.tv_nsec)); return tm; } |
whence_t |
}; |
ADVICE_WILLNEED: |
pub const Stat = struct { dev: device_t, ino: inode_t, mode: mode_t, filetype: filetype_t, nlink: linkcount_t, size: filesize_t, atim: timespec, mtim: timespec, ctim: timespec, |
ADVICE_DONTNEED: |
const Self = @This(); |
ADVICE_NOREUSE: |
pub fn fromFilestat(stat: filestat_t) Self { return Self{ .dev = stat.dev, .ino = stat.ino, .mode = 0, .filetype = stat.filetype, .nlink = stat.nlink, .size = stat.size, .atim = stat.atime(), .mtim = stat.mtime(), .ctim = stat.ctime(), }; } |
clockid_t |
pub fn atime(self: Self) timespec { return self.atim; } |
CLOCK |
pub fn mtime(self: Self) timespec { return self.mtim; } |
REALTIME: |
pub fn ctime(self: Self) timespec { return self.ctim; } |
whence_t |
}; |
PROCESS_CPUTIME_ID: |
pub const IOV_MAX = 1024; |
THREAD_CPUTIME_ID: |
pub const AT = struct { pub const REMOVEDIR: u32 = 0x4; /// When linking libc, we follow their convention and use -2 for current working directory. /// However, without libc, Zig does a different convention: it assumes the /// current working directory is the first preopen. This behavior can be /// overridden with a public function called `wasi_cwd` in the root source /// file. pub const FDCWD: fd_t = if (builtin.link_libc) -2 else 3; |
whence_t |
}; |
dircookie_t |
// As defined in the wasi_snapshot_preview1 spec file: // https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/witx/typenames.witx pub const advice_t = u8; pub const ADVICE_NORMAL: advice_t = 0; pub const ADVICE_SEQUENTIAL: advice_t = 1; pub const ADVICE_RANDOM: advice_t = 2; pub const ADVICE_WILLNEED: advice_t = 3; pub const ADVICE_DONTNEED: advice_t = 4; pub const ADVICE_NOREUSE: advice_t = 5; |
DIRCOOKIE_START: |
pub const clockid_t = u32; pub const CLOCK = struct { pub const REALTIME: clockid_t = 0; pub const MONOTONIC: clockid_t = 1; pub const PROCESS_CPUTIME_ID: clockid_t = 2; pub const THREAD_CPUTIME_ID: clockid_t = 3; |
whence_t |
}; |
dirent_t |
pub const device_t = u64; |
errno_t |
pub const dircookie_t = u64; pub const DIRCOOKIE_START: dircookie_t = 0; |
E |
pub const dirnamlen_t = u32; |
event_t |
pub const dirent_t = extern struct { d_next: dircookie_t, d_ino: inode_t, d_namlen: dirnamlen_t, d_type: filetype_t, |
whence_t |
}; |
eventrwflags_t |
pub const errno_t = enum(u16) { SUCCESS = 0, @"2BIG" = 1, ACCES = 2, ADDRINUSE = 3, ADDRNOTAVAIL = 4, AFNOSUPPORT = 5, /// This is also the error code used for `WOULDBLOCK`. AGAIN = 6, ALREADY = 7, BADF = 8, BADMSG = 9, BUSY = 10, CANCELED = 11, CHILD = 12, CONNABORTED = 13, CONNREFUSED = 14, CONNRESET = 15, DEADLK = 16, DESTADDRREQ = 17, DOM = 18, DQUOT = 19, EXIST = 20, FAULT = 21, FBIG = 22, HOSTUNREACH = 23, IDRM = 24, ILSEQ = 25, INPROGRESS = 26, INTR = 27, INVAL = 28, IO = 29, ISCONN = 30, ISDIR = 31, LOOP = 32, MFILE = 33, MLINK = 34, MSGSIZE = 35, MULTIHOP = 36, NAMETOOLONG = 37, NETDOWN = 38, NETRESET = 39, NETUNREACH = 40, NFILE = 41, NOBUFS = 42, NODEV = 43, NOENT = 44, NOEXEC = 45, NOLCK = 46, NOLINK = 47, NOMEM = 48, NOMSG = 49, NOPROTOOPT = 50, NOSPC = 51, NOSYS = 52, NOTCONN = 53, NOTDIR = 54, NOTEMPTY = 55, NOTRECOVERABLE = 56, NOTSOCK = 57, /// This is also the code used for `NOTSUP`. OPNOTSUPP = 58, NOTTY = 59, NXIO = 60, OVERFLOW = 61, OWNERDEAD = 62, PERM = 63, PIPE = 64, PROTO = 65, PROTONOSUPPORT = 66, PROTOTYPE = 67, RANGE = 68, ROFS = 69, SPIPE = 70, SRCH = 71, STALE = 72, TIMEDOUT = 73, TXTBSY = 74, XDEV = 75, NOTCAPABLE = 76, _, |
whence_t |
}; pub const E = errno_t; |
eventtype_t |
pub const event_t = extern struct { userdata: userdata_t, @"error": errno_t, type: eventtype_t, fd_readwrite: eventfdreadwrite_t, |
whence_t |
}; |
EVENTTYPE_FD_READ: |
pub const eventfdreadwrite_t = extern struct { nbytes: filesize_t, flags: eventrwflags_t, |
whence_t |
}; |
exitcode_t |
pub const eventrwflags_t = u16; pub const EVENT_FD_READWRITE_HANGUP: eventrwflags_t = 0x0001; |
fd_t |
pub const eventtype_t = u8; pub const EVENTTYPE_CLOCK: eventtype_t = 0; pub const EVENTTYPE_FD_READ: eventtype_t = 1; pub const EVENTTYPE_FD_WRITE: eventtype_t = 2; |
fdflags_t |
pub const exitcode_t = u32; |
FDFLAG |
pub const fd_t = i32; |
APPEND: |
pub const fdflags_t = u16; pub const FDFLAG = struct { pub const APPEND: fdflags_t = 0x0001; |
DSYNC: |
pub const DSYNC: fdflags_t = 0x0002; |
NONBLOCK: |
pub const NONBLOCK: fdflags_t = 0x0004; |
RSYNC: |
pub const RSYNC: fdflags_t = 0x0008; |
SYNC: |
pub const SYNC: fdflags_t = 0x0010; |
whence_t |
}; |
filedelta_t |
pub const fdstat_t = extern struct { fs_filetype: filetype_t, fs_flags: fdflags_t, fs_rights_base: rights_t, fs_rights_inheriting: rights_t, |
whence_t |
}; |
filestat_t |
pub const filedelta_t = i64; |
atime() |
pub const filesize_t = u64; |
mtime() |
pub const filestat_t = extern struct { dev: device_t, ino: inode_t, filetype: filetype_t, nlink: linkcount_t, size: filesize_t, atim: timestamp_t, mtim: timestamp_t, ctim: timestamp_t, |
ctime() |
pub fn atime(self: filestat_t) timespec { return timespec.fromTimestamp(self.atim); } |
filetype_t |
pub fn mtime(self: filestat_t) timespec { return timespec.fromTimestamp(self.mtim); } |
fstflags_t |
pub fn ctime(self: filestat_t) timespec { return timespec.fromTimestamp(self.ctim); } |
whence_t |
}; |
FILESTAT_SET_ATIM_NOW: |
/// Also known as `FILETYPE`. pub const filetype_t = enum(u8) { UNKNOWN, BLOCK_DEVICE, CHARACTER_DEVICE, DIRECTORY, REGULAR_FILE, SOCKET_DGRAM, SOCKET_STREAM, SYMBOLIC_LINK, _, |
whence_t |
}; |
FILESTAT_SET_MTIM_NOW: |
pub const fstflags_t = u16; pub const FILESTAT_SET_ATIM: fstflags_t = 0x0001; pub const FILESTAT_SET_ATIM_NOW: fstflags_t = 0x0002; pub const FILESTAT_SET_MTIM: fstflags_t = 0x0004; pub const FILESTAT_SET_MTIM_NOW: fstflags_t = 0x0008; |
inode_t |
pub const inode_t = u64; |
ino_t |
pub const ino_t = inode_t; |
linkcount_t |
pub const linkcount_t = u64; |
lookupflags_t |
pub const lookupflags_t = u32; |
LOOKUP_SYMLINK_FOLLOW: |
pub const LOOKUP_SYMLINK_FOLLOW: lookupflags_t = 0x00000001; |
oflags_t |
pub const oflags_t = u16; |
O |
pub const O = struct { |
CREAT: |
pub const CREAT: oflags_t = 0x0001; |
DIRECTORY: |
pub const DIRECTORY: oflags_t = 0x0002; |
EXCL: |
pub const EXCL: oflags_t = 0x0004; |
TRUNC: |
pub const TRUNC: oflags_t = 0x0008; |
whence_t |
}; |
PREOPENTYPE_DIR: |
pub const preopentype_t = u8; pub const PREOPENTYPE_DIR: preopentype_t = 0; |
prestat_t |
pub const prestat_t = extern struct { pr_type: preopentype_t, u: prestat_u_t, |
whence_t |
}; |
prestat_u_t |
pub const prestat_dir_t = extern struct { pr_name_len: usize, |
whence_t |
}; |
roflags_t |
pub const prestat_u_t = extern union { dir: prestat_dir_t, |
whence_t |
}; |
RECV_PEEK: |
pub const riflags_t = u16; pub const roflags_t = u16; |
RECV_WAITALL: |
pub const SOCK = struct { pub const RECV_PEEK: riflags_t = 0x0001; pub const RECV_WAITALL: riflags_t = 0x0002; |
RECV_DATA_TRUNCATED: |
pub const RECV_DATA_TRUNCATED: roflags_t = 0x0001; |
whence_t |
}; |
RIGHT |
pub const rights_t = u64; pub const RIGHT = struct { |
FD_DATASYNC: |
pub const FD_DATASYNC: rights_t = 0x0000000000000001; |
FD_READ: |
pub const FD_READ: rights_t = 0x0000000000000002; |
FD_SEEK: |
pub const FD_SEEK: rights_t = 0x0000000000000004; |
FD_FDSTAT_SET_FLAGS: |
pub const FD_FDSTAT_SET_FLAGS: rights_t = 0x0000000000000008; |
FD_SYNC: |
pub const FD_SYNC: rights_t = 0x0000000000000010; |
FD_TELL: |
pub const FD_TELL: rights_t = 0x0000000000000020; |
FD_WRITE: |
pub const FD_WRITE: rights_t = 0x0000000000000040; |
FD_ADVISE: |
pub const FD_ADVISE: rights_t = 0x0000000000000080; |
FD_ALLOCATE: |
pub const FD_ALLOCATE: rights_t = 0x0000000000000100; |
PATH_CREATE_DIRECTORY: |
pub const PATH_CREATE_DIRECTORY: rights_t = 0x0000000000000200; |
PATH_CREATE_FILE: |
pub const PATH_CREATE_FILE: rights_t = 0x0000000000000400; |
PATH_LINK_SOURCE: |
pub const PATH_LINK_SOURCE: rights_t = 0x0000000000000800; |
PATH_LINK_TARGET: |
pub const PATH_LINK_TARGET: rights_t = 0x0000000000001000; |
PATH_OPEN: |
pub const PATH_OPEN: rights_t = 0x0000000000002000; |
FD_READDIR: |
pub const FD_READDIR: rights_t = 0x0000000000004000; |
PATH_READLINK: |
pub const PATH_READLINK: rights_t = 0x0000000000008000; |
PATH_RENAME_SOURCE: |
pub const PATH_RENAME_SOURCE: rights_t = 0x0000000000010000; |
PATH_RENAME_TARGET: |
pub const PATH_RENAME_TARGET: rights_t = 0x0000000000020000; |
PATH_FILESTAT_GET: |
pub const PATH_FILESTAT_GET: rights_t = 0x0000000000040000; |
PATH_FILESTAT_SET_SIZE: |
pub const PATH_FILESTAT_SET_SIZE: rights_t = 0x0000000000080000; |
PATH_FILESTAT_SET_TIMES: |
pub const PATH_FILESTAT_SET_TIMES: rights_t = 0x0000000000100000; |
FD_FILESTAT_GET: |
pub const FD_FILESTAT_GET: rights_t = 0x0000000000200000; |
FD_FILESTAT_SET_SIZE: |
pub const FD_FILESTAT_SET_SIZE: rights_t = 0x0000000000400000; |
FD_FILESTAT_SET_TIMES: |
pub const FD_FILESTAT_SET_TIMES: rights_t = 0x0000000000800000; |
PATH_SYMLINK: |
pub const PATH_SYMLINK: rights_t = 0x0000000001000000; |
PATH_REMOVE_DIRECTORY: |
pub const PATH_REMOVE_DIRECTORY: rights_t = 0x0000000002000000; |
PATH_UNLINK_FILE: |
pub const PATH_UNLINK_FILE: rights_t = 0x0000000004000000; |
POLL_FD_READWRITE: |
pub const POLL_FD_READWRITE: rights_t = 0x0000000008000000; |
SOCK_SHUTDOWN: |
pub const SOCK_SHUTDOWN: rights_t = 0x0000000010000000; |
SOCK_ACCEPT: |
pub const SOCK_ACCEPT: rights_t = 0x0000000020000000; |
ALL: |
pub const ALL: rights_t = FD_DATASYNC | FD_READ | FD_SEEK | FD_FDSTAT_SET_FLAGS | FD_SYNC | FD_TELL | FD_WRITE | FD_ADVISE | FD_ALLOCATE | PATH_CREATE_DIRECTORY | PATH_CREATE_FILE | PATH_LINK_SOURCE | PATH_LINK_TARGET | PATH_OPEN | FD_READDIR | PATH_READLINK | PATH_RENAME_SOURCE | PATH_RENAME_TARGET | PATH_FILESTAT_GET | PATH_FILESTAT_SET_SIZE | PATH_FILESTAT_SET_TIMES | FD_FILESTAT_GET | FD_FILESTAT_SET_SIZE | FD_FILESTAT_SET_TIMES | PATH_SYMLINK | PATH_REMOVE_DIRECTORY | PATH_UNLINK_FILE | POLL_FD_READWRITE | SOCK_SHUTDOWN | SOCK_ACCEPT; |
whence_t |
}; |
SHUT |
pub const sdflags_t = u8; pub const SHUT = struct { |
RD: |
pub const RD: sdflags_t = 0x01; |
WR: |
pub const WR: sdflags_t = 0x02; |
whence_t |
}; |
signal_t |
pub const siflags_t = u16; |
SIGNONE: |
pub const signal_t = u8; pub const SIGNONE: signal_t = 0; |
SIGHUP: |
pub const SIGHUP: signal_t = 1; |
SIGINT: |
pub const SIGINT: signal_t = 2; |
SIGQUIT: |
pub const SIGQUIT: signal_t = 3; |
SIGILL: |
pub const SIGILL: signal_t = 4; |
SIGTRAP: |
pub const SIGTRAP: signal_t = 5; |
SIGABRT: |
pub const SIGABRT: signal_t = 6; |
SIGBUS: |
pub const SIGBUS: signal_t = 7; |
SIGFPE: |
pub const SIGFPE: signal_t = 8; |
SIGKILL: |
pub const SIGKILL: signal_t = 9; |
SIGUSR1: |
pub const SIGUSR1: signal_t = 10; |
SIGSEGV: |
pub const SIGSEGV: signal_t = 11; |
SIGUSR2: |
pub const SIGUSR2: signal_t = 12; |
SIGPIPE: |
pub const SIGPIPE: signal_t = 13; |
SIGALRM: |
pub const SIGALRM: signal_t = 14; |
SIGTERM: |
pub const SIGTERM: signal_t = 15; |
SIGCHLD: |
pub const SIGCHLD: signal_t = 16; |
SIGCONT: |
pub const SIGCONT: signal_t = 17; |
SIGSTOP: |
pub const SIGSTOP: signal_t = 18; |
SIGTSTP: |
pub const SIGTSTP: signal_t = 19; |
SIGTTIN: |
pub const SIGTTIN: signal_t = 20; |
SIGTTOU: |
pub const SIGTTOU: signal_t = 21; |
SIGURG: |
pub const SIGURG: signal_t = 22; |
SIGXCPU: |
pub const SIGXCPU: signal_t = 23; |
SIGXFSZ: |
pub const SIGXFSZ: signal_t = 24; |
SIGVTALRM: |
pub const SIGVTALRM: signal_t = 25; |
SIGPROF: |
pub const SIGPROF: signal_t = 26; |
SIGWINCH: |
pub const SIGWINCH: signal_t = 27; |
SIGPOLL: |
pub const SIGPOLL: signal_t = 28; |
SIGPWR: |
pub const SIGPWR: signal_t = 29; |
SIGSYS: |
pub const SIGSYS: signal_t = 30; |
subclockflags_t |
pub const subclockflags_t = u16; |
SUBSCRIPTION_CLOCK_ABSTIME: |
pub const SUBSCRIPTION_CLOCK_ABSTIME: subclockflags_t = 0x0001; |
subscription_t |
pub const subscription_t = extern struct { userdata: userdata_t, u: subscription_u_t, |
whence_t |
}; |
subscription_fd_readwrite_t |
pub const subscription_clock_t = extern struct { id: clockid_t, timeout: timestamp_t, precision: timestamp_t, flags: subclockflags_t, |
whence_t |
}; |
subscription_u_u_t |
pub const subscription_fd_readwrite_t = extern struct { fd: fd_t, |
whence_t |
}; |
userdata_t |
pub const subscription_u_t = extern struct { tag: eventtype_t, u: subscription_u_u_t, |
whence_t |
}; |
S |
pub const subscription_u_u_t = extern union { clock: subscription_clock_t, fd_read: subscription_fd_readwrite_t, fd_write: subscription_fd_readwrite_t, }; |
IEXEC |
pub const timestamp_t = u64; |
IFBLK |
pub const userdata_t = u64; |
IFCHR |
/// Also known as `WHENCE`. pub const whence_t = enum(u8) { SET, CUR, END }; |
IFDIR |
pub const S = struct { pub const IEXEC = @compileError("TODO audit this"); pub const IFBLK = 0x6000; pub const IFCHR = 0x2000; pub const IFDIR = 0x4000; |
IFIFO |
pub const IFIFO = 0xc000; |
IFLNK |
pub const IFLNK = 0xa000; |
IFMT |
pub const IFMT = IFBLK | IFCHR | IFDIR | IFIFO | IFLNK | IFREG | IFSOCK; |
IFREG |
pub const IFREG = 0x8000; // There's no concept of UNIX domain socket but we define this value here in order to line with other OSes. |
IFSOCK |
pub const IFSOCK = 0x1; }; |
LOCK |
pub const LOCK = struct { |
SH |
pub const SH = 0x1; |
EX |
pub const EX = 0x2; |
NB |
pub const NB = 0x4; |
UN |
pub const UN = 0x8; }; |
Generated by zstd-live on 2025-08-12 12:37:59 UTC. |