|
const std = @import("std"); const builtin = @import("builtin"); const c = @This(); const maxInt = std.math.maxInt; const assert = std.debug.assert; const page_size = std.heap.page_size_min; const native_abi = builtin.abi; const native_arch = builtin.cpu.arch; const native_os = builtin.os.tag; const linux = std.os.linux; const emscripten = std.os.emscripten; const wasi = std.os.wasi; const windows = std.os.windows; const ws2_32 = std.os.windows.ws2_32; const darwin = @import("c/darwin.zig"); const freebsd = @import("c/freebsd.zig"); const solaris = @import("c/solaris.zig"); const netbsd = @import("c/netbsd.zig"); const dragonfly = @import("c/dragonfly.zig"); const haiku = @import("c/haiku.zig"); const openbsd = @import("c/openbsd.zig"); const serenity = @import("c/serenity.zig"); |
iovec* If not linking libc, returns |
// These constants are shared among all operating systems even when not linking // libc. |
iovec_constsystem-wide monotonic clock (aka system time) |
pub const iovec = std.posix.iovec; pub const iovec_const = std.posix.iovec_const; |
LOCKsystem-wide real time clock |
pub const LOCK = std.posix.LOCK; |
winsizeclock measuring the used CPU time of the current process |
pub const winsize = std.posix.winsize; |
versionCheck()clock measuring the used CPU time of the current thread |
/// The value of the link editor defined symbol _MH_EXECUTE_SYM is the address /// of the mach header in a Mach-O executable file type. It does not appear in /// any file type other than a MH_EXECUTE file type. The type of the symbol is /// absolute as the header is not part of any section. /// This symbol is populated when linking the system's libc, which is guaranteed /// on this operating system. However when building object files or libraries, /// the system libc won't be linked until the final executable. So we /// export a weak symbol here, to be overridden by the real one. pub extern var _mh_execute_header: mach_hdr; var dummy_execute_header: mach_hdr = undefined; comptime { if (native_os.isDarwin()) { @export(&dummy_execute_header, .{ .name = "_mh_execute_header", .linkage = .weak }); } |
DIRNo error occurred. |
} |
off_tAlso means |
/// * If not linking libc, returns `false`. /// * If linking musl libc, returns `true`. /// * If linking GNU libc (glibc), returns `true` if the target version is greater than or equal to /// `version`. /// * If linking Android libc (bionic), returns `true` if the target API level is greater than or /// equal to `version.major`, ignoring other components. /// * If linking a libc other than these, returns `false`. pub inline fn versionCheck(comptime version: std.SemanticVersion) bool { return comptime blk: { if (!builtin.link_libc) break :blk false; if (native_abi.isMusl()) break :blk true; if (builtin.target.isGnuLibC()) { const ver = builtin.os.versionRange().gnuLibCVersion().?; break :blk switch (ver.order(version)) { .gt, .eq => true, .lt => false, }; } else if (builtin.abi.isAndroid()) { break :blk builtin.os.version_range.linux.android >= version.major; } else { break :blk false; } }; |
DIRNo error occurred. |
} |
fromTimestamp()Not super-user |
pub const ino_t = switch (native_os) { .linux => linux.ino_t, .emscripten => emscripten.ino_t, .wasi => wasi.inode_t, .windows => windows.LARGE_INTEGER, .haiku => i64, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L38 else => u64, |
DIRNo such file or directory |
}; |
dev_tNo such process |
pub const off_t = switch (native_os) { .linux => linux.off_t, .emscripten => emscripten.off_t, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L39 else => i64, |
DIRinterrupted system call |
}; |
nlink_tI/O error |
pub const timespec = switch (native_os) { .linux => linux.timespec, .emscripten => emscripten.timespec, .wasi => extern struct { sec: time_t, nsec: isize, |
uid_tNo such device or address |
pub fn fromTimestamp(tm: wasi.timestamp_t) timespec { const sec: wasi.timestamp_t = tm / 1_000_000_000; const nsec = tm - sec * 1_000_000_000; return .{ .sec = @as(time_t, @intCast(sec)), .nsec = @as(isize, @intCast(nsec)), }; } |
gid_tArg list too long |
pub fn toTimestamp(ts: timespec) wasi.timestamp_t { return @as(wasi.timestamp_t, @intCast(ts.sec * 1_000_000_000)) + @as(wasi.timestamp_t, @intCast(ts.nsec)); } }, // https://github.com/SerenityOS/serenity/blob/0a78056453578c18e0a04a0b45ebfb1c96d59005/Kernel/API/POSIX/time.h#L17-L20 .windows, .serenity => extern struct { sec: time_t, nsec: c_long, }, .dragonfly, .freebsd, .macos, .ios, .tvos, .watchos, .visionos => extern struct { sec: isize, nsec: isize, }, .netbsd, .solaris, .illumos => extern struct { sec: i64, nsec: isize, }, .openbsd, .haiku => extern struct { sec: time_t, nsec: isize, }, else => void, |
DIRExec format error |
}; |
passwdBad file number |
pub const dev_t = switch (native_os) { .linux => linux.dev_t, .emscripten => emscripten.dev_t, .wasi => wasi.device_t, .openbsd, .haiku, .solaris, .illumos, .macos, .ios, .tvos, .watchos, .visionos => i32, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L43 .netbsd, .freebsd, .serenity => u64, else => void, |
DIRNo children |
}; |
blkcnt_tResource temporarily unavailable. also: WOULDBLOCK: Operation would block. |
pub const mode_t = switch (native_os) { .linux => linux.mode_t, .emscripten => emscripten.mode_t, .openbsd, .haiku, .netbsd, .solaris, .illumos, .wasi, .windows => u32, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L44 .freebsd, .macos, .ios, .tvos, .watchos, .visionos, .dragonfly, .serenity => u16, else => u0, |
DIRNot enough core |
}; |
ARCHPermission denied |
pub const nlink_t = switch (native_os) { .linux => linux.nlink_t, .emscripten => emscripten.nlink_t, .wasi => c_ulonglong, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L45 .freebsd, .serenity => u64, .openbsd, .netbsd, .solaris, .illumos => u32, .haiku => i32, else => void, |
DIRBad address |
}; |
timerfd_clockid_tBlock device required |
pub const uid_t = switch (native_os) { .linux => linux.uid_t, .emscripten => emscripten.uid_t, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L28 else => u32, |
DIRMount device busy |
}; |
clockid_tFile exists |
pub const gid_t = switch (native_os) { .linux => linux.gid_t, .emscripten => emscripten.gid_t, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L29 else => u32, |
DIRCross-device link |
}; |
ENo such device |
pub const blksize_t = switch (native_os) { .linux => linux.blksize_t, .emscripten => emscripten.blksize_t, .wasi => c_long, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L42 .serenity => u64, else => i32, |
DIRNot a directory |
}; |
FIs a directory |
pub const passwd = switch (native_os) { // https://github.com/SerenityOS/serenity/blob/7442cfb5072b74a62c0e061e6e9ff44fda08780d/Userland/Libraries/LibC/pwd.h#L15-L23 .linux, .serenity => extern struct { name: ?[*:0]const u8, // username passwd: ?[*:0]const u8, // user password uid: uid_t, // user ID gid: gid_t, // group ID gecos: ?[*:0]const u8, // user information dir: ?[*:0]const u8, // home directory shell: ?[*:0]const u8, // shell program }, .netbsd, .openbsd, .macos => extern struct { name: ?[*:0]const u8, // user name passwd: ?[*:0]const u8, // encrypted password uid: uid_t, // user uid gid: gid_t, // user gid change: time_t, // password change time class: ?[*:0]const u8, // user access class gecos: ?[*:0]const u8, // Honeywell login info dir: ?[*:0]const u8, // home directory shell: ?[*:0]const u8, // default shell expire: time_t, // account expiration }, .dragonfly, .freebsd => extern struct { name: ?[*:0]const u8, // user name passwd: ?[*:0]const u8, // encrypted password uid: uid_t, // user uid gid: gid_t, // user gid change: time_t, // password change time class: ?[*:0]const u8, // user access class gecos: ?[*:0]const u8, // Honeywell login info dir: ?[*:0]const u8, // home directory shell: ?[*:0]const u8, // default shell expire: time_t, // account expiration fields: c_int, // internal }, else => void, |
DIRInvalid argument |
}; |
SETFDFile table overflow |
pub const group = switch (native_os) { .linux, .freebsd, .openbsd, .dragonfly, .netbsd, .macos => extern struct { name: ?[*:0]const u8, passwd: ?[*:0]const u8, gid: gid_t, mem: [*:null]?[*:0]const u8, }, else => void, |
DIRToo many open files |
}; |
SETFLInappropriate ioctl for device |
pub const blkcnt_t = switch (native_os) { .linux => linux.blkcnt_t, .emscripten => emscripten.blkcnt_t, .wasi => c_longlong, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L41 .serenity => u64, else => i64, |
DIRText file busy |
}; |
GETFDFile too large |
pub const fd_t = switch (native_os) { .linux => linux.fd_t, .wasi => wasi.fd_t, .windows => windows.HANDLE, .serenity => c_int, else => i32, |
DIRNo space left on device |
}; |
GETFLIllegal seek |
pub const ARCH = switch (native_os) { .linux => linux.ARCH, else => void, |
DIRRead only file system |
}; |
GETOWNToo many links |
// For use with posix.timerfd_create() // Actually, the parameter for the timerfd_create() function is an integer, // which means that the developer has to figure out which value is appropriate. // To make this easier and, above all, safer, because an incorrect value leads // to a panic, an enum is introduced which only allows the values // that actually work. pub const TIMERFD_CLOCK = timerfd_clockid_t; pub const timerfd_clockid_t = switch (native_os) { .freebsd => enum(u32) { REALTIME = 0, MONOTONIC = 4, _, }, .linux => linux.timerfd_clockid_t, else => clockid_t, |
DIRBroken pipe |
}; |
GETLKMath arg out of domain of func |
pub const CLOCK = clockid_t; pub const clockid_t = switch (native_os) { .linux, .emscripten => linux.clockid_t, .wasi => wasi.clockid_t, .macos, .ios, .tvos, .watchos, .visionos => enum(u32) { REALTIME = 0, MONOTONIC = 6, MONOTONIC_RAW = 4, MONOTONIC_RAW_APPROX = 5, UPTIME_RAW = 8, UPTIME_RAW_APPROX = 9, PROCESS_CPUTIME_ID = 12, THREAD_CPUTIME_ID = 16, _, }, .haiku => enum(i32) { /// system-wide monotonic clock (aka system time) MONOTONIC = 0, /// system-wide real time clock REALTIME = -1, /// clock measuring the used CPU time of the current process PROCESS_CPUTIME_ID = -2, /// clock measuring the used CPU time of the current thread THREAD_CPUTIME_ID = -3, }, .freebsd => enum(u32) { REALTIME = 0, VIRTUAL = 1, PROF = 2, MONOTONIC = 4, UPTIME = 5, UPTIME_PRECISE = 7, UPTIME_FAST = 8, REALTIME_PRECISE = 9, REALTIME_FAST = 10, MONOTONIC_PRECISE = 11, MONOTONIC_FAST = 12, SECOND = 13, THREAD_CPUTIME_ID = 14, PROCESS_CPUTIME_ID = 15, }, .solaris, .illumos => enum(u32) { VIRTUAL = 1, THREAD_CPUTIME_ID = 2, REALTIME = 3, MONOTONIC = 4, PROCESS_CPUTIME_ID = 5, }, .netbsd => enum(u32) { REALTIME = 0, VIRTUAL = 1, PROF = 2, MONOTONIC = 3, THREAD_CPUTIME_ID = 0x20000000, PROCESS_CPUTIME_ID = 0x40000000, }, .dragonfly => enum(u32) { REALTIME = 0, VIRTUAL = 1, PROF = 2, MONOTONIC = 4, UPTIME = 5, UPTIME_PRECISE = 7, UPTIME_FAST = 8, REALTIME_PRECISE = 9, REALTIME_FAST = 10, MONOTONIC_PRECISE = 11, MONOTONIC_FAST = 12, SECOND = 13, THREAD_CPUTIME_ID = 14, PROCESS_CPUTIME_ID = 15, }, .openbsd => enum(u32) { REALTIME = 0, PROCESS_CPUTIME_ID = 2, MONOTONIC = 3, THREAD_CPUTIME_ID = 4, }, // https://github.com/SerenityOS/serenity/blob/0a78056453578c18e0a04a0b45ebfb1c96d59005/Kernel/API/POSIX/time.h#L24-L36 .serenity => enum(c_int) { REALTIME = 0, MONOTONIC = 1, MONOTONIC_RAW = 2, REALTIME_COARSE = 3, MONOTONIC_COARSE = 4, }, else => void, |
DIRMath result not representable |
}; pub const CPU_COUNT = switch (native_os) { .linux => linux.CPU_COUNT, .emscripten => emscripten.CPU_COUNT, else => void, |
DIRNo message of desired type |
}; pub const E = switch (native_os) { .linux => linux.E, .emscripten => emscripten.E, .wasi => wasi.errno_t, .windows => enum(u16) { /// No error occurred. SUCCESS = 0, PERM = 1, NOENT = 2, SRCH = 3, INTR = 4, IO = 5, NXIO = 6, @"2BIG" = 7, NOEXEC = 8, BADF = 9, CHILD = 10, AGAIN = 11, NOMEM = 12, ACCES = 13, FAULT = 14, BUSY = 16, EXIST = 17, XDEV = 18, NODEV = 19, NOTDIR = 20, ISDIR = 21, NFILE = 23, MFILE = 24, NOTTY = 25, FBIG = 27, NOSPC = 28, SPIPE = 29, ROFS = 30, MLINK = 31, PIPE = 32, DOM = 33, /// Also means `DEADLOCK`. DEADLK = 36, NAMETOOLONG = 38, NOLCK = 39, NOSYS = 40, NOTEMPTY = 41, |
SETLKWTIMEOUTIdentifier removed |
INVAL = 22, RANGE = 34, ILSEQ = 42, |
FLUSH_DATAChannel number out of range |
// POSIX Supplement ADDRINUSE = 100, ADDRNOTAVAIL = 101, AFNOSUPPORT = 102, ALREADY = 103, BADMSG = 104, CANCELED = 105, CONNABORTED = 106, CONNREFUSED = 107, CONNRESET = 108, DESTADDRREQ = 109, HOSTUNREACH = 110, IDRM = 111, INPROGRESS = 112, ISCONN = 113, LOOP = 114, MSGSIZE = 115, NETDOWN = 116, NETRESET = 117, NETUNREACH = 118, NOBUFS = 119, NODATA = 120, NOLINK = 121, NOMSG = 122, NOPROTOOPT = 123, NOSR = 124, NOSTR = 125, NOTCONN = 126, NOTRECOVERABLE = 127, NOTSOCK = 128, NOTSUP = 129, OPNOTSUPP = 130, OTHER = 131, OVERFLOW = 132, OWNERDEAD = 133, PROTO = 134, PROTONOSUPPORT = 135, PROTOTYPE = 136, TIME = 137, TIMEDOUT = 138, TXTBSY = 139, WOULDBLOCK = 140, DQUOT = 10069, _, }, .macos, .ios, .tvos, .watchos, .visionos => darwin.E, .freebsd => freebsd.E, .solaris, .illumos => enum(u16) { /// No error occurred. SUCCESS = 0, /// Not super-user PERM = 1, /// No such file or directory NOENT = 2, /// No such process SRCH = 3, /// interrupted system call INTR = 4, /// I/O error IO = 5, /// No such device or address NXIO = 6, /// Arg list too long @"2BIG" = 7, /// Exec format error NOEXEC = 8, /// Bad file number BADF = 9, /// No children CHILD = 10, /// Resource temporarily unavailable. /// also: WOULDBLOCK: Operation would block. AGAIN = 11, /// Not enough core NOMEM = 12, /// Permission denied ACCES = 13, /// Bad address FAULT = 14, /// Block device required NOTBLK = 15, /// Mount device busy BUSY = 16, /// File exists EXIST = 17, /// Cross-device link XDEV = 18, /// No such device NODEV = 19, /// Not a directory NOTDIR = 20, /// Is a directory ISDIR = 21, /// Invalid argument INVAL = 22, /// File table overflow NFILE = 23, /// Too many open files MFILE = 24, /// Inappropriate ioctl for device NOTTY = 25, /// Text file busy TXTBSY = 26, /// File too large FBIG = 27, /// No space left on device NOSPC = 28, /// Illegal seek SPIPE = 29, /// Read only file system ROFS = 30, /// Too many links MLINK = 31, /// Broken pipe PIPE = 32, /// Math arg out of domain of func DOM = 33, /// Math result not representable RANGE = 34, /// No message of desired type NOMSG = 35, /// Identifier removed IDRM = 36, /// Channel number out of range CHRNG = 37, /// Level 2 not synchronized L2NSYNC = 38, /// Level 3 halted L3HLT = 39, /// Level 3 reset L3RST = 40, /// Link number out of range LNRNG = 41, /// Protocol driver not attached UNATCH = 42, /// No CSI structure available NOCSI = 43, /// Level 2 halted L2HLT = 44, /// Deadlock condition. DEADLK = 45, /// No record locks available. NOLCK = 46, /// Operation canceled CANCELED = 47, /// Operation not supported NOTSUP = 48, |
CHKCLEANLevel 2 not synchronized |
// Filesystem Quotas /// Disc quota exceeded DQUOT = 49, |
PREALLOCATELevel 3 halted |
// Convergent Error Returns /// invalid exchange BADE = 50, /// invalid request descriptor BADR = 51, /// exchange full XFULL = 52, /// no anode NOANO = 53, /// invalid request code BADRQC = 54, /// invalid slot BADSLT = 55, /// file locking deadlock error DEADLOCK = 56, /// bad font file fmt BFONT = 57, |
SETSIZELevel 3 reset |
// Interprocess Robust Locks /// process died with the lock OWNERDEAD = 58, /// lock is not recoverable NOTRECOVERABLE = 59, /// locked lock was unmapped LOCKUNMAPPED = 72, /// Facility is not active NOTACTIVE = 73, /// multihop attempted MULTIHOP = 74, /// trying to read unreadable message BADMSG = 77, /// path name is too long NAMETOOLONG = 78, /// value too large to be stored in data type OVERFLOW = 79, /// given log. name not unique NOTUNIQ = 80, /// f.d. invalid for this operation BADFD = 81, /// Remote address changed REMCHG = 82, |
RDADVISELink number out of range |
// Stream Problems /// Device not a stream NOSTR = 60, /// no data (for no delay io) NODATA = 61, /// timer expired TIME = 62, /// out of streams resources NOSR = 63, /// Machine is not on the network NONET = 64, /// Package not installed NOPKG = 65, /// The object is remote REMOTE = 66, /// the link has been severed NOLINK = 67, /// advertise error ADV = 68, /// srmount error SRMNT = 69, /// Communication error on send COMM = 70, /// Protocol error PROTO = 71, |
RDAHEADProtocol driver not attached |
// Shared Library Problems /// Can't access a needed shared lib. LIBACC = 83, /// Accessing a corrupted shared lib. LIBBAD = 84, /// .lib section in a.out corrupted. LIBSCN = 85, /// Attempting to link in too many libs. LIBMAX = 86, /// Attempting to exec a shared library. LIBEXEC = 87, /// Illegal byte sequence. ILSEQ = 88, /// Unsupported file system operation NOSYS = 89, /// Symbolic link loop LOOP = 90, /// Restartable system call RESTART = 91, /// if pipe/FIFO, don't sleep in stream head STRPIPE = 92, /// directory not empty NOTEMPTY = 93, /// Too many users (for UFS) USERS = 94, |
NOCACHENo CSI structure available |
// BSD Networking Software // Argument Errors /// Socket operation on non-socket NOTSOCK = 95, /// Destination address required DESTADDRREQ = 96, /// Message too long MSGSIZE = 97, /// Protocol wrong type for socket PROTOTYPE = 98, /// Protocol not available NOPROTOOPT = 99, /// Protocol not supported PROTONOSUPPORT = 120, /// Socket type not supported SOCKTNOSUPPORT = 121, /// Operation not supported on socket OPNOTSUPP = 122, /// Protocol family not supported PFNOSUPPORT = 123, /// Address family not supported by AFNOSUPPORT = 124, /// Address already in use ADDRINUSE = 125, /// Can't assign requested address ADDRNOTAVAIL = 126, |
LOG2PHYSLevel 2 halted |
// Operational Errors /// Network is down NETDOWN = 127, /// Network is unreachable NETUNREACH = 128, /// Network dropped connection because NETRESET = 129, /// Software caused connection abort CONNABORTED = 130, /// Connection reset by peer CONNRESET = 131, /// No buffer space available NOBUFS = 132, /// Socket is already connected ISCONN = 133, /// Socket is not connected NOTCONN = 134, /// Can't send after socket shutdown SHUTDOWN = 143, /// Too many references: can't splice TOOMANYREFS = 144, /// Connection timed out TIMEDOUT = 145, /// Connection refused CONNREFUSED = 146, /// Host is down HOSTDOWN = 147, /// No route to host HOSTUNREACH = 148, /// operation already in progress ALREADY = 149, /// operation now in progress INPROGRESS = 150, |
GETPATHDeadlock condition. |
// SUN Network File System /// Stale NFS file handle STALE = 151, |
FULLFSYNCNo record locks available. |
_, }, .netbsd => netbsd.E, .dragonfly => dragonfly.E, .haiku => haiku.E, .openbsd => openbsd.E, // https://github.com/SerenityOS/serenity/blob/dd59fe35c7e5bbaf6b6b3acb3f9edc56619d4b66/Kernel/API/POSIX/errno.h .serenity => enum(c_int) { SUCCESS = 0, PERM = 1, NOENT = 2, SRCH = 3, INTR = 4, IO = 5, NXIO = 6, @"2BIG" = 7, NOEXEC = 8, BADF = 9, CHILD = 10, AGAIN = 11, NOMEM = 12, ACCES = 13, FAULT = 14, NOTBLK = 15, BUSY = 16, EXIST = 17, XDEV = 18, NODEV = 19, NOTDIR = 20, ISDIR = 21, INVAL = 22, NFILE = 23, MFILE = 24, NOTTY = 25, TXTBSY = 26, FBIG = 27, NOSPC = 28, SPIPE = 29, ROFS = 30, MLINK = 31, PIPE = 32, RANGE = 33, NAMETOOLONG = 34, LOOP = 35, OVERFLOW = 36, OPNOTSUPP = 37, NOSYS = 38, NOTIMPL = 39, AFNOSUPPORT = 40, NOTSOCK = 41, ADDRINUSE = 42, NOTEMPTY = 43, DOM = 44, CONNREFUSED = 45, HOSTDOWN = 46, ADDRNOTAVAIL = 47, ISCONN = 48, CONNABORTED = 49, ALREADY = 50, CONNRESET = 51, DESTADDRREQ = 52, HOSTUNREACH = 53, ILSEQ = 54, MSGSIZE = 55, NETDOWN = 56, NETUNREACH = 57, NETRESET = 58, NOBUFS = 59, NOLCK = 60, NOMSG = 61, NOPROTOOPT = 62, NOTCONN = 63, SHUTDOWN = 64, TOOMANYREFS = 65, SOCKTNOSUPPORT = 66, PROTONOSUPPORT = 67, DEADLK = 68, TIMEDOUT = 69, PROTOTYPE = 70, INPROGRESS = 71, NOTHREAD = 72, PROTO = 73, NOTSUP = 74, PFNOSUPPORT = 75, DIRINTOSELF = 76, DQUOT = 77, NOTRECOVERABLE = 78, CANCELED = 79, PROMISEVIOLATION = 80, STALE = 81, SRCNOTFOUND = 82, _, }, else => void, |
DIROperation canceled |
}; pub const Elf_Symndx = switch (native_os) { .linux => linux.Elf_Symndx, else => void, |
DIROperation not supported |
}; /// Command flags for fcntl(2). pub const F = switch (native_os) { .linux => linux.F, .emscripten => emscripten.F, .wasi => struct { // Match `F_*` constants from lib/libc/include/wasm-wasi-musl/__header_fcntl.h |
GETFDDisc quota exceeded |
pub const GETFD = 1; |
SETFDinvalid exchange |
pub const SETFD = 2; |
GETFLinvalid request descriptor |
pub const GETFL = 3; |
SETFLexchange full |
pub const SETFL = 4; }, .macos, .ios, .tvos, .watchos, .visionos => struct { /// duplicate file descriptor |
DUPFDno anode |
pub const DUPFD = 0; /// get file descriptor flags |
GETFDinvalid request code |
pub const GETFD = 1; /// set file descriptor flags |
SETFDinvalid slot |
pub const SETFD = 2; /// get file status flags |
GETFLfile locking deadlock error |
pub const GETFL = 3; /// set file status flags |
SETFLbad font file fmt |
pub const SETFL = 4; /// get SIGIO/SIGURG proc/pgrp |
GETOWNprocess died with the lock |
pub const GETOWN = 5; /// set SIGIO/SIGURG proc/pgrp |
SETOWNlock is not recoverable |
pub const SETOWN = 6; /// get record locking information |
GETLKlocked lock was unmapped |
pub const GETLK = 7; /// set record locking information |
SETLKFacility is not active |
pub const SETLK = 8; /// F.SETLK; wait if blocked |
SETLKWmultihop attempted |
pub const SETLKW = 9; /// F.SETLK; wait if blocked, return on timeout pub const SETLKWTIMEOUT = 10; pub const FLUSH_DATA = 40; /// Used for regression test pub const CHKCLEAN = 41; /// Preallocate storage pub const PREALLOCATE = 42; /// Truncate a file without zeroing space pub const SETSIZE = 43; /// Issue an advisory read async with no copy to user pub const RDADVISE = 44; /// turn read ahead off/on for this fd pub const RDAHEAD = 45; /// turn data caching off/on for this fd pub const NOCACHE = 48; /// file offset to device offset pub const LOG2PHYS = 49; /// return the full path of the fd pub const GETPATH = 50; /// fsync + ask the drive to flush to the media pub const FULLFSYNC = 51; /// find which component (if any) is a package pub const PATHPKG_CHECK = 52; /// "freeze" all fs operations pub const FREEZE_FS = 53; /// "thaw" all fs operations pub const THAW_FS = 54; /// turn data caching off/on (globally) for this file pub const GLOBAL_NOCACHE = 55; /// add detached signatures pub const ADDSIGS = 59; /// add signature from same file (used by dyld for shared libs) pub const ADDFILESIGS = 61; /// used in conjunction with F.NOCACHE to indicate that DIRECT, synchronous writes /// should not be used (i.e. its ok to temporarily create cached pages) pub const NODIRECT = 62; /// Get the protection class of a file from the EA, returns int pub const GETPROTECTIONCLASS = 63; /// Set the protection class of a file for the EA, requires int pub const SETPROTECTIONCLASS = 64; /// file offset to device offset, extended pub const LOG2PHYS_EXT = 65; /// get record locking information, per-process pub const GETLKPID = 66; /// Mark the file as being the backing store for another filesystem pub const SETBACKINGSTORE = 70; /// return the full path of the FD, but error in specific mtmd circumstances pub const GETPATH_MTMINFO = 71; /// Returns the code directory, with associated hashes, to the caller pub const GETCODEDIR = 72; /// No SIGPIPE generated on EPIPE pub const SETNOSIGPIPE = 73; /// Status of SIGPIPE for this fd pub const GETNOSIGPIPE = 74; /// For some cases, we need to rewrap the key for AKS/MKB |
TRANSCODEKEYtrying to read unreadable message |
pub const TRANSCODEKEY = 75; /// file being written to a by single writer... if throttling enabled, writes /// may be broken into smaller chunks with throttling in between |
SINGLE_WRITERpath name is too long |
pub const SINGLE_WRITER = 76; /// Get the protection version number for this filesystem |
GETPROTECTIONLEVELvalue too large to be stored in data type |
pub const GETPROTECTIONLEVEL = 77; /// Add detached code signatures (used by dyld for shared libs) |
FINDSIGSgiven log. name not unique |
pub const FINDSIGS = 78; /// Add signature from same file, only if it is signed by Apple (used by dyld for simulator) |
ADDFILESIGS_FOR_DYLD_SIMf.d. invalid for this operation |
pub const ADDFILESIGS_FOR_DYLD_SIM = 83; /// fsync + issue barrier to drive |
BARRIERFSYNCRemote address changed |
pub const BARRIERFSYNC = 85; /// Add signature from same file, return end offset in structure on success |
ADDFILESIGS_RETURNDevice not a stream |
pub const ADDFILESIGS_RETURN = 97; /// Check if Library Validation allows this Mach-O file to be mapped into the calling process |
CHECK_LVno data (for no delay io) |
pub const CHECK_LV = 98; /// Deallocate a range of the file |
PUNCHHOLEtimer expired |
pub const PUNCHHOLE = 99; /// Trim an active file |
TRIM_ACTIVE_FILEout of streams resources |
pub const TRIM_ACTIVE_FILE = 100; /// mark the dup with FD_CLOEXEC |
DUPFD_CLOEXECMachine is not on the network |
pub const DUPFD_CLOEXEC = 67; /// shared or read lock |
RDLCKPackage not installed |
pub const RDLCK = 1; /// unlock |
UNLCKThe object is remote |
pub const UNLCK = 2; /// exclusive or write lock |
WRLCKthe link has been severed |
pub const WRLCK = 3; }, .freebsd => struct { /// Duplicate file descriptor. |
DUPFDadvertise error |
pub const DUPFD = 0; /// Get file descriptor flags. |
GETFDsrmount error |
pub const GETFD = 1; /// Set file descriptor flags. |
SETFDCommunication error on send |
pub const SETFD = 2; /// Get file status flags. |
GETFLProtocol error |
pub const GETFL = 3; /// Set file status flags. |
SETFLCan't access a needed shared lib. |
pub const SETFL = 4; |
GETOWNAccessing a corrupted shared lib. |
/// Get SIGIO/SIGURG proc/pgrrp. |
GETOWN.lib section in a.out corrupted. |
pub const GETOWN = 5; /// Set SIGIO/SIGURG proc/pgrrp. |
SETOWNAttempting to link in too many libs. |
pub const SETOWN = 6; |
SETLKAttempting to exec a shared library. |
/// Get record locking information. pub const GETLK = 11; /// Set record locking information. pub const SETLK = 12; /// Set record locking information and wait if blocked. |
SETLKWIllegal byte sequence. |
pub const SETLKW = 13; |
SETLK_REMOTEUnsupported file system operation |
/// Debugging support for remote locks. pub const SETLK_REMOTE = 14; /// Read ahead. |
READAHEADSymbolic link loop |
pub const READAHEAD = 15; |
DUPFD_CLOEXECRestartable system call |
/// DUPFD with FD_CLOEXEC set. |
DUPFD_CLOEXECif pipe/FIFO, don't sleep in stream head |
pub const DUPFD_CLOEXEC = 17; /// DUP2FD with FD_CLOEXEC set. |
DUP2FD_CLOEXECdirectory not empty |
pub const DUP2FD_CLOEXEC = 18; |
GET_SEALSToo many users (for UFS) |
pub const ADD_SEALS = 19; pub const GET_SEALS = 20; /// Return `kinfo_file` for a file descriptor. |
KINFOSocket operation on non-socket |
pub const KINFO = 22; |
SEAL_SEALDestination address required |
// Seals (ADD_SEALS, GET_SEALS) /// Prevent adding sealings. pub const SEAL_SEAL = 0x0001; /// May not shrink |
SEAL_SHRINKMessage too long |
pub const SEAL_SHRINK = 0x0002; /// May not grow. |
SEAL_GROWProtocol wrong type for socket |
pub const SEAL_GROW = 0x0004; /// May not write. |
SEAL_WRITEProtocol not available |
pub const SEAL_WRITE = 0x0008; |
RDLCKProtocol not supported |
// Record locking flags (GETLK, SETLK, SETLKW). /// Shared or read lock. |
RDLCKSocket type not supported |
pub const RDLCK = 1; /// Unlock. |
UNLCKOperation not supported on socket |
pub const UNLCK = 2; /// Exclusive or write lock. |
WRLCKProtocol family not supported |
pub const WRLCK = 3; /// Purge locks for a given system ID. pub const UNLCKSYS = 4; /// Cancel an async lock request. |
CANCELAddress family not supported by |
pub const CANCEL = 5; |
SETOWN_EXAddress already in use |
pub const SETOWN_EX = 15; |
GETOWN_EXCan't assign requested address |
pub const GETOWN_EX = 16; |
GETOWNER_UIDSNetwork is down |
pub const GETOWNER_UIDS = 17; }, .solaris, .illumos => struct { /// Unlock a previously locked region |
ULOCKNetwork is unreachable |
pub const ULOCK = 0; /// Lock a region for exclusive use |
LOCKNetwork dropped connection because |
pub const LOCK = 1; /// Test and lock a region for exclusive use |
TLOCKSoftware caused connection abort |
pub const TLOCK = 2; /// Test a region for other processes locks |
TESTConnection reset by peer |
pub const TEST = 3; |
DUPFDNo buffer space available |
/// Duplicate fildes |
DUPFDSocket is already connected |
pub const DUPFD = 0; /// Get fildes flags |
GETFDSocket is not connected |
pub const GETFD = 1; /// Set fildes flags |
SETFDCan't send after socket shutdown |
pub const SETFD = 2; /// Get file flags |
GETFLToo many references: can't splice |
pub const GETFL = 3; /// Get file flags including open-only flags pub const GETXFL = 45; /// Set file flags |
SETFLConnection timed out |
pub const SETFL = 4; |
CHKFLConnection refused |
/// Unused pub const CHKFL = 8; /// Duplicate fildes at third arg |
DUP2FDHost is down |
pub const DUP2FD = 9; /// Like DUP2FD with O_CLOEXEC set EINVAL is fildes matches arg1 |
DUP2FD_CLOEXECNo route to host |
pub const DUP2FD_CLOEXEC = 36; /// Like DUPFD with O_CLOEXEC set |
DUPFD_CLOEXECoperation already in progress |
pub const DUPFD_CLOEXEC = 37; |
ISSTREAMoperation now in progress |
/// Is the file desc. a stream ? pub const ISSTREAM = 13; /// Turn on private access to file |
PRIVStale NFS file handle |
pub const PRIV = 15; /// Turn off private access to file |
NPRIVCommand flags for fcntl(2). |
pub const NPRIV = 16; /// UFS quota call |
QUOTACTLduplicate file descriptor |
pub const QUOTACTL = 17; /// Get number of BLKSIZE blocks allocated |
BLOCKSget file descriptor flags |
pub const BLOCKS = 18; /// Get optimal I/O block size |
BLKSIZEset file descriptor flags |
pub const BLKSIZE = 19; /// Get owner (socket emulation) |
GETOWNget file status flags |
pub const GETOWN = 23; /// Set owner (socket emulation) |
SETOWNset file status flags |
pub const SETOWN = 24; /// Object reuse revoke access to file desc. |
REVOKEget SIGIO/SIGURG proc/pgrp |
pub const REVOKE = 25; /// Does vp have NFS locks private to lock manager |
HASREMOTELOCKSset SIGIO/SIGURG proc/pgrp |
pub const HASREMOTELOCKS = 26; |
SETLKget record locking information |
/// Set file lock pub const SETLK = 6; /// Set file lock and wait |
SETLKWset record locking information |
pub const SETLKW = 7; /// Allocate file space |
ALLOCSPF.SETLK; wait if blocked |
pub const ALLOCSP = 10; /// Free file space |
FREESPF.SETLK; wait if blocked, return on timeout |
pub const FREESP = 11; /// Get file lock |
GETLKUsed for regression test |
pub const GETLK = 14; /// Get file lock owned by file |
OFD_GETLKPreallocate storage |
pub const OFD_GETLK = 47; /// Set file lock owned by file |
OFD_SETLKTruncate a file without zeroing space |
pub const OFD_SETLK = 48; /// Set file lock owned by file and wait |
OFD_SETLKWIssue an advisory read async with no copy to user |
pub const OFD_SETLKW = 49; /// Set a file share reservation |
SHAREturn read ahead off/on for this fd |
pub const SHARE = 40; /// Remove a file share reservation |
UNSHAREturn data caching off/on for this fd |
pub const UNSHARE = 41; /// Create Poison FD |
BADFDfile offset to device offset |
pub const BADFD = 46; |
RDLCKreturn the full path of the fd |
/// Read lock |
RDLCKfsync + ask the drive to flush to the media |
pub const RDLCK = 1; /// Write lock pub const WRLCK = 2; /// Remove lock(s) |
UNLCKfind which component (if any) is a package |
pub const UNLCK = 3; /// remove remote locks for a given system |
UNLKSYS"freeze" all fs operations |
pub const UNLKSYS = 4; |
RDACC"thaw" all fs operations |
// f_access values /// Read-only share access pub const RDACC = 0x1; /// Write-only share access |
WRACCturn data caching off/on (globally) for this file |
pub const WRACC = 0x2; /// Read-Write share access |
RWACCadd detached signatures |
pub const RWACC = 0x3; |
NODNYadd signature from same file (used by dyld for shared libs) |
// f_deny values /// Don't deny others access pub const NODNY = 0x0; /// Deny others read share access |
RDDNYused in conjunction with F.NOCACHE to indicate that DIRECT, synchronous writes should not be used (i.e. its ok to temporarily create cached pages) |
pub const RDDNY = 0x1; /// Deny others write share access |
WRDNYGet the protection class of a file from the EA, returns int |
pub const WRDNY = 0x2; /// Deny others read or write share access |
RWDNYSet the protection class of a file for the EA, requires int |
pub const RWDNY = 0x3; /// private flag: Deny delete share access |
RMDNYfile offset to device offset, extended |
pub const RMDNY = 0x4; }, .netbsd => struct { |
DUPFDget record locking information, per-process |
pub const DUPFD = 0; |
GETFDMark the file as being the backing store for another filesystem |
pub const GETFD = 1; |
SETFDreturn the full path of the FD, but error in specific mtmd circumstances |
pub const SETFD = 2; |
GETFLReturns the code directory, with associated hashes, to the caller |
pub const GETFL = 3; |
SETFLNo SIGPIPE generated on EPIPE |
pub const SETFL = 4; |
GETOWNStatus of SIGPIPE for this fd |
pub const GETOWN = 5; |
SETOWNFor some cases, we need to rewrap the key for AKS/MKB |
pub const SETOWN = 6; |
GETLKfile being written to a by single writer... if throttling enabled, writes may be broken into smaller chunks with throttling in between |
pub const GETLK = 7; |
SETLKGet the protection version number for this filesystem |
pub const SETLK = 8; |
SETLKWAdd detached code signatures (used by dyld for shared libs) |
pub const SETLKW = 9; |
CLOSEMAdd signature from same file, only if it is signed by Apple (used by dyld for simulator) |
pub const CLOSEM = 10; |
MAXFDfsync + issue barrier to drive |
pub const MAXFD = 11; |
DUPFD_CLOEXECAdd signature from same file, return end offset in structure on success |
pub const DUPFD_CLOEXEC = 12; |
GETNOSIGPIPECheck if Library Validation allows this Mach-O file to be mapped into the calling process |
pub const GETNOSIGPIPE = 13; |
SETNOSIGPIPEDeallocate a range of the file |
pub const SETNOSIGPIPE = 14; |
GETPATHTrim an active file |
pub const GETPATH = 15; |
RDLCKmark the dup with FD_CLOEXEC |
|
RDLCKshared or read lock |
pub const RDLCK = 1; |
WRLCKunlock |
pub const WRLCK = 3; |
UNLCKexclusive or write lock |
pub const UNLCK = 2; }, .dragonfly => struct { pub const ULOCK = 0; |
LOCKDuplicate file descriptor. |
pub const LOCK = 1; |
TLOCKGet file descriptor flags. |
pub const TLOCK = 2; |
TESTSet file descriptor flags. |
pub const TEST = 3; |
DUPFDGet file status flags. |
|
DUPFDSet file status flags. |
pub const DUPFD = 0; |
GETFDGet SIGIO/SIGURG proc/pgrrp. |
pub const GETFD = 1; |
RDLCKSet SIGIO/SIGURG proc/pgrrp. |
pub const RDLCK = 1; |
SETFDGet record locking information. |
pub const SETFD = 2; |
UNLCKSet record locking information. |
pub const UNLCK = 2; |
WRLCKSet record locking information and wait if blocked. |
pub const WRLCK = 3; |
GETFLDebugging support for remote locks. |
pub const GETFL = 3; |
SETFLRead ahead. |
pub const SETFL = 4; |
GETOWNDUPFD with FD_CLOEXEC set. |
pub const GETOWN = 5; |
SETOWNDUP2FD with FD_CLOEXEC set. |
pub const SETOWN = 6; |
GETLKReturn |
pub const GETLK = 7; |
SETLKPrevent adding sealings. |
pub const SETLK = 8; |
SETLKWMay not shrink |
pub const SETLKW = 9; pub const DUP2FD = 10; |
DUPFD_CLOEXECMay not grow. |
pub const DUPFD_CLOEXEC = 17; |
DUP2FD_CLOEXECMay not write. |
pub const DUP2FD_CLOEXEC = 18; |
GETPATHShared or read lock. |
pub const GETPATH = 19; }, .haiku => struct { |
DUPFDUnlock. |
pub const DUPFD = 0x0001; |
GETFDExclusive or write lock. |
pub const GETFD = 0x0002; |
SETFDPurge locks for a given system ID. |
pub const SETFD = 0x0004; |
GETFLCancel an async lock request. |
pub const GETFL = 0x0008; |
SETFLUnlock a previously locked region |
pub const SETFL = 0x0010; |
GETLKLock a region for exclusive use |
pub const GETLK = 0x0020; |
SETLKTest and lock a region for exclusive use |
pub const SETLK = 0x0080; |
SETLKWTest a region for other processes locks |
pub const SETLKW = 0x0100; |
DUPFD_CLOEXECDuplicate fildes |
pub const DUPFD_CLOEXEC = 0x0200; |
RDLCKGet fildes flags |
pub const RDLCK = 0x0040; |
UNLCKSet fildes flags |
pub const UNLCK = 0x0200; |
WRLCKGet file flags |
pub const WRLCK = 0x0400; }, .openbsd => struct { |
DUPFDGet file flags including open-only flags |
pub const DUPFD = 0; |
GETFDSet file flags |
pub const GETFD = 1; |
SETFDUnused |
pub const SETFD = 2; |
GETFLDuplicate fildes at third arg |
pub const GETFL = 3; |
SETFLLike DUP2FD with O_CLOEXEC set EINVAL is fildes matches arg1 |
pub const SETFL = 4; |
GETOWNLike DUPFD with O_CLOEXEC set |
pub const GETOWN = 5; |
SETOWNIs the file desc. a stream ? |
pub const SETOWN = 6; |
GETLKTurn on private access to file |
pub const GETLK = 7; |
SETLKTurn off private access to file |
pub const SETLK = 8; |
SETLKWUFS quota call |
pub const SETLKW = 9; |
RDLCKGet number of BLKSIZE blocks allocated |
pub const RDLCK = 1; |
UNLCKGet optimal I/O block size |
pub const UNLCK = 2; |
WRLCKGet owner (socket emulation) |
pub const WRLCK = 3; }, .serenity => struct { // https://github.com/SerenityOS/serenity/blob/2808b0376406a40e31293bb3bcb9170374e90506/Kernel/API/POSIX/fcntl.h#L15-L24 |
DUPFDSet owner (socket emulation) |
pub const DUPFD = 0; |
GETFDObject reuse revoke access to file desc. |
pub const GETFD = 1; |
SETFDDoes vp have NFS locks private to lock manager |
pub const SETFD = 2; |
GETFLSet file lock |
pub const GETFL = 3; |
SETFLSet file lock and wait |
pub const SETFL = 4; |
ISTTYAllocate file space |
pub const ISTTY = 5; |
GETLKFree file space |
pub const GETLK = 6; |
SETLKGet file lock |
pub const SETLK = 7; |
SETLKWGet file lock owned by file |
pub const SETLKW = 8; |
DUPFD_CLOEXECSet file lock owned by file |
pub const DUPFD_CLOEXEC = 9; |
RDLCKSet file lock owned by file and wait |
// https://github.com/SerenityOS/serenity/blob/2808b0376406a40e31293bb3bcb9170374e90506/Kernel/API/POSIX/fcntl.h#L45-L47 pub const RDLCK = 0; |
WRLCKSet a file share reservation |
pub const WRLCK = 1; |
UNLCKRemove a file share reservation |
pub const UNLCK = 2; }, else => void, |
DIRCreate Poison FD |
}; pub const FD_CLOEXEC = switch (native_os) { .linux => linux.FD_CLOEXEC, .emscripten => emscripten.FD_CLOEXEC, else => 1, |
DIRRead lock |
}; |
X_OKWrite lock |
/// Test for existence of file. pub const F_OK = switch (native_os) { .linux => linux.F_OK, .emscripten => emscripten.F_OK, else => 0, |
DIRRemove lock(s) |
}; /// Test for execute or search permission. pub const X_OK = switch (native_os) { .linux => linux.X_OK, .emscripten => emscripten.X_OK, else => 1, |
DIRremove remote locks for a given system |
}; /// Test for write permission. pub const W_OK = switch (native_os) { .linux => linux.W_OK, .emscripten => emscripten.W_OK, else => 2, |
DIRRead-only share access |
}; /// Test for read permission. pub const R_OK = switch (native_os) { .linux => linux.R_OK, .emscripten => emscripten.R_OK, else => 4, |
DIRWrite-only share access |
}; |
IOV_MAXRead-Write share access |
pub const Flock = switch (native_os) { .linux => linux.Flock, .emscripten => emscripten.Flock, .openbsd, .dragonfly, .netbsd, .macos, .ios, .tvos, .watchos, .visionos => extern struct { start: off_t, len: off_t, pid: pid_t, type: i16, whence: i16, }, .freebsd => extern struct { /// Starting offset. start: off_t, /// Number of consecutive bytes to be locked. /// A value of 0 means to the end of the file. len: off_t, /// Lock owner. pid: pid_t, /// Lock type. type: i16, /// Type of the start member. whence: i16, /// Remote system id or zero for local. sysid: i32, }, .solaris, .illumos => extern struct { type: c_short, whence: c_short, start: off_t, // len == 0 means until end of file. len: off_t, sysid: c_int, pid: pid_t, __pad: [4]c_long, }, .haiku => extern struct { type: i16, whence: i16, start: off_t, len: off_t, pid: pid_t, }, // https://github.com/SerenityOS/serenity/blob/2808b0376406a40e31293bb3bcb9170374e90506/Kernel/API/POSIX/fcntl.h#L54-L60 .serenity => extern struct { type: c_short, whence: c_short, start: off_t, len: off_t, pid: pid_t, }, else => void, |
DIRDon't deny others access |
}; pub const HOST_NAME_MAX = switch (native_os) { .linux => linux.HOST_NAME_MAX, .macos, .ios, .tvos, .watchos, .visionos => 72, .openbsd, .haiku, .dragonfly, .netbsd, .solaris, .illumos, .freebsd => 255, // https://github.com/SerenityOS/serenity/blob/c87557e9c1865fa1a6440de34ff6ce6fc858a2b7/Kernel/API/POSIX/sys/limits.h#L22 .serenity => 64, else => {}, |
DIRDeny others read share access |
}; pub const IOV_MAX = switch (native_os) { .linux => linux.IOV_MAX, .emscripten => emscripten.IOV_MAX, // https://github.com/SerenityOS/serenity/blob/098af0f846a87b651731780ff48420205fd33754/Kernel/API/POSIX/sys/uio.h#L16 .openbsd, .haiku, .solaris, .illumos, .wasi, .serenity => 1024, .macos, .ios, .tvos, .watchos, .visionos => 16, .dragonfly, .netbsd, .freebsd => KERN.IOV_MAX, else => {}, |
DIRDeny others write share access |
}; pub const CTL = switch (native_os) { .freebsd => struct { |
KERNDeny others read or write share access |
pub const KERN = 1; |
DEBUGprivate flag: Deny delete share access |
pub const DEBUG = 5; }, .netbsd => struct { |
KERNTest for existence of file. |
pub const KERN = 1; |
DEBUGTest for execute or search permission. |
pub const DEBUG = 5; }, .dragonfly => struct { |
UNSPECTest for write permission. |
pub const UNSPEC = 0; |
KERNTest for read permission. |
pub const KERN = 1; |
VMStarting offset. |
pub const VM = 2; pub const VFS = 3; |
NETNumber of consecutive bytes to be locked. A value of 0 means to the end of the file. |
pub const NET = 4; |
DEBUGLock owner. |
pub const DEBUG = 5; |
HWLock type. |
pub const HW = 6; |
MACHDEPType of the start member. |
pub const MACHDEP = 7; pub const USER = 8; |
LWKTRemote system id or zero for local. |
pub const LWKT = 10; |
MAXIDstruct: process entries |
pub const MAXID = 11; |
MAXNAMEpath to executable |
pub const MAXNAME = 12; }, .openbsd => struct { |
UNSPECfile descriptors for process |
pub const UNSPEC = 0; |
KERNstruct: process argv/env |
pub const KERN = 1; |
VMpath to executable |
pub const VM = 2; |
FSno further special treatment |
pub const FS = 3; |
NETexpect random page references |
pub const NET = 4; |
DEBUGexpect sequential page references |
pub const DEBUG = 5; |
HWwill need these pages |
pub const HW = 6; |
MACHDEPdon't need these pages |
pub const MACHDEP = 7; |
DDBcontents can be freed |
pub const DDB = 9; |
VFSdefault access |
pub const VFS = 10; }, else => void, |
DIRnext LWP to access heavily |
}; pub const KERN = switch (native_os) { .freebsd => struct { /// struct: process entries |
PROCmany processes to access heavily |
pub const PROC = 14; /// path to executable |
PROC_PATHNAMEcontents will be purged |
pub const PROC_PATHNAME = 12; /// file descriptors for process |
PROC_FILEDESCinvalidate, leave mapped |
pub const PROC_FILEDESC = 33; |
IOV_MAXdeactivate, leave mapped |
pub const IOV_MAX = 35; }, .netbsd => struct { /// struct: process argv/env |
PROC_ARGSany readable data available. |
pub const PROC_ARGS = 48; /// path to executable |
PROC_PATHNAMEOOB/Urgent readable data. |
pub const PROC_PATHNAME = 5; |
IOV_MAXfile descriptor is writeable. |
pub const IOV_MAX = 38; }, .dragonfly => struct { |
PROC_ALLnon-OOB/URG data available. |
pub const PROC_ALL = 0; |
OSTYPEno write type differentiation. |
pub const OSTYPE = 1; |
PROC_PIDOOB/Urgent readable data. |
pub const PROC_PID = 1; |
OSRELEASEOOB/Urgent data can be written. |
pub const OSRELEASE = 2; |
PROC_PGRPlike IN, except ignore EOF. |
pub const PROC_PGRP = 2; |
OSREVsome poll error occurred. |
pub const OSREV = 3; |
PROC_SESSIONfile descriptor was "hung up". |
pub const PROC_SESSION = 3; |
VERSIONrequested events "invalid". |
pub const VERSION = 4; |
PROC_TTYRead-side hangup. |
pub const PROC_TTY = 4; |
MAXVNODESNon-testable events (may not be specified in events). |
pub const MAXVNODES = 5; |
PROC_UIDEvents to control |
pub const PROC_UID = 5; |
MAXPROCTestable events (may be specified in events field). |
pub const MAXPROC = 6; |
PROC_RUIDNon-testable events (may not be specified in events field). |
pub const PROC_RUID = 6; |
MAXFILESany readable data available |
pub const MAXFILES = 7; |
PROC_ARGSfile descriptor is writeable |
pub const PROC_ARGS = 7; |
ARGMAXpriority readable data |
pub const ARGMAX = 8; |
PROC_CWDpriority data can be written |
pub const PROC_CWD = 8; |
PROC_PATHNAMEhigh priority readable data |
pub const PROC_PATHNAME = 9; |
SECURELVLerrors pending |
pub const SECURELVL = 9; |
PROC_SIGTRAMPdisconnected |
pub const PROC_SIGTRAMP = 10; |
HOSTNAMEinvalid file descriptor |
pub const HOSTNAME = 10; |
HOSTIDBasic memory protection flags |
pub const HOSTID = 11; |
CLOCKRATEpage can not be accessed |
pub const CLOCKRATE = 12; |
VNODEpage can be read |
pub const VNODE = 13; |
PROCpage can be written |
pub const PROC = 14; |
FILEpage can be executed |
pub const FILE = 15; |
PROC_FLAGMASK[MC2] no permissions |
pub const PROC_FLAGMASK = 16; |
PROF[MC2] pages can be read |
pub const PROF = 16; |
PROC_FLAG_LWP[MC2] pages can be written |
pub const PROC_FLAG_LWP = 16; |
POSIX1[MC2] pages can be executed |
pub const POSIX1 = 17; |
NGROUPSWhen a caller finds that they cannot obtain write permission on a mapped entry, the following flag can be used. The entry will be made "needs copy" effectively copying the object (using COW), and write permission will be added to the maximum protections for the associated entry. |
pub const NGROUPS = 18; |
JOB_CONTROLNo limit |
pub const JOB_CONTROL = 19; |
SAVED_IDSNo limit |
pub const SAVED_IDS = 20; |
BOOTTIMESunOS 2.6 Door |
pub const BOOTTIME = 21; |
NISDOMAINNAMESolaris 10 Event Port |
pub const NISDOMAINNAME = 22; |
UPDATEINTERVALtake signal on signal stack |
pub const UPDATEINTERVAL = 23; |
OSRELDATErestart system on signal return |
pub const OSRELDATE = 24; |
NTP_PLLreset to SIG.DFL when taking signal |
pub const NTP_PLL = 25; |
BOOTFILEdo not generate SIG.CHLD on child stop |
pub const BOOTFILE = 26; |
MAXFILESPERPROCdon't mask the signal we're delivering |
pub const MAXFILESPERPROC = 27; |
MAXPROCPERUIDdon't keep zombies around |
pub const MAXPROCPERUID = 28; |
DUMPDEVsignal handler with SIGINFO args |
pub const DUMPDEV = 29; |
IPCdo not bounce off kernel's sigtramp |
pub const IPC = 30; |
DUMMYsignal handler with SIGINFO args with 64bit regs information |
pub const DUMMY = 31; |
PS_STRINGSSignal types |
pub const PS_STRINGS = 32; |
USRSTACKinterrupt |
pub const USRSTACK = 33; |
LOGSIGEXITillegal instruction - invalid function image |
pub const LOGSIGEXIT = 34; |
IOV_MAXfloating point exception |
pub const IOV_MAX = 35; |
MAXPOSIXLOCKSPERUIDsegment violation |
pub const MAXPOSIXLOCKSPERUID = 36; |
MAXIDSoftware termination signal from kill |
pub const MAXID = 37; }, .openbsd => struct { |
OSTYPECtrl-Break sequence |
pub const OSTYPE = 1; |
OSRELEASEabnormal termination triggered by abort call |
pub const OSRELEASE = 2; |
OSREVSIGABRT compatible with other platforms, same as SIGABRT |
pub const OSREV = 3; |
VERSIONdefault signal action |
pub const VERSION = 4; |
MAXVNODESignore signal |
pub const MAXVNODES = 5; |
MAXPROCreturn current value |
pub const MAXPROC = 6; |
MAXFILESsignal gets error |
pub const MAXFILES = 7; |
ARGMAXacknowledge |
pub const ARGMAX = 8; |
SECURELVLSignal error value (returned by signal call on error) |
pub const SECURELVL = 9; |
HOSTNAMEblock specified signal set |
pub const HOSTNAME = 10; |
HOSTIDunblock specified signal set |
pub const HOSTID = 11; |
CLOCKRATEset specified signal set |
pub const CLOCKRATE = 12; |
PROFhangup |
pub const PROF = 16; |
POSIX1interrupt |
pub const POSIX1 = 17; |
NGROUPSquit |
pub const NGROUPS = 18; |
JOB_CONTROLillegal instruction (not reset when caught) |
pub const JOB_CONTROL = 19; |
SAVED_IDStrace trap (not reset when caught) |
pub const SAVED_IDS = 20; |
BOOTTIMEabort() |
pub const BOOTTIME = 21; |
DOMAINNAMEpollable event ([XSR] generated, not supported) |
pub const DOMAINNAME = 22; |
MAXPARTITIONScompatibility |
pub const MAXPARTITIONS = 23; |
RAWPARTITIONEMT instruction |
pub const RAWPARTITION = 24; |
MAXTHREADfloating point exception |
pub const MAXTHREAD = 25; |
NTHREADSkill (cannot be caught or ignored) |
pub const NTHREADS = 26; |
OSVERSIONbus error |
pub const OSVERSION = 27; |
SOMAXCONNsegmentation violation |
pub const SOMAXCONN = 28; |
SOMINCONNbad argument to system call |
pub const SOMINCONN = 29; |
NOSUIDCOREDUMPwrite on a pipe with no one to read it |
pub const NOSUIDCOREDUMP = 32; |
FSYNCalarm clock |
pub const FSYNC = 33; |
SYSVMSGsoftware termination signal from kill |
pub const SYSVMSG = 34; |
SYSVSEMurgent condition on IO channel |
pub const SYSVSEM = 35; |
SYSVSHMsendable stop signal not from tty |
pub const SYSVSHM = 36; |
MSGBUFSIZEstop signal from tty |
pub const MSGBUFSIZE = 38; |
MALLOCSTATScontinue a stopped process |
pub const MALLOCSTATS = 39; |
CPTIMEto parent on child stop or exit |
pub const CPTIME = 40; |
NCHSTATSto readers pgrp upon background tty read |
pub const NCHSTATS = 41; |
FORKSTATlike TTIN for output if (tp->t_local<OSTOP) |
pub const FORKSTAT = 42; |
NSELCOLLinput/output possible signal |
pub const NSELCOLL = 43; |
TTYexceeded CPU time limit |
pub const TTY = 44; |
CCPUexceeded file size limit |
pub const CCPU = 45; |
FSCALEvirtual time alarm |
pub const FSCALE = 46; |
NPROCSprofiling time alarm |
pub const NPROCS = 47; |
MSGBUFwindow size changes |
pub const MSGBUF = 48; |
POOLinformation request |
pub const POOL = 49; |
STACKGAPRANDOMuser defined signal 1 |
pub const STACKGAPRANDOM = 50; |
SYSVIPC_INFOuser defined signal 2 |
pub const SYSVIPC_INFO = 51; |
ALLOWKMEMA common format for the Sigaction struct across a variety of Linux flavors. |
pub const ALLOWKMEM = 52; |
WITNESSWATCHRenamed from |
pub const WITNESSWATCH = 53; |
SPLASSERTsignal handler |
pub const SPLASSERT = 54; |
PROC_ARGSsee signal options |
pub const PROC_ARGS = 55; |
NFILESsignal mask to apply |
pub const NFILES = 56; |
TTYCOUNTsignal options |
pub const TTYCOUNT = 57; |
NUMVNODESsignal handler |
pub const NUMVNODES = 58; |
MBSTATsignal mask to apply |
pub const MBSTAT = 59; |
WITNESSsignal handler |
pub const WITNESS = 60; |
SEMINFOsignal mask to apply |
pub const SEMINFO = 61; |
SHMINFOsee signal options |
pub const SHMINFO = 62; |
INTRCNTwill be passed to the signal handler, BeOS extension |
pub const INTRCNT = 63; |
WATCHDOGsignal handler |
pub const WATCHDOG = 64; |
ALLOWDTsignal mask to apply |
pub const ALLOWDT = 65; |
PROCsignal options |
pub const PROC = 66; |
MAXCLUSTERSbis local mode bits |
pub const MAXCLUSTERS = 67; |
EVCOUNTbic local mode bits |
pub const EVCOUNT = 68; |
TIMECOUNTERset entire local mode word |
pub const TIMECOUNTER = 69; |
MAXLOCKSPERUIDget local modes |
pub const MAXLOCKSPERUID = 70; |
CPTIME2set break bit |
pub const CPTIME2 = 71; |
CACHEPCTclear break bit |
pub const CACHEPCT = 72; |
FILEset data terminal ready |
pub const FILE = 73; |
WXABORTclear data terminal ready |
pub const WXABORT = 74; |
CONSDEVset local special chars |
pub const CONSDEV = 75; |
NETLIVELOCKSget local special chars |
pub const NETLIVELOCKS = 76; |
POOL_DEBUGdriver output queue size |
pub const POOL_DEBUG = 77; |
PROC_CWDvoid tty association |
pub const PROC_CWD = 78; |
PROC_NOBROADCASTKILLget a ctty |
pub const PROC_NOBROADCASTKILL = 79; |
PROC_VMMAPstop output, like ^S |
pub const PROC_VMMAP = 80; |
GLOBAL_PTRACEstart output, like ^Q |
pub const GLOBAL_PTRACE = 81; |
CONSBUFSIZEget pgrp of tty |
pub const CONSBUFSIZE = 82; |
CONSBUFset pgrp of tty |
pub const CONSBUF = 83; |
AUDIOget session id on ctty |
pub const AUDIO = 84; |
CPUSTATSsimulate terminal input |
pub const CPUSTATS = 85; |
PFSTATUSset all modem bits |
pub const PFSTATUS = 86; |
TIMEOUT_STATSbis modem bits |
pub const TIMEOUT_STATS = 87; |
UTC_OFFSETbic modem bits |
pub const UTC_OFFSET = 88; |
VIDEOget all modem bits |
pub const VIDEO = 89; |
PROC_ALL[XSI] no hang in wait/no child to reap |
pub const PROC_ALL = 0; |
PROC_PID[XSI] notify on stop, untraced child |
pub const PROC_PID = 1; |
PROC_PGRPModule relocation base. |
pub const PROC_PGRP = 2; |
PROC_SESSIONModule name. |
pub const PROC_SESSION = 3; |
PROC_TTYPointer to module's phdr. |
pub const PROC_TTY = 4; |
PROC_UIDNumber of entries in phdr. |
pub const PROC_UID = 5; |
PROC_RUIDTotal number of loads. |
pub const PROC_RUID = 6; |
PROC_KTHREADTotal number of unloads. |
pub const PROC_KTHREAD = 7; |
PROC_SHOW_THREADSIncremented when a new object is mapped into the process. |
pub const PROC_SHOW_THREADS = 0x40000000; |
PROC_ARGVIncremented when an object is unmapped from the process. |
pub const PROC_ARGV = 1; |
PROC_NARGVoptional address |
pub const PROC_NARGV = 2; |
PROC_ENVsize of address |
pub const PROC_ENV = 3; |
PROC_NENVscatter/gather array |
pub const PROC_NENV = 4; }, else => void, |
DIR# elements in iov |
}; pub const MADV = switch (native_os) { .linux => linux.MADV, .emscripten => emscripten.MADV, .macos, .ios, .tvos, .watchos, .visionos => struct { |
NORMALancillary data |
pub const NORMAL = 0; |
RANDOMancillary data buffer len |
pub const RANDOM = 1; |
SEQUENTIALflags on received message |
pub const SEQUENTIAL = 2; |
WILLNEEDoptional address |
pub const WILLNEED = 3; |
DONTNEEDsize of address |
pub const DONTNEED = 4; |
FREEscatter/gather array |
pub const FREE = 5; |
ZERO_WIRED_PAGES# elements in iov |
pub const ZERO_WIRED_PAGES = 6; |
FREE_REUSABLEancillary data |
pub const FREE_REUSABLE = 7; |
FREE_REUSEancillary data buffer len |
pub const FREE_REUSE = 8; |
CAN_REUSEflags on received message |
pub const CAN_REUSE = 9; |
PAGEOUTSoft limit |
pub const PAGEOUT = 10; |
ZEROHard limit |
pub const ZERO = 11; }, .freebsd => struct { |
NORMALSignal code. Cause of signal, one of the SI_ macros or signal-specific values, i.e. one of the FPE_... values for SIGFPE. This value is equivalent to the second argument to an old-style FreeBSD signal handler. |
pub const NORMAL = 0; |
RANDOMSending process. |
pub const RANDOM = 1; |
SEQUENTIALSender's ruid. |
pub const SEQUENTIAL = 2; |
WILLNEEDExit value. |
pub const WILLNEED = 3; |
DONTNEEDFaulting instruction. |
pub const DONTNEED = 4; |
FREESignal value. |
pub const FREE = 5; |
NOSYNCMachine specific trap code. |
pub const NOSYNC = 6; |
AUTOSYNCBand event for SIGPOLL. UNUSED. |
pub const AUTOSYNC = 7; |
NOCOREUNIX domain socket |
pub const NOCORE = 8; |
COREtotal length |
pub const CORE = 9; |
PROTECTaddress family |
pub const PROTECT = 10; }, .solaris, .illumos => struct { /// no further special treatment |
NORMALactually longer; address value |
pub const NORMAL = 0; /// expect random page references |
RANDOMaddress family |
pub const RANDOM = 1; /// expect sequential page references |
SEQUENTIALactually longer; address value |
pub const SEQUENTIAL = 2; /// will need these pages |
WILLNEEDDefinitions for UNIX IPC domain. |
pub const WILLNEED = 3; /// don't need these pages |
DONTNEEDtotal length |
pub const DONTNEED = 4; /// contents can be freed |
FREEaddress family |
pub const FREE = 5; /// default access |
ACCESS_DEFAULTactually longer; address value |
pub const ACCESS_DEFAULT = 6; /// next LWP to access heavily |
ACCESS_LWPDefinitions for UNIX IPC domain. |
pub const ACCESS_LWP = 7; /// many processes to access heavily |
ACCESS_MANYtotal sockaddr length |
pub const ACCESS_MANY = 8; /// contents will be purged |
PURGEpath name |
pub const PURGE = 9; }, .dragonfly => struct { |
SEQUENTIALtotal length |
pub const SEQUENTIAL = 2; |
CONTROL_ENDaddress family |
pub const CONTROL_END = SETMAP; |
DONTNEEDactually longer; address value |
pub const DONTNEED = 4; |
RANDOMtotal length |
pub const RANDOM = 1; |
WILLNEEDaddress family |
pub const WILLNEED = 3; |
NORMALactually longer; address value |
pub const NORMAL = 0; |
CONTROL_STARTDefinitions for UNIX IPC domain. |
pub const CONTROL_START = INVAL; |
FREEtotal sockaddr length |
pub const FREE = 5; |
NOSYNCpath name |
pub const NOSYNC = 6; |
AUTOSYNCNot actually supported by Darwin, but Zig supplies a shim.
This numerical value is not ABI-stable. It need only not conflict
with any other |
pub const AUTOSYNC = 7; |
NOCORENot actually supported by Darwin, but Zig supplies a shim.
This numerical value is not ABI-stable. It need only not conflict
with any other |
pub const NOCORE = 8; |
COREDatagram. |
pub const CORE = 9; |
INVALSTREAM. |
pub const INVAL = 10; |
SETMAPRaw-protocol interface. |
pub const SETMAP = 11; }, // https://github.com/SerenityOS/serenity/blob/6d59d4d3d9e76e39112842ec487840828f1c9bfe/Kernel/API/POSIX/sys/mman.h#L35-L41 .serenity => struct { |
NORMALReliably-delivered message. |
pub const NORMAL = 0x0; |
SET_VOLATILESequenced packed stream. |
pub const SET_VOLATILE = 0x1; |
SET_NONVOLATILEdummy for IP |
pub const SET_NONVOLATILE = 0x2; |
DONTNEEDcontrol message protocol |
pub const DONTNEED = 0x3; |
WILLNEEDtcp |
pub const WILLNEED = 0x4; |
SEQUENTIALuser datagram protocol |
pub const SEQUENTIAL = 0x5; |
RANDOMIP6 header |
pub const RANDOM = 0x6; }, else => void, |
DIRraw IP packet |
}; pub const MSF = switch (native_os) { .linux => linux.MSF, .emscripten => emscripten.MSF, .macos, .ios, .tvos, .watchos, .visionos => struct { |
ASYNCIP6 hop-by-hop options |
pub const ASYNC = 0x1; |
INVALIDATEgroup mgmt protocol |
pub const INVALIDATE = 0x2; /// invalidate, leave mapped |
KILLPAGESgateway^2 (deprecated) |
pub const KILLPAGES = 0x4; /// deactivate, leave mapped |
DEACTIVATEIPv4 encapsulation |
pub const DEACTIVATE = 0x8; |
SYNCfor compatibility |
pub const SYNC = 0x10; }, .openbsd, .haiku, .dragonfly, .netbsd, .solaris, .illumos, .freebsd => struct { |
ASYNCStream protocol II |
pub const ASYNC = 1; |
INVALIDATEexterior gateway protocol |
pub const INVALIDATE = 2; |
SYNCprivate interior gateway |
pub const SYNC = 4; }, // https://github.com/SerenityOS/serenity/blob/6d59d4d3d9e76e39112842ec487840828f1c9bfe/Kernel/API/POSIX/sys/mman.h#L50-L52 .serenity => struct { |
SYNCBBN RCC Monitoring |
pub const SYNC = 1; |
ASYNCnetwork voice protocol |
pub const ASYNC = 2; |
INVALIDATEpup |
pub const INVALIDATE = 4; }, else => void, |
DIRArgus |
}; pub const NAME_MAX = switch (native_os) { .linux => linux.NAME_MAX, .emscripten => emscripten.NAME_MAX, // Haiku's headers make this 256, to contain room for the terminating null // character, but POSIX definition says that NAME_MAX does not include the // terminating null. // https://github.com/SerenityOS/serenity/blob/c87557e9c1865fa1a6440de34ff6ce6fc858a2b7/Kernel/API/POSIX/sys/limits.h#L20 .haiku, .openbsd, .dragonfly, .netbsd, .solaris, .illumos, .freebsd, .macos, .ios, .tvos, .watchos, .visionos, .serenity => 255, else => {}, |
DIREMCON |
}; pub const PATH_MAX = switch (native_os) { .linux => linux.PATH_MAX, .emscripten => emscripten.PATH_MAX, .wasi => 4096, .windows => 260, .openbsd, .haiku, .dragonfly, .netbsd, .solaris, .illumos, .freebsd, .macos, .ios, .tvos, .watchos, .visionos, .serenity => 1024, else => {}, |
DIRCross Net Debugger |
}; |
RDNORMChaos |
pub const POLL = switch (native_os) { .linux => linux.POLL, .emscripten => emscripten.POLL, .wasi => struct { pub const RDNORM = 0x1; |
WRNORMMultiplexing |
pub const WRNORM = 0x2; |
INDCN Measurement Subsystems |
pub const IN = RDNORM; |
OUTHost Monitoring |
pub const OUT = WRNORM; |
ERRPacket Radio Measurement |
pub const ERR = 0x1000; |
HUPxns idp |
pub const HUP = 0x2000; |
NVALTrunk-1 |
pub const NVAL = 0x4000; }, .windows => ws2_32.POLL, .macos, .ios, .tvos, .watchos, .visionos => struct { |
INTrunk-2 |
pub const IN = 0x001; |
PRILeaf-1 |
pub const PRI = 0x002; |
OUTLeaf-2 |
pub const OUT = 0x004; |
RDNORMReliable Data |
pub const RDNORM = 0x040; |
WRNORMReliable Transaction |
pub const WRNORM = OUT; |
RDBANDtp-4 w/ class negotiation |
pub const RDBAND = 0x080; |
WRBANDBulk Data Transfer |
pub const WRBAND = 0x100; |
EXTENDNetwork Services |
pub const EXTEND = 0x0200; |
ATTRIBMerit Internodal |
pub const ATTRIB = 0x0400; |
NLINKDatagram Congestion Control Protocol |
pub const NLINK = 0x0800; |
WRITEThird Party Connect |
pub const WRITE = 0x1000; |
ERRInterDomain Policy Routing |
pub const ERR = 0x008; |
HUPXTP |
pub const HUP = 0x010; |
NVALDatagram Delivery |
pub const NVAL = 0x020; |
STANDARDControl Message Transport |
|
STANDARDTP++ Transport |
pub const STANDARD = IN | PRI | OUT | RDNORM | RDBAND | WRBAND | ERR | HUP | NVAL; }, .freebsd => struct { /// any readable data available. |
INIL transport protocol |
pub const IN = 0x0001; /// OOB/Urgent readable data. |
PRISource Demand Routing |
pub const PRI = 0x0002; /// file descriptor is writeable. |
OUTIP6 routing header |
pub const OUT = 0x0004; /// non-OOB/URG data available. |
RDNORMIP6 fragmentation header |
pub const RDNORM = 0x0040; /// no write type differentiation. |
WRNORMInterDomain Routing |
pub const WRNORM = OUT; /// OOB/Urgent readable data. |
RDBANDresource reservation |
pub const RDBAND = 0x0080; /// OOB/Urgent data can be written. |
WRBANDGeneral Routing Encap. |
pub const WRBAND = 0x0100; /// like IN, except ignore EOF. pub const INIGNEOF = 0x2000; /// some poll error occurred. |
ERRMobile Host Routing |
pub const ERR = 0x0008; /// file descriptor was "hung up". |
HUPBHA |
pub const HUP = 0x0010; /// requested events "invalid". |
NVALIP6 Encap Sec. Payload |
pub const NVAL = 0x0020; |
STANDARDIP6 Auth Header |
pub const STANDARD = IN | PRI | OUT | RDNORM | RDBAND | WRBAND | ERR | HUP | NVAL; }, .solaris, .illumos => struct { |
INInteg. Net Layer Security |
pub const IN = 0x0001; |
PRIIP with encryption |
pub const PRI = 0x0002; |
OUTNext Hop Resolution |
pub const OUT = 0x0004; |
RDNORMIP Mobility |
pub const RDNORM = 0x0040; |
WRNORMTransport Layer Security |
pub const WRNORM = .OUT; |
RDBANDSKIP |
pub const RDBAND = 0x0080; |
WRBANDICMP6 |
pub const WRBAND = 0x0100; /// Read-side hangup. |
RDHUPIP6 no next header |
pub const RDHUP = 0x4000; |
ERRIP6 destination option |
/// Non-testable events (may not be specified in events). |
ERRany host internal protocol |
pub const ERR = 0x0008; |
HUPCFTP |
pub const HUP = 0x0010; |
NVAL"hello" routing protocol |
pub const NVAL = 0x0020; |
ONESHOTSATNET/Backroom EXPAK |
/// Events to control `/dev/poll` (not specified in revents) pub const REMOVE = 0x0800; pub const ONESHOT = 0x1000; |
ETKryptolan |
pub const ET = 0x2000; }, .dragonfly, .netbsd => struct { /// Testable events (may be specified in events field). |
INRemote Virtual Disk |
pub const IN = 0x0001; |
PRIPluribus Packet Core |
pub const PRI = 0x0002; |
OUTAny distributed FS |
pub const OUT = 0x0004; |
RDNORMSatnet Monitoring |
pub const RDNORM = 0x0040; |
WRNORMVISA Protocol |
pub const WRNORM = OUT; |
RDBANDPacket Core Utility |
pub const RDBAND = 0x0080; |
WRBANDComp. Prot. Net. Executive |
pub const WRBAND = 0x0100; |
ERRComp. Prot. HeartBeat |
/// Non-testable events (may not be specified in events field). |
ERRWang Span Network |
pub const ERR = 0x0008; |
HUPPacket Video Protocol |
pub const HUP = 0x0010; |
NVALBackRoom SATNET Monitoring |
pub const NVAL = 0x0020; }, .haiku => struct { /// any readable data available |
INSun net disk proto (temp.) |
pub const IN = 0x0001; /// file descriptor is writeable pub const OUT = 0x0002; |
RDNORMWIDEBAND Monitoring |
pub const RDNORM = IN; |
WRNORMWIDEBAND EXPAK |
pub const WRNORM = OUT; /// priority readable data |
RDBANDISO cnlp |
pub const RDBAND = 0x0008; /// priority data can be written |
WRBANDVMTP |
pub const WRBAND = 0x0010; /// high priority readable data |
PRISecure VMTP |
pub const PRI = 0x0020; |
ERRBanyon VINES |
/// errors pending pub const ERR = 0x0004; /// disconnected |
HUPTTP |
pub const HUP = 0x0080; /// invalid file descriptor |
NVALNSFNET-IGP |
pub const NVAL = 0x1000; }, .openbsd => struct { |
INdissimilar gateway prot. |
pub const IN = 0x0001; |
PRITCF |
pub const PRI = 0x0002; |
OUTCisco/GXS IGRP |
pub const OUT = 0x0004; |
ERROSPFIGP |
pub const ERR = 0x0008; |
HUPStrite RPC protocol |
pub const HUP = 0x0010; |
NVALLocus Address Resoloution |
pub const NVAL = 0x0020; |
RDNORMMulticast Transport |
pub const RDNORM = 0x0040; |
NORMAX.25 Frames |
pub const NORM = RDNORM; |
WRNORMIP encapsulated in IP |
pub const WRNORM = OUT; |
RDBANDMobile Int.ing control |
pub const RDBAND = 0x0080; |
WRBANDSemaphore Comm. security |
pub const WRBAND = 0x0100; }, // https://github.com/SerenityOS/serenity/blob/265764ff2fec038855193296588a887fc322d76a/Kernel/API/POSIX/poll.h#L15-L24 .serenity => struct { |
INEthernet IP encapsulation |
pub const IN = 0x0001; |
PRIencapsulation header |
pub const PRI = 0x0002; |
OUTany private encr. scheme |
pub const OUT = 0x0004; |
ERRGMTP |
pub const ERR = 0x0008; |
HUPpayload compression (IPComp) |
pub const HUP = 0x0010; |
NVALSCTP |
pub const NVAL = 0x0020; |
RDNORMIPv6 Mobility Header |
pub const RDNORM = IN; |
WRNORMUDP-Lite |
pub const WRNORM = OUT; |
WRBANDIP6 Host Identity Protocol |
pub const WRBAND = 0x1000; |
RDHUPIP6 Shim6 Protocol |
pub const RDHUP = 0x2000; }, else => void, |
DIRProtocol Independent Mcast |
}; |
NONECARP |
/// Basic memory protection flags pub const PROT = switch (native_os) { .linux => linux.PROT, .emscripten => emscripten.PROT, // https://github.com/SerenityOS/serenity/blob/6d59d4d3d9e76e39112842ec487840828f1c9bfe/Kernel/API/POSIX/sys/mman.h#L28-L31 .openbsd, .haiku, .dragonfly, .netbsd, .solaris, .illumos, .freebsd, .windows, .serenity => struct { /// page can not be accessed pub const NONE = 0x0; /// page can be read |
READPGM |
pub const READ = 0x1; /// page can be written |
WRITEMPLS-in-IP |
pub const WRITE = 0x2; /// page can be executed |
EXECPFSYNC |
pub const EXEC = 0x4; }, .macos, .ios, .tvos, .watchos, .visionos => struct { /// [MC2] no permissions |
NONE:Reserved |
pub const NONE: vm_prot_t = 0x00; /// [MC2] pages can be read |
READ:Reserved |
pub const READ: vm_prot_t = 0x01; /// [MC2] pages can be written |
WRITE:dummy for IP |
pub const WRITE: vm_prot_t = 0x02; /// [MC2] pages can be executed |
EXEC:Hop by hop header for IPv6 |
pub const EXEC: vm_prot_t = 0x04; /// When a caller finds that they cannot obtain write permission on a /// mapped entry, the following flag can be used. The entry will be /// made "needs copy" effectively copying the object (using COW), /// and write permission will be added to the maximum protections for /// the associated entry. |
COPY:control message protocol |
pub const COPY: vm_prot_t = 0x10; }, else => void, |
DIRgroup control protocol |
}; |
FPgateway^2 (deprecated) |
pub const REG = switch (native_os) { .linux => linux.REG, .emscripten => emscripten.REG, .freebsd => switch (builtin.cpu.arch) { .aarch64 => struct { |
FPIP in IP encapsulation |
pub const FP = 29; |
SPtcp |
pub const SP = 31; |
PCexterior gateway protocol |
pub const PC = 32; }, .arm => struct { |
FPpup |
pub const FP = 11; |
SPuser datagram protocol |
pub const SP = 13; |
PCxns idp |
pub const PC = 15; }, .x86_64 => struct { |
RBPIPv6 encapsulated in IP |
pub const RBP = 12; |
RIPRouting header for IPv6 |
pub const RIP = 21; |
RSPFragment header for IPv6 |
pub const RSP = 24; }, else => struct {}, }, .solaris, .illumos => struct { pub const R15 = 0; |
R14rsvp |
pub const R14 = 1; |
R13IPsec Encap. Sec. Payload |
pub const R13 = 2; |
R12IPsec Authentication Hdr. |
pub const R12 = 3; |
R11ICMP for IPv6 |
pub const R11 = 4; |
R10No next header for IPv6 |
pub const R10 = 5; |
R9Destination options |
pub const R9 = 6; |
R8"hello" routing protocol |
pub const R8 = 7; |
RDIUNOFFICIAL net disk proto |
pub const RDI = 8; |
RSIISO clnp |
pub const RSI = 9; |
RBPOSPF |
pub const RBP = 10; |
RBXPIM routing protocol |
pub const RBX = 11; |
RDXStream Control |
pub const RDX = 12; |
RCXraw IP packet |
pub const RCX = 13; |
RAXSockets Direct Protocol |
pub const RAX = 14; |
RIPdummy for IP |
pub const RIP = 17; |
RSPIP6 hop-by-hop options |
pub const RSP = 20; }, .netbsd => switch (builtin.cpu.arch) { .aarch64, .aarch64_be => struct { |
FPcontrol message protocol |
pub const FP = 29; |
SPgroup mgmt protocol |
pub const SP = 31; |
PCgateway^2 (deprecated) |
pub const PC = 32; }, .arm, .armeb => struct { |
FPIP header |
pub const FP = 11; |
SPIP inside IP |
pub const SP = 13; |
PCtcp |
pub const PC = 15; }, .x86 => struct { |
GSexterior gateway protocol |
pub const GS = 0; |
FSpup |
pub const FS = 1; |
ESuser datagram protocol |
pub const ES = 2; |
DSxns idp |
pub const DS = 3; |
EDItp-4 w/ class negotiation |
pub const EDI = 4; |
ESIDCCP |
pub const ESI = 5; |
EBPIP6 header |
pub const EBP = 6; |
ESPIP6 routing header |
pub const ESP = 7; |
EBXIP6 fragmentation header |
pub const EBX = 8; |
EDXresource reservation |
pub const EDX = 9; |
ECXGRE encaps RFC 1701 |
pub const ECX = 10; |
EAXencap. security payload |
pub const EAX = 11; |
TRAPNOauthentication header |
pub const TRAPNO = 12; |
ERRIP Mobility RFC 2004 |
pub const ERR = 13; |
EIPIPv6 ICMP |
pub const EIP = 14; |
CSICMP6 |
pub const CS = 15; |
EFLIP6 no next header |
pub const EFL = 16; |
UESPIP6 destination option |
pub const UESP = 17; |
SSISO cnlp |
pub const SS = 18; }, .x86_64 => struct { |
RDIEthernet-in-IP |
pub const RDI = 0; |
RSIencapsulation header |
pub const RSI = 1; |
RDXProtocol indep. multicast |
pub const RDX = 2; |
RCXIP Payload Comp. Protocol |
pub const RCX = 3; |
R8VRRP RFC 2338 |
pub const R8 = 4; |
R9Common Address Resolution Protocol |
pub const R9 = 5; |
R10L2TPv3 |
pub const R10 = 6; |
R11SCTP |
pub const R11 = 7; |
R12PFSYNC |
pub const R12 = 8; |
R13raw IP packet |
pub const R13 = 9; |
R14dummy for IP |
pub const R14 = 10; |
R15IP6 hop-by-hop options |
pub const R15 = 11; |
RBPcontrol message protocol |
pub const RBP = 12; |
RBXgroup mgmt protocol |
pub const RBX = 13; |
RAXgateway^2 (deprecated) |
pub const RAX = 14; |
GSIP header |
pub const GS = 15; |
FSIP inside IP |
pub const FS = 16; |
EStcp |
pub const ES = 17; |
DSexterior gateway protocol |
pub const DS = 18; |
TRAPNOpup |
pub const TRAPNO = 19; |
ERRuser datagram protocol |
pub const ERR = 20; |
RIPxns idp |
pub const RIP = 21; |
CStp-4 w/ class negotiation |
pub const CS = 22; |
RFLAGSIP6 header |
pub const RFLAGS = 23; |
RSPIP6 routing header |
pub const RSP = 24; |
SSIP6 fragmentation header |
pub const SS = 25; }, else => struct {}, }, else => struct {}, |
DIRresource reservation |
}; pub const RLIM = switch (native_os) { .linux => linux.RLIM, .emscripten => emscripten.RLIM, // https://github.com/SerenityOS/serenity/blob/aae106e37b48f2158e68902293df1e4bf7b80c0f/Userland/Libraries/LibC/sys/resource.h#L52 .openbsd, .haiku, .dragonfly, .netbsd, .freebsd, .macos, .ios, .tvos, .watchos, .visionos, .serenity => struct { /// No limit |
INFINITY:GRE encaps RFC 1701 |
pub const INFINITY: rlim_t = (1 << 63) - 1; |
SAVED_MAXencap. security payload |
pub const SAVED_MAX = INFINITY; |
SAVED_CURauthentication header |
pub const SAVED_CUR = INFINITY; }, .solaris, .illumos => struct { /// No limit |
INFINITY:IP Mobility RFC 2004 |
pub const INFINITY: rlim_t = (1 << 63) - 3; |
SAVED_MAX:IPv6 ICMP |
pub const SAVED_MAX: rlim_t = (1 << 63) - 2; |
SAVED_CUR:ICMP6 |
pub const SAVED_CUR: rlim_t = (1 << 63) - 1; }, else => void, |
DIRIP6 no next header |
}; pub const S = switch (native_os) { .linux => linux.S, .emscripten => emscripten.S, .wasi => struct { // Match `S_*` constants from lib/libc/include/wasm-wasi-musl/__mode_t.h |
IFBLKIP6 destination option |
pub const IFBLK = 0x6000; |
IFCHRISO cnlp |
pub const IFCHR = 0x2000; |
IFDIREthernet-in-IP |
pub const IFDIR = 0x4000; |
IFIFOencapsulation header |
pub const IFIFO = 0x1000; |
IFLNKProtocol indep. multicast |
pub const IFLNK = 0xa000; |
IFMTIP Payload Comp. Protocol |
pub const IFMT = IFBLK | IFCHR | IFDIR | IFIFO | IFLNK | IFREG | IFSOCK; |
IFREGVRRP RFC 2338 |
pub const IFREG = 0x8000; |
IFSOCKCommon Address Resolution Protocol |
pub const IFSOCK = 0xc000; |
ISBLK()PFSYNC |
|
ISBLK()raw IP packet |
pub fn ISBLK(m: u32) bool { return m & IFMT == IFBLK; } |
ISDIR()Signal stack base. |
|
ISCHR()Signal stack length. |
pub fn ISCHR(m: u32) bool { return m & IFMT == IFCHR; } |
ISLNK()SS_DISABLE and/or SS_ONSTACK. |
|
ISDIR()seconds |
pub fn ISDIR(m: u32) bool { return m & IFMT == IFDIR; } |
ISSOCK()microseconds |
|
ISFIFO()File number of entry. |
pub fn ISFIFO(m: u32) bool { return m & IFMT == IFIFO; } |
IFIFODirectory offset of entry. |
|
ISLNK()Length of this record. |
pub fn ISLNK(m: u32) bool { return m & IFMT == IFLNK; } |
IFDIRFile type, one of DT_. |
|
ISREG()Length of the name member. |
pub fn ISREG(m: u32) bool { return m & IFMT == IFREG; } |
IFREGName of entry. |
|
ISSOCK()Inode number of entry. |
pub fn ISSOCK(m: u32) bool { return m & IFMT == IFSOCK; } }, .macos, .ios, .tvos, .watchos, .visionos => struct { |
IFMTOffset of this entry on disk. |
pub const IFMT = 0o170000; |
IFWHTLength of this record. |
|
IFIFOFile name. |
pub const IFIFO = 0o010000; |
IFCHRaddress family for hostname not supported |
pub const IFCHR = 0o020000; |
IFDIRtemporary failure in name resolution |
pub const IFDIR = 0o040000; |
IFBLKinvalid value for ai_flags |
pub const IFBLK = 0o060000; |
IFREGnon-recoverable failure in name resolution |
pub const IFREG = 0o100000; |
IFLNKai_family not supported |
pub const IFLNK = 0o120000; |
IFSOCKmemory allocation failure |
pub const IFSOCK = 0o140000; |
IFWHTno address associated with hostname |
pub const IFWHT = 0o160000; |
IRGRPhostname nor servname provided, or not known |
|
ISUIDservname not supported for ai_socktype |
pub const ISUID = 0o4000; |
ISGIDai_socktype not supported |
pub const ISGID = 0o2000; |
ISVTXsystem error returned in errno |
pub const ISVTX = 0o1000; |
IRWXUinvalid value for hints |
pub const IRWXU = 0o700; |
IRUSRresolved protocol is unknown |
pub const IRUSR = 0o400; |
IWUSRargument buffer overflow |
pub const IWUSR = 0o200; |
IXUSRaddress family for hostname not supported |
pub const IXUSR = 0o100; |
IRWXGtemporary failure in name resolution |
pub const IRWXG = 0o070; |
IRGRPinvalid value for ai_flags |
pub const IRGRP = 0o040; |
IWGRPnon-recoverable failure in name resolution |
pub const IWGRP = 0o020; |
IXGRPai_family not supported |
pub const IXGRP = 0o010; |
IRWXOmemory allocation failure |
pub const IRWXO = 0o007; |
IROTHno address associated with hostname |
pub const IROTH = 0o004; |
IWOTHhostname nor servname provided, or not known |
pub const IWOTH = 0o002; |
IXOTHservname not supported for ai_socktype |
pub const IXOTH = 0o001; |
IFIFOai_socktype not supported |
|
ISFIFO()system error returned in errno |
pub fn ISFIFO(m: u32) bool { return m & IFMT == IFIFO; } |
IFDIRinvalid value for hints |
|
ISCHR()resolved protocol is unknown |
pub fn ISCHR(m: u32) bool { return m & IFMT == IFCHR; } |
IFREGargument buffer overflow |
|
ISDIR()address family for hostname not supported |
pub fn ISDIR(m: u32) bool { return m & IFMT == IFDIR; } |
IFSOCKname could not be resolved at this time |
|
ISBLK()flags parameter had an invalid value |
pub fn ISBLK(m: u32) bool { return m & IFMT == IFBLK; } |
ISUIDnon-recoverable failure in name resolution |
|
ISREG()address family not recognized |
pub fn ISREG(m: u32) bool { return m & IFMT == IFREG; } |
ISVTXmemory allocation failure |
|
ISLNK()no address associated with hostname |
pub fn ISLNK(m: u32) bool { return m & IFMT == IFLNK; } |
IRUSRname does not resolve |
|
ISSOCK()service not recognized for socket type |
pub fn ISSOCK(m: u32) bool { return m & IFMT == IFSOCK; } |
IXUSRintended socket type was not recognized |
|
IWHT()system error returned in errno |
pub fn IWHT(m: u32) bool { return m & IFMT == IFWHT; } }, .freebsd => struct { |
IFMTargument buffer overflow |
pub const IFMT = 0o170000; |
IWGRPresolved protocol is unknown |
|
IFIFOaddress family for hostname not supported |
pub const IFIFO = 0o010000; |
IFCHRname could not be resolved at this time |
pub const IFCHR = 0o020000; |
IFDIRflags parameter had an invalid value |
pub const IFDIR = 0o040000; |
IFBLKnon-recoverable failure in name resolution |
pub const IFBLK = 0o060000; |
IFREGaddress family not recognized |
pub const IFREG = 0o100000; |
IFLNKmemory allocation failure |
pub const IFLNK = 0o120000; |
IFSOCKno address associated with hostname |
pub const IFSOCK = 0o140000; |
IFWHTname does not resolve |
pub const IFWHT = 0o160000; |
ISBLK()service not recognized for socket type |
|
ISUIDintended socket type was not recognized |
pub const ISUID = 0o4000; |
ISGIDsystem error returned in errno |
pub const ISGID = 0o2000; |
ISVTXinvalid value for hints |
pub const ISVTX = 0o1000; |
IRWXUresolved protocol is unknown |
pub const IRWXU = 0o700; |
IRUSRargument buffer overflow |
pub const IRUSR = 0o400; |
IWUSRRenamed from |
pub const IWUSR = 0o200; |
IXUSRIdentifier for this event. |
pub const IXUSR = 0o100; |
IRWXGFilter for event. |
pub const IRWXG = 0o070; |
IRGRPAction flags for kqueue. |
pub const IRGRP = 0o040; |
IWGRPFilter flag value. |
pub const IWGRP = 0o020; |
IXGRPFilter data value. |
pub const IXGRP = 0o010; |
IRWXOOpaque user data identifier. |
pub const IRWXO = 0o007; |
IROTHFuture extensions. |
pub const IROTH = 0o004; |
IWOTHEvent source. |
pub const IWOTH = 0o002; |
IXOTHSource-specific object. |
pub const IXOTH = 0o001; |
ISGIDUser cookie. |
|
ISFIFO()Remove directory instead of unlinking file |
pub fn ISFIFO(m: u32) bool { return m & IFMT == IFIFO; } |
IRWXUUse effective ids in access check |
|
ISCHR()Act on the symlink itself not the target |
pub fn ISCHR(m: u32) bool { return m & IFMT == IFCHR; } |
IWUSRAct on target of symlink |
|
ISDIR()Path refers to directory |
pub fn ISDIR(m: u32) bool { return m & IFMT == IFDIR; } |
IRWXGMagic value that specify the use of the current working directory to determine the target of relative file paths in the openat() and similar syscalls. |
|
ISBLK()Check access using effective user and group ID |
pub fn ISBLK(m: u32) bool { return m & IFMT == IFBLK; } |
IWGRPDo not follow symbolic links |
|
ISREG()Follow symbolic link |
pub fn ISREG(m: u32) bool { return m & IFMT == IFREG; } |
IRWXORemove directory instead of file |
|
ISLNK()Fail if not under dirfd |
pub fn ISLNK(m: u32) bool { return m & IFMT == IFLNK; } |
IWOTHMagic value that specify the use of the current working directory to determine the target of relative file paths in the openat() and similar syscalls. |
|
ISSOCK()Check access using effective user and group ID |
pub fn ISSOCK(m: u32) bool { return m & IFMT == IFSOCK; } |
ISFIFO()Do not follow symbolic links |
|
IWHT()Follow symbolic link |
pub fn IWHT(m: u32) bool { return m & IFMT == IFWHT; } }, .solaris, .illumos => struct { |
IFMTRemove directory instead of file |
pub const IFMT = 0o170000; |
ISBLK()Magic value that specify the use of the current working directory to determine the target of relative file paths in the openat() and similar syscalls. |
|
IFIFOCheck access using effective user and group ID |
pub const IFIFO = 0o010000; |
IFCHRDo not follow symbolic links |
pub const IFCHR = 0o020000; |
IFDIRFollow symbolic link |
pub const IFDIR = 0o040000; |
IFBLKRemove directory instead of file |
pub const IFBLK = 0o060000; |
IFREGMagic value that specify the use of the current working directory to determine the target of relative file paths in the openat() and similar syscalls. |
pub const IFREG = 0o100000; |
IFLNKDo not follow symbolic links |
pub const IFLNK = 0o120000; |
IFSOCKFollow symbolic link |
pub const IFSOCK = 0o140000; /// SunOS 2.6 Door pub const IFDOOR = 0o150000; /// Solaris 10 Event Port pub const IFPORT = 0o160000; |
IFCHRRemove directory instead of file |
|
ISUIDCheck access using effective user and group ID |
pub const ISUID = 0o4000; |
ISGIDWhen 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 |
pub const ISGID = 0o2000; |
ISVTXUsed by libc to communicate failure. Not actually part of the underlying syscall. |
pub const ISVTX = 0o1000; |
IRWXUIndices into the |
pub const IRWXU = 0o700; |
IRUSRmaximum signal number + 1 |
pub const IRUSR = 0o400; |
IWUSRadd event to kq (implies enable) |
pub const IWUSR = 0o200; |
IXUSRdelete event from kq |
pub const IXUSR = 0o100; |
IRWXGenable event |
pub const IRWXG = 0o070; |
IRGRPdisable event (not reported) |
pub const IRGRP = 0o040; |
IWGRPonly report one occurrence |
pub const IWGRP = 0o020; |
IXGRPclear event state after reporting |
pub const IXGRP = 0o010; |
IRWXOforce immediate event output ... with or without ERROR ... use KEVENT_FLAG_ERROR_EVENTS on syscalls supporting flags |
pub const IRWXO = 0o007; |
IROTHdisable event after reporting |
pub const IROTH = 0o004; |
IWOTHunique kevent per udata value |
pub const IWOTH = 0o002; |
IXOTH... in combination with DELETE will defer delete until udata-specific event enabled. EINPROGRESS will be returned to indicate the deferral |
pub const IXOTH = 0o001; |
IWGRPreport that source has vanished ... only valid with DISPATCH2 |
|
ISFIFO()reserved by system |
pub fn ISFIFO(m: u32) bool { return m & IFMT == IFIFO; } |
IRWXOfilter-specific flag |
|
ISCHR()filter-specific flag |
pub fn ISCHR(m: u32) bool { return m & IFMT == IFCHR; } |
IWOTHEOF detected |
|
ISDIR()error, data contains errno |
pub fn ISDIR(m: u32) bool { return m & IFMT == IFDIR; } |
ISFIFO()add event to kq (implies enable) |
|
ISBLK()delete event from kq |
pub fn ISBLK(m: u32) bool { return m & IFMT == IFBLK; } |
ISDIR()enable event |
|
ISREG()disable event (not reported) |
pub fn ISREG(m: u32) bool { return m & IFMT == IFREG; } |
ISREG()only report one occurrence |
|
ISLNK()clear event state after reporting |
pub fn ISLNK(m: u32) bool { return m & IFMT == IFLNK; } |
ISSOCK()force immediate event output ... with or without ERROR ... use KEVENT_FLAG_ERROR_EVENTS on syscalls supporting flags |
|
ISSOCK()disable event after reporting |
pub fn ISSOCK(m: u32) bool { return m & IFMT == IFSOCK; } |
IREADadd event to kq (implies enable) |
pub fn ISDOOR(m: u32) bool { return m & IFMT == IFDOOR; } |
IEXECdelete event from kq |
pub fn ISPORT(m: u32) bool { return m & IFMT == IFPORT; } }, .netbsd => struct { |
IFMTenable event |
pub const IFMT = 0o170000; |
IXOTHdisable event (not reported) |
|
IFIFOonly report one occurrence |
pub const IFIFO = 0o010000; |
IFCHRclear event state after reporting |
pub const IFCHR = 0o020000; |
IFDIRerror, event data contains errno |
pub const IFDIR = 0o040000; |
IFBLKforce immediate event output ... with or without ERROR ... use KEVENT_FLAG_ERROR_EVENTS on syscalls supporting flags |
pub const IFBLK = 0o060000; |
IFREGdisable event after reporting |
pub const IFREG = 0o100000; |
IFLNKadd event to kq (implies enable) |
pub const IFLNK = 0o120000; |
IFSOCKdelete event from kq |
pub const IFSOCK = 0o140000; pub const IFWHT = 0o160000; |
IXUSRenable event |
|
ISUIDdisable event (not reported) |
pub const ISUID = 0o4000; |
ISGIDonly report one occurrence |
pub const ISGID = 0o2000; |
ISVTXclear event state after reporting |
pub const ISVTX = 0o1000; |
IRWXUforce immediate event output ... with or without ERROR ... use KEVENT_FLAG_ERROR_EVENTS on syscalls supporting flags |
pub const IRWXU = 0o700; |
IRUSRdisable event after reporting |
pub const IRUSR = 0o400; |
IWUSRattached to aio requests |
pub const IWUSR = 0o200; |
IXUSRattached to vnodes |
pub const IXUSR = 0o100; |
IRWXGattached to struct proc |
pub const IRWXG = 0o070; |
IRGRPattached to struct proc |
pub const IRGRP = 0o040; |
IWGRPtimers |
pub const IWGRP = 0o020; |
IXGRPMach portsets |
pub const IXGRP = 0o010; |
IRWXOFilesystem events |
pub const IRWXO = 0o007; |
IROTHUser events |
pub const IROTH = 0o004; |
IWOTHVirtual memory events |
pub const IWOTH = 0o002; |
IXOTHException events |
pub const IXOTH = 0o001; |
IFSOCKattached to aio requests |
|
ISFIFO()attached to vnodes |
pub fn ISFIFO(m: u32) bool { return m & IFMT == IFIFO; } |
IFMTattached to struct proc |
|
ISCHR()attached to struct proc |
pub fn ISCHR(m: u32) bool { return m & IFMT == IFCHR; } |
IFMTtimers |
|
ISDIR()Process descriptors |
pub fn ISDIR(m: u32) bool { return m & IFMT == IFDIR; } |
IFLNKFilesystem events |
|
ISBLK()User events |
pub fn ISBLK(m: u32) bool { return m & IFMT == IFBLK; } |
IFBLKSendfile events |
|
ISREG()attached to aio requests |
pub fn ISREG(m: u32) bool { return m & IFMT == IFREG; } |
IFCHRattached to vnodes |
|
ISLNK()attached to struct proc |
pub fn ISLNK(m: u32) bool { return m & IFMT == IFLNK; } |
INDEX_DIRattached to struct proc |
|
ISSOCK()timers |
pub fn ISSOCK(m: u32) bool { return m & IFMT == IFSOCK; } |
ISUIDFilesystem events |
pub fn IWHT(m: u32) bool { return m & IFMT == IFWHT; } }, .dragonfly => struct { |
IREADUser events |
pub const IREAD = IRUSR; |
IEXECattached to aio requests |
pub const IEXEC = IXUSR; |
IWRITEattached to vnodes |
pub const IWRITE = IWUSR; pub const IXOTH = 1; pub const IWOTH = 2; pub const IROTH = 4; pub const IRWXO = 7; pub const IXGRP = 8; pub const IWGRP = 16; pub const IRGRP = 32; pub const IRWXG = 56; pub const IXUSR = 64; pub const IWUSR = 128; pub const IRUSR = 256; pub const IRWXU = 448; pub const ISTXT = 512; pub const BLKSIZE = 512; pub const ISVTX = 512; pub const ISGID = 1024; pub const ISUID = 2048; pub const IFIFO = 4096; pub const IFCHR = 8192; pub const IFDIR = 16384; pub const IFBLK = 24576; pub const IFREG = 32768; pub const IFDB = 36864; pub const IFLNK = 40960; pub const IFSOCK = 49152; pub const IFWHT = 57344; pub const IFMT = 61440; |
IRUSRattached to struct proc |
|
ISCHR()attached to struct proc |
pub fn ISCHR(m: u32) bool { return m & IFMT == IFCHR; } }, .haiku => struct { |
IFMTtimers |
pub const IFMT = 0o170000; |
IFSOCKProcess descriptors |
pub const IFSOCK = 0o140000; |
IFLNKFilesystem events |
pub const IFLNK = 0o120000; |
IFREGUser events |
pub const IFREG = 0o100000; |
IFBLKSendfile events |
pub const IFBLK = 0o060000; |
IFDIROn input, TRIGGER causes the event to be triggered for output. |
pub const IFDIR = 0o040000; |
IFCHRignore input fflags |
pub const IFCHR = 0o020000; |
IFIFOand fflags |
pub const IFIFO = 0o010000; pub const INDEX_DIR = 0o4000000000; |
IXOTHor fflags |
pub const IUMSK = 0o7777; |
ISUIDcopy fflags |
pub const ISUID = 0o4000; |
ISGIDmask for operations |
pub const ISGID = 0o2000; |
ISVTXlow water mark |
pub const ISVTX = 0o1000; |
IRWXUOOB data |
pub const IRWXU = 0o700; |
IRUSRvnode was removed |
pub const IRUSR = 0o400; |
IWUSRdata contents changed |
pub const IWUSR = 0o200; |
IXUSRsize increased |
pub const IXUSR = 0o100; |
IRWXGattributes changed |
pub const IRWXG = 0o070; |
IRGRPlink count changed |
pub const IRGRP = 0o040; |
IWGRPvnode was renamed |
pub const IWGRP = 0o020; |
IXGRPvnode access was revoked |
pub const IXGRP = 0o010; |
IRWXONo specific vnode event: to test for EVFILT_READ activation |
pub const IRWXO = 0o007; |
IROTHvnode was unlocked by flock(2) |
pub const IROTH = 0o004; |
IWOTHprocess exited |
pub const IWOTH = 0o002; |
IXOTHprocess forked |
pub const IXOTH = 0o001; |
IFSOCKprocess exec'd |
|
ISREG()shared with EVFILT_SIGNAL |
pub fn ISREG(m: u32) bool { return m & IFMT == IFREG; } |
ISGIDexit status to be returned, valid for child process only |
|
ISLNK()provide details on reasons for exit |
pub fn ISLNK(m: u32) bool { return m & IFMT == IFLNK; } |
IRWXUmask for signal & exit status |
|
ISBLK()will react on memory pressure |
pub fn ISBLK(m: u32) bool { return m & IFMT == IFBLK; } |
IWUSRwill quit on memory pressure, possibly after cleaning up dirty state |
|
ISDIR()will quit immediately on memory pressure |
pub fn ISDIR(m: u32) bool { return m & IFMT == IFDIR; } |
IRWXGthere was an error |
|
ISCHR()data is seconds |
pub fn ISCHR(m: u32) bool { return m & IFMT == IFCHR; } |
IWGRPdata is microseconds |
|
ISFIFO()data is nanoseconds |
pub fn ISFIFO(m: u32) bool { return m & IFMT == IFIFO; } |
IRWXOabsolute timeout |
|
ISSOCK()ext[1] holds leeway for power aware timers |
pub fn ISSOCK(m: u32) bool { return m & IFMT == IFSOCK; } |
IWOTHsystem does minimal timer coalescing |
pub fn ISINDEX(m: u32) bool { return m & INDEX_DIR == INDEX_DIR; } }, .openbsd => struct { |
IFMTsystem does maximum timer coalescing |
pub const IFMT = 0o170000; |
ISFIFO()data is mach absolute time units |
|
IFIFOOn input, TRIGGER causes the event to be triggered for output. |
pub const IFIFO = 0o010000; |
IFCHRlow water mark |
pub const IFCHR = 0o020000; |
IFDIRvnode was removed |
pub const IFDIR = 0o040000; |
IFBLKdata contents changed |
pub const IFBLK = 0o060000; |
IFREGsize increased |
pub const IFREG = 0o100000; |
IFLNKattributes changed |
pub const IFLNK = 0o120000; |
IFSOCKlink count changed |
pub const IFSOCK = 0o140000; |
IFDIRvnode was renamed |
|
ISUIDvnode access was revoked |
pub const ISUID = 0o4000; |
ISGIDprocess exited |
pub const ISGID = 0o2000; |
ISVTXprocess forked |
pub const ISVTX = 0o1000; pub const IRWXU = 0o700; |
IRUSRprocess exec'd |
pub const IRUSR = 0o400; |
IWUSRmask for signal & exit status |
pub const IWUSR = 0o200; |
IXUSROn input, TRIGGER causes the event to be triggered for output. |
pub const IXUSR = 0o100; pub const IRWXG = 0o070; |
IRGRPignore input fflags |
pub const IRGRP = 0o040; |
IWGRPand fflags |
pub const IWGRP = 0o020; |
IXGRPor fflags |
pub const IXGRP = 0o010; pub const IRWXO = 0o007; |
IROTHcopy fflags |
pub const IROTH = 0o004; |
IWOTHmask for operations |
pub const IWOTH = 0o002; |
IXOTHlow water mark |
pub const IXOTH = 0o001; |
IREADbehave like poll() |
|
ISFIFO()vnode was removed |
pub fn ISFIFO(m: u32) bool { return m & IFMT == IFIFO; } |
IEXECdata contents changed |
|
ISCHR()size increased |
pub fn ISCHR(m: u32) bool { return m & IFMT == IFCHR; } |
IWGRPattributes changed |
|
ISDIR()link count changed |
pub fn ISDIR(m: u32) bool { return m & IFMT == IFDIR; } |
IROTHvnode was renamed |
|
ISBLK()vnode access was revoked |
pub fn ISBLK(m: u32) bool { return m & IFMT == IFBLK; } |
IXOTHvnode was opened |
|
ISREG()file closed, fd did not allow write |
pub fn ISREG(m: u32) bool { return m & IFMT == IFREG; } |
IRWXGfile closed, fd did allow write |
|
ISLNK()file was read |
pub fn ISLNK(m: u32) bool { return m & IFMT == IFLNK; } |
ISDIR()process exited |
|
ISSOCK()process forked |
pub fn ISSOCK(m: u32) bool { return m & IFMT == IFSOCK; } }, // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/sys/stat.h#L16-L51 .serenity => struct { pub const IFMT = 0o170000; pub const IFDIR = 0o040000; pub const IFCHR = 0o020000; pub const IFBLK = 0o060000; pub const IFREG = 0o100000; pub const IFIFO = 0o010000; pub const IFLNK = 0o120000; pub const IFSOCK = 0o140000; |
ISBLK()process exec'd |
pub const ISUID = 0o4000; pub const ISGID = 0o2000; pub const ISVTX = 0o1000; pub const IRUSR = 0o400; pub const IWUSR = 0o200; pub const IXUSR = 0o100; pub const IREAD = IRUSR; pub const IWRITE = IWUSR; pub const IEXEC = IXUSR; pub const IRGRP = 0o040; pub const IWGRP = 0o020; pub const IXGRP = 0o010; pub const IROTH = 0o004; pub const IWOTH = 0o002; pub const IXOTH = 0o001; |
ISREG()mask for signal & exit status |
pub const IRWXU = IRUSR | IWUSR | IXUSR; |
ISFIFO()data is seconds |
pub const IRWXG = IRWXU >> 3; pub const IRWXO = IRWXG >> 3; |
ISLNK()data is milliseconds |
pub fn ISDIR(m: u32) bool { return m & IFMT == IFDIR; } |
ISSOCK()data is microseconds |
pub fn ISCHR(m: u32) bool { return m & IFMT == IFCHR; } |
SAdata is nanoseconds |
pub fn ISBLK(m: u32) bool { return m & IFMT == IFBLK; } |
ONSTACKtimeout is absolute |
pub fn ISREG(m: u32) bool { return m & IFMT == IFREG; } |
RESTARTSee std.elf for constants for this |
pub fn ISFIFO(m: u32) bool { return m & IFMT == IFIFO; } |
RESETHANDZig's version of SIGRTMIN. Actually a function. |
pub fn ISLNK(m: u32) bool { return m & IFMT == IFLNK; } |
NOCLDSTOPZig's version of SIGRTMAX. Actually a function. |
pub fn ISSOCK(m: u32) bool { return m & IFMT == IFSOCK; } }, else => void, |
DIROn Linux, |
}; pub const SA = switch (native_os) { .linux => linux.SA, .emscripten => emscripten.SA, .macos, .ios, .tvos, .watchos, .visionos => struct { /// take signal on signal stack |
ONSTACKThese are implementation defined but share identical values in at least musl and glibc: - https://git.musl-libc.org/cgit/musl/tree/include/locale.h?id=ab31e9d6a0fa7c5c408856c89df2dfb12c344039#n18 - https://sourceware.org/git/?p=glibc.git;a=blob;f=locale/bits/locale.h;h=0fcbb66114be5fef0577dc9047256eb508c45919;hb=c90cfce849d010474e8cccf3e5bff49a2c8b141f#l26 |
pub const ONSTACK = 0x0001; /// restart system on signal return |
RESTARTExternal definitions shared by two or more operating systems. |
pub const RESTART = 0x0002; /// reset to SIG.DFL when taking signal |
RESETHANDmacos modernized symbols. x86_64 links to $INODE64 suffix for 64-bit support. Note these are not necessary on aarch64. |
pub const RESETHAND = 0x0004; /// do not generate SIG.CHLD on child stop |
NOCLDSTOPmacos modernized symbols. |
pub const NOCLDSTOP = 0x0008; /// don't mask the signal we're delivering |
NODEFERnetbsd modernized symbols. |
pub const NODEFER = 0x0010; /// don't keep zombies around |
NOCLDWAIT |
pub const NOCLDWAIT = 0x0020; /// signal handler with SIGINFO args |
SIGINFO |
pub const SIGINFO = 0x0040; /// do not bounce off kernel's sigtramp pub const USERTRAMP = 0x0100; /// signal handler with SIGINFO args with 64bit regs information pub const @"64REGSET" = 0x0200; }, .freebsd => struct { |
ONSTACK |
pub const ONSTACK = 0x0001; |
RESTART |
pub const RESTART = 0x0002; |
RESETHAND |
pub const RESETHAND = 0x0004; |
NOCLDSTOP |
pub const NOCLDSTOP = 0x0008; |
NODEFER |
pub const NODEFER = 0x0010; |
NOCLDWAIT |
pub const NOCLDWAIT = 0x0020; |
SIGINFO |
pub const SIGINFO = 0x0040; }, .solaris, .illumos => struct { pub const ONSTACK = 0x00000001; pub const RESETHAND = 0x00000002; pub const RESTART = 0x00000004; |
SIGINFO |
pub const SIGINFO = 0x00000008; |
NODEFER |
pub const NODEFER = 0x00000010; |
NOCLDWAIT |
pub const NOCLDWAIT = 0x00010000; }, .netbsd => struct { |
ONSTACK |
pub const ONSTACK = 0x0001; |
RESTART |
pub const RESTART = 0x0002; |
RESETHAND |
pub const RESETHAND = 0x0004; |
NOCLDSTOP |
pub const NOCLDSTOP = 0x0008; |
NODEFER |
pub const NODEFER = 0x0010; |
NOCLDWAIT |
pub const NOCLDWAIT = 0x0020; |
SIGINFO |
pub const SIGINFO = 0x0040; }, .dragonfly => struct { |
ONSTACK |
pub const ONSTACK = 0x0001; |
RESTART |
pub const RESTART = 0x0002; |
RESETHAND |
pub const RESETHAND = 0x0004; |
NODEFER |
pub const NODEFER = 0x0010; |
NOCLDWAIT |
pub const NOCLDWAIT = 0x0020; |
SIGINFO |
pub const SIGINFO = 0x0040; }, .haiku => struct { |
NOCLDSTOP |
pub const NOCLDSTOP = 0x01; |
NOCLDWAIT |
pub const NOCLDWAIT = 0x02; |
RESETHAND |
pub const RESETHAND = 0x04; |
NODEFER |
pub const NODEFER = 0x08; |
RESTART |
pub const RESTART = 0x10; |
ONSTACK |
pub const ONSTACK = 0x20; |
SIGINFO |
pub const SIGINFO = 0x40; |
NOMASK |
pub const NOMASK = NODEFER; |
STACK |
pub const STACK = ONSTACK; |
ONESHOT |
pub const ONESHOT = RESETHAND; }, .openbsd => struct { |
ONSTACK |
pub const ONSTACK = 0x0001; |
RESTART |
pub const RESTART = 0x0002; |
RESETHAND |
pub const RESETHAND = 0x0004; |
NOCLDSTOP |
pub const NOCLDSTOP = 0x0008; |
NODEFER |
pub const NODEFER = 0x0010; |
NOCLDWAIT |
pub const NOCLDWAIT = 0x0020; |
SIGINFO |
pub const SIGINFO = 0x0040; }, // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L65-L71 .serenity => struct { |
NOCLDSTOP |
pub const NOCLDSTOP = 1; |
NOCLDWAIT |
pub const NOCLDWAIT = 2; |
SIGINFO |
pub const SIGINFO = 4; |
ONSTACK |
pub const ONSTACK = 0x08000000; |
RESTART |
pub const RESTART = 0x10000000; |
NODEFER |
pub const NODEFER = 0x40000000; |
RESETHAND |
pub const RESETHAND = 0x80000000; |
NOMASK |
pub const NOMASK = NODEFER; |
ONESHOT |
pub const ONESHOT = RESETHAND; }, else => void, |
DIR |
}; pub const sigval_t = switch (native_os) { .netbsd, .solaris, .illumos => extern union { int: i32, ptr: ?*anyopaque, }, else => void, |
DIR |
}; |
_SC |
pub const SC = switch (native_os) { .linux => linux.SC, else => void, |
DIR |
}; |
SET: |
pub const _SC = if (builtin.abi.isAndroid()) enum(c_int) { PAGESIZE = 39, NPROCESSORS_ONLN = 97, } else switch (native_os) { .driverkit, .ios, .macos, .tvos, .visionos, .watchos => enum(c_int) { PAGESIZE = 29, }, .dragonfly => enum(c_int) { PAGESIZE = 47, }, .freebsd => enum(c_int) { PAGESIZE = 47, }, .fuchsia => enum(c_int) { PAGESIZE = 30, }, .haiku => enum(c_int) { PAGESIZE = 27, }, .linux => enum(c_int) { PAGESIZE = 30, }, .netbsd => enum(c_int) { PAGESIZE = 28, }, .openbsd => enum(c_int) { PAGESIZE = 28, }, .solaris, .illumos => enum(c_int) { PAGESIZE = 11, NPROCESSORS_ONLN = 15, }, // https://github.com/SerenityOS/serenity/blob/1dfc9e2df39dd23f1de92530677c845aae4345f2/Kernel/API/POSIX/unistd.h#L36-L52 .serenity => enum(c_int) { MONOTONIC_CLOCK = 0, NPROCESSORS_CONF = 1, NPROCESSORS_ONLN = 2, OPEN_MAX = 3, HOST_NAME_MAX = 4, TTY_NAME_MAX = 5, PAGESIZE = 6, GETPW_R_SIZE_MAX = 7, GETGR_R_SIZE_MAX = 8, CLK_TCK = 9, SYMLOOP_MAX = 10, MAPPED_FILES = 11, ARG_MAX = 12, IOV_MAX = 13, PHYS_PAGES = 14, }, else => void, |
DIR |
}; |
END: |
pub const SEEK = switch (native_os) { .linux => linux.SEEK, .emscripten => emscripten.SEEK, .wasi => struct { pub const SET: wasi.whence_t = .SET; pub const CUR: wasi.whence_t = .CUR; pub const END: wasi.whence_t = .END; }, // https://github.com/SerenityOS/serenity/blob/808ce594db1f2190e5212a250e900bde2ffe710b/Kernel/API/POSIX/stdio.h#L15-L17 .openbsd, .haiku, .netbsd, .freebsd, .macos, .ios, .tvos, .watchos, .visionos, .windows, .serenity => struct { |
SET |
pub const SET = 0; |
CUR |
pub const CUR = 1; |
END |
pub const END = 2; }, .dragonfly, .solaris, .illumos => struct { |
SET |
pub const SET = 0; |
CUR |
pub const CUR = 1; |
END |
pub const END = 2; |
DATA |
pub const DATA = 3; |
HOLE |
pub const HOLE = 4; }, else => void, |
DIR |
}; pub const SHUT = switch (native_os) { .linux => linux.SHUT, .emscripten => emscripten.SHUT, // https://github.com/SerenityOS/serenity/blob/ac44ec5ebc707f9dd0c3d4759a1e17e91db5d74f/Kernel/API/POSIX/sys/socket.h#L40-L42 else => struct { |
RD |
pub const RD = 0; |
WR |
pub const WR = 1; |
RDWR |
pub const RDWR = 2; }, |
DIR |
}; |
INT |
/// Signal types pub const SIG = switch (native_os) { .linux => linux.SIG, .emscripten => emscripten.SIG, .windows => struct { /// interrupt |
INT |
pub const INT = 2; /// illegal instruction - invalid function image |
ILL |
pub const ILL = 4; /// floating point exception |
FPE |
pub const FPE = 8; /// segment violation |
SEGV |
pub const SEGV = 11; /// Software termination signal from kill |
TERM |
pub const TERM = 15; /// Ctrl-Break sequence pub const BREAK = 21; /// abnormal termination triggered by abort call |
ABRT |
pub const ABRT = 22; /// SIGABRT compatible with other platforms, same as SIGABRT |
ABRT_COMPAT |
pub const ABRT_COMPAT = 6; |
DFL |
// Signal action codes /// default signal action pub const DFL = 0; /// ignore signal |
IGN |
pub const IGN = 1; /// return current value |
GET |
pub const GET = 2; /// signal gets error |
SGE |
pub const SGE = 3; /// acknowledge |
ACK |
pub const ACK = 4; /// Signal error value (returned by signal call on error) |
ERR |
pub const ERR = -1; }, .macos, .ios, .tvos, .watchos, .visionos => struct { |
ERR: |
pub const ERR: ?Sigaction.handler_fn = @ptrFromInt(maxInt(usize)); |
DFL: |
pub const DFL: ?Sigaction.handler_fn = @ptrFromInt(0); |
IGN: |
pub const IGN: ?Sigaction.handler_fn = @ptrFromInt(1); |
HOLD: |
pub const HOLD: ?Sigaction.handler_fn = @ptrFromInt(5); |
BLOCK |
/// block specified signal set |
BLOCK |
pub const BLOCK = 1; /// unblock specified signal set |
UNBLOCK |
pub const UNBLOCK = 2; /// set specified signal set |
SETMASK |
pub const SETMASK = 3; /// hangup |
HUP |
pub const HUP = 1; /// interrupt |
INT |
pub const INT = 2; /// quit |
QUIT |
pub const QUIT = 3; /// illegal instruction (not reset when caught) |
ILL |
pub const ILL = 4; /// trace trap (not reset when caught) |
TRAP |
pub const TRAP = 5; /// abort() |
ABRT |
pub const ABRT = 6; /// pollable event ([XSR] generated, not supported) pub const POLL = 7; /// compatibility |
IOT |
pub const IOT = ABRT; /// EMT instruction |
EMT |
pub const EMT = 7; /// floating point exception |
FPE |
pub const FPE = 8; /// kill (cannot be caught or ignored) |
KILL |
pub const KILL = 9; /// bus error |
BUS |
pub const BUS = 10; /// segmentation violation |
SEGV |
pub const SEGV = 11; /// bad argument to system call |
SYS |
pub const SYS = 12; /// write on a pipe with no one to read it |
PIPE |
pub const PIPE = 13; /// alarm clock |
ALRM |
pub const ALRM = 14; /// software termination signal from kill |
TERM |
pub const TERM = 15; /// urgent condition on IO channel |
URG |
pub const URG = 16; /// sendable stop signal not from tty |
STOP |
pub const STOP = 17; /// stop signal from tty |
TSTP |
pub const TSTP = 18; /// continue a stopped process |
CONT |
pub const CONT = 19; /// to parent on child stop or exit |
CHLD |
pub const CHLD = 20; /// to readers pgrp upon background tty read |
TTIN |
pub const TTIN = 21; /// like TTIN for output if (tp->t_local<OSTOP) |
TTOU |
pub const TTOU = 22; /// input/output possible signal |
IO |
pub const IO = 23; /// exceeded CPU time limit |
XCPU |
pub const XCPU = 24; /// exceeded file size limit |
XFSZ |
pub const XFSZ = 25; /// virtual time alarm |
VTALRM |
pub const VTALRM = 26; /// profiling time alarm |
PROF |
pub const PROF = 27; /// window size changes |
WINCH |
pub const WINCH = 28; /// information request |
INFO |
pub const INFO = 29; /// user defined signal 1 |
USR1 |
pub const USR1 = 30; /// user defined signal 2 |
USR2 |
pub const USR2 = 31; }, .freebsd => struct { |
HUP |
pub const HUP = 1; |
INT |
pub const INT = 2; |
QUIT |
pub const QUIT = 3; |
ILL |
pub const ILL = 4; |
TRAP |
pub const TRAP = 5; |
ABRT |
pub const ABRT = 6; |
IOT |
pub const IOT = ABRT; |
EMT |
pub const EMT = 7; |
FPE |
pub const FPE = 8; |
KILL |
pub const KILL = 9; |
BUS |
pub const BUS = 10; |
SEGV |
pub const SEGV = 11; |
SYS |
pub const SYS = 12; |
PIPE |
pub const PIPE = 13; |
ALRM |
pub const ALRM = 14; |
TERM |
pub const TERM = 15; |
URG |
pub const URG = 16; |
STOP |
pub const STOP = 17; |
TSTP |
pub const TSTP = 18; |
CONT |
pub const CONT = 19; |
CHLD |
pub const CHLD = 20; |
TTIN |
pub const TTIN = 21; |
TTOU |
pub const TTOU = 22; |
IO |
pub const IO = 23; |
XCPU |
pub const XCPU = 24; |
XFSZ |
pub const XFSZ = 25; |
VTALRM |
pub const VTALRM = 26; |
PROF |
pub const PROF = 27; |
WINCH |
pub const WINCH = 28; |
INFO |
pub const INFO = 29; |
USR1 |
pub const USR1 = 30; |
USR2 |
pub const USR2 = 31; |
THR |
pub const THR = 32; |
LWP |
pub const LWP = THR; |
LIBRT |
pub const LIBRT = 33; |
RTMIN |
pub const RTMIN = 65; |
RTMAX |
pub const RTMAX = 126; |
BLOCK |
|
BLOCK |
pub const BLOCK = 1; |
UNBLOCK |
pub const UNBLOCK = 2; |
SETMASK |
pub const SETMASK = 3; |
IGN: |
|
DFL: |
pub const DFL: ?Sigaction.handler_fn = @ptrFromInt(0); |
IGN: |
pub const IGN: ?Sigaction.handler_fn = @ptrFromInt(1); |
ERR: |
pub const ERR: ?Sigaction.handler_fn = @ptrFromInt(maxInt(usize)); |
IDX() |
|
WORDS |
pub const WORDS = 4; |
MAXSIG |
pub const MAXSIG = 128; |
VALID() |
|
IDX() |
pub inline fn IDX(sig: usize) usize { return sig - 1; } |
WORD() |
pub inline fn WORD(sig: usize) usize { return IDX(sig) >> 5; } |
BIT() |
pub inline fn BIT(sig: usize) usize { return 1 << (IDX(sig) & 31); } |
VALID() |
pub inline fn VALID(sig: usize) usize { return sig <= MAXSIG and sig > 0; } }, .solaris, .illumos => struct { |
DFL: |
pub const DFL: ?Sigaction.handler_fn = @ptrFromInt(0); |
ERR: |
pub const ERR: ?Sigaction.handler_fn = @ptrFromInt(maxInt(usize)); |
IGN: |
pub const IGN: ?Sigaction.handler_fn = @ptrFromInt(1); pub const HOLD: ?Sigaction.handler_fn = @ptrFromInt(2); |
SIG_UNBLOCK |
|
WORDS |
pub const WORDS = 4; pub const MAXSIG = 75; |
HUP |
pub const SIG_BLOCK = 1; pub const SIG_UNBLOCK = 2; pub const SIG_SETMASK = 3; |
INT |
|
HUP |
pub const HUP = 1; |
INT |
pub const INT = 2; |
QUIT |
pub const QUIT = 3; |
ILL |
pub const ILL = 4; |
TRAP |
pub const TRAP = 5; pub const IOT = 6; |
ABRT |
pub const ABRT = 6; |
EMT |
pub const EMT = 7; |
FPE |
pub const FPE = 8; |
KILL |
pub const KILL = 9; |
BUS |
pub const BUS = 10; |
SEGV |
pub const SEGV = 11; |
SYS |
pub const SYS = 12; |
PIPE |
pub const PIPE = 13; |
ALRM |
pub const ALRM = 14; |
TERM |
pub const TERM = 15; pub const USR1 = 16; |
USR2 |
pub const USR2 = 17; |
CLD |
pub const CLD = 18; |
CHLD |
pub const CHLD = 18; |
PWR |
pub const PWR = 19; |
WINCH |
pub const WINCH = 20; |
URG |
pub const URG = 21; |
POLL |
pub const POLL = 22; |
IO |
pub const IO = .POLL; |
STOP |
pub const STOP = 23; |
TSTP |
pub const TSTP = 24; |
CONT |
pub const CONT = 25; |
TTIN |
pub const TTIN = 26; |
TTOU |
pub const TTOU = 27; |
VTALRM |
pub const VTALRM = 28; |
PROF |
pub const PROF = 29; |
XCPU |
pub const XCPU = 30; |
XFSZ |
pub const XFSZ = 31; |
WAITING |
pub const WAITING = 32; |
LWP |
pub const LWP = 33; |
FREEZE |
pub const FREEZE = 34; |
THAW |
pub const THAW = 35; |
CANCEL |
pub const CANCEL = 36; |
LOST |
pub const LOST = 37; |
XRES |
pub const XRES = 38; |
JVM1 |
pub const JVM1 = 39; |
JVM2 |
pub const JVM2 = 40; |
INFO |
pub const INFO = 41; |
RTMIN |
pub const RTMIN = 42; |
RTMAX |
pub const RTMAX = 74; |
IDX() |
|
IDX() |
pub inline fn IDX(sig: usize) usize { return sig - 1; } |
WORD() |
pub inline fn WORD(sig: usize) usize { return IDX(sig) >> 5; } |
BIT() |
pub inline fn BIT(sig: usize) usize { return 1 << (IDX(sig) & 31); } |
VALID() |
pub inline fn VALID(sig: usize) usize { return sig <= MAXSIG and sig > 0; } }, .netbsd => struct { |
DFL: |
pub const DFL: ?Sigaction.handler_fn = @ptrFromInt(0); |
IGN: |
pub const IGN: ?Sigaction.handler_fn = @ptrFromInt(1); |
ERR: |
pub const ERR: ?Sigaction.handler_fn = @ptrFromInt(maxInt(usize)); |
MAXSIG |
|
WORDS |
pub const WORDS = 4; pub const MAXSIG = 128; |
UNBLOCK |
|
BLOCK |
pub const BLOCK = 1; |
UNBLOCK |
pub const UNBLOCK = 2; |
SETMASK |
pub const SETMASK = 3; |
QUIT |
|
HUP |
pub const HUP = 1; |
INT |
pub const INT = 2; |
QUIT |
pub const QUIT = 3; |
ILL |
pub const ILL = 4; |
TRAP |
pub const TRAP = 5; |
ABRT |
pub const ABRT = 6; |
IOT |
pub const IOT = ABRT; |
EMT |
pub const EMT = 7; |
FPE |
pub const FPE = 8; |
KILL |
pub const KILL = 9; |
BUS |
pub const BUS = 10; |
SEGV |
pub const SEGV = 11; |
SYS |
pub const SYS = 12; |
PIPE |
pub const PIPE = 13; |
ALRM |
pub const ALRM = 14; |
TERM |
pub const TERM = 15; |
URG |
pub const URG = 16; |
STOP |
pub const STOP = 17; |
TSTP |
pub const TSTP = 18; |
CONT |
pub const CONT = 19; |
CHLD |
pub const CHLD = 20; |
TTIN |
pub const TTIN = 21; |
TTOU |
pub const TTOU = 22; |
IO |
pub const IO = 23; |
XCPU |
pub const XCPU = 24; |
XFSZ |
pub const XFSZ = 25; |
VTALRM |
pub const VTALRM = 26; |
PROF |
pub const PROF = 27; |
WINCH |
pub const WINCH = 28; |
INFO |
pub const INFO = 29; |
USR1 |
pub const USR1 = 30; |
USR2 |
pub const USR2 = 31; |
PWR |
pub const PWR = 32; |
WORD() |
pub const RTMIN = 33; pub const RTMAX = 63; |
BIT() |
pub inline fn IDX(sig: usize) usize { return sig - 1; } pub inline fn WORD(sig: usize) usize { return IDX(sig) >> 5; } pub inline fn BIT(sig: usize) usize { return 1 << (IDX(sig) & 31); } |
VALID() |
pub inline fn VALID(sig: usize) usize { return sig <= MAXSIG and sig > 0; } }, .dragonfly => struct { |
DFL: |
pub const DFL: ?Sigaction.handler_fn = @ptrFromInt(0); |
IGN: |
pub const IGN: ?Sigaction.handler_fn = @ptrFromInt(1); |
ERR: |
pub const ERR: ?Sigaction.handler_fn = @ptrFromInt(maxInt(usize)); |
BLOCK |
|
BLOCK |
pub const BLOCK = 1; |
UNBLOCK |
pub const UNBLOCK = 2; |
SETMASK |
pub const SETMASK = 3; |
HUP |
|
IOT |
pub const IOT = ABRT; |
HUP |
pub const HUP = 1; |
INT |
pub const INT = 2; |
QUIT |
pub const QUIT = 3; |
ILL |
pub const ILL = 4; |
TRAP |
pub const TRAP = 5; |
ABRT |
pub const ABRT = 6; |
EMT |
pub const EMT = 7; |
FPE |
pub const FPE = 8; |
KILL |
pub const KILL = 9; |
BUS |
pub const BUS = 10; |
SEGV |
pub const SEGV = 11; |
SYS |
pub const SYS = 12; |
PIPE |
pub const PIPE = 13; |
ALRM |
pub const ALRM = 14; |
TERM |
pub const TERM = 15; |
URG |
pub const URG = 16; |
STOP |
pub const STOP = 17; |
TSTP |
pub const TSTP = 18; |
CONT |
pub const CONT = 19; |
CHLD |
pub const CHLD = 20; |
TTIN |
pub const TTIN = 21; |
TTOU |
pub const TTOU = 22; |
IO |
pub const IO = 23; |
XCPU |
pub const XCPU = 24; |
XFSZ |
pub const XFSZ = 25; |
VTALRM |
pub const VTALRM = 26; |
PROF |
pub const PROF = 27; |
WINCH |
pub const WINCH = 28; |
INFO |
pub const INFO = 29; |
USR1 |
pub const USR1 = 30; |
USR2 |
pub const USR2 = 31; pub const THR = 32; pub const CKPT = 33; |
CKPTEXIT |
pub const CKPTEXIT = 34; |
WORDS |
pub const WORDS = 4; }, .haiku => struct { |
DFL: |
pub const DFL: ?Sigaction.handler_fn = @ptrFromInt(0); |
IGN: |
pub const IGN: ?Sigaction.handler_fn = @ptrFromInt(1); |
ERR: |
pub const ERR: ?Sigaction.handler_fn = @ptrFromInt(maxInt(usize)); |
HOLD: |
|
HOLD: |
pub const HOLD: ?Sigaction.handler_fn = @ptrFromInt(3); |
INT |
|
HUP |
pub const HUP = 1; |
INT |
pub const INT = 2; |
QUIT |
pub const QUIT = 3; |
ILL |
pub const ILL = 4; pub const CHLD = 5; |
ABRT |
pub const ABRT = 6; |
IOT |
pub const IOT = ABRT; pub const PIPE = 7; |
FPE |
pub const FPE = 8; |
KILL |
pub const KILL = 9; |
STOP |
pub const STOP = 10; |
SEGV |
pub const SEGV = 11; |
CONT |
pub const CONT = 12; |
TSTP |
pub const TSTP = 13; |
ALRM |
pub const ALRM = 14; |
TERM |
pub const TERM = 15; |
TTIN |
pub const TTIN = 16; |
TTOU |
pub const TTOU = 17; |
USR1 |
pub const USR1 = 18; |
USR2 |
pub const USR2 = 19; |
WINCH |
pub const WINCH = 20; |
KILLTHR |
pub const KILLTHR = 21; |
TRAP |
pub const TRAP = 22; |
POLL |
pub const POLL = 23; |
PROF |
pub const PROF = 24; |
SYS |
pub const SYS = 25; |
URG |
pub const URG = 26; |
VTALRM |
pub const VTALRM = 27; |
XCPU |
pub const XCPU = 28; |
XFSZ |
pub const XFSZ = 29; |
BUS |
pub const BUS = 30; |
RESERVED1 |
pub const RESERVED1 = 31; |
RESERVED2 |
pub const RESERVED2 = 32; |
BLOCK |
|
BLOCK |
pub const BLOCK = 1; |
UNBLOCK |
pub const UNBLOCK = 2; |
SETMASK |
pub const SETMASK = 3; }, .openbsd => struct { pub const DFL: ?Sigaction.handler_fn = @ptrFromInt(0); |
IGN: |
pub const IGN: ?Sigaction.handler_fn = @ptrFromInt(1); |
ERR: |
pub const ERR: ?Sigaction.handler_fn = @ptrFromInt(maxInt(usize)); |
CATCH: |
pub const CATCH: ?Sigaction.handler_fn = @ptrFromInt(2); |
HOLD: |
pub const HOLD: ?Sigaction.handler_fn = @ptrFromInt(3); |
HUP |
|
HUP |
pub const HUP = 1; |
INT |
pub const INT = 2; |
QUIT |
pub const QUIT = 3; |
ILL |
pub const ILL = 4; |
TRAP |
pub const TRAP = 5; |
ABRT |
pub const ABRT = 6; pub const IOT = ABRT; |
EMT |
pub const EMT = 7; |
FPE |
pub const FPE = 8; |
KILL |
pub const KILL = 9; |
BUS |
pub const BUS = 10; |
SEGV |
pub const SEGV = 11; |
SYS |
pub const SYS = 12; |
PIPE |
pub const PIPE = 13; |
ALRM |
pub const ALRM = 14; |
TERM |
pub const TERM = 15; |
URG |
pub const URG = 16; |
STOP |
pub const STOP = 17; |
TSTP |
pub const TSTP = 18; |
CONT |
pub const CONT = 19; |
CHLD |
pub const CHLD = 20; |
TTIN |
pub const TTIN = 21; |
TTOU |
pub const TTOU = 22; |
IO |
pub const IO = 23; |
XCPU |
pub const XCPU = 24; |
XFSZ |
pub const XFSZ = 25; |
VTALRM |
pub const VTALRM = 26; |
PROF |
pub const PROF = 27; |
WINCH |
pub const WINCH = 28; |
INFO |
pub const INFO = 29; |
USR1 |
pub const USR1 = 30; |
USR2 |
pub const USR2 = 31; |
PWR |
pub const PWR = 32; |
BLOCK |
pub const BLOCK = 1; |
UNBLOCK |
pub const UNBLOCK = 2; |
SETMASK |
pub const SETMASK = 3; }, // https://github.com/SerenityOS/serenity/blob/046c23f567a17758d762a33bdf04bacbfd088f9f/Kernel/API/POSIX/signal_numbers.h .serenity => struct { |
INVAL |
pub const INVAL = 0; |
HUP |
pub const HUP = 1; |
INT |
pub const INT = 2; |
QUIT |
pub const QUIT = 3; |
ILL |
pub const ILL = 4; |
TRAP |
pub const TRAP = 5; |
ABRT |
pub const ABRT = 6; |
BUS |
pub const BUS = 7; |
FPE |
pub const FPE = 8; |
KILL |
pub const KILL = 9; |
USR1 |
pub const USR1 = 10; |
SEGV |
pub const SEGV = 11; |
USR2 |
pub const USR2 = 12; |
PIPE |
pub const PIPE = 13; |
ALRM |
pub const ALRM = 14; |
TERM |
pub const TERM = 15; |
STKFLT |
pub const STKFLT = 16; |
CHLD |
pub const CHLD = 17; |
CONT |
pub const CONT = 18; |
STOP |
pub const STOP = 19; |
TSTP |
pub const TSTP = 20; |
TTIN |
pub const TTIN = 21; |
TTOU |
pub const TTOU = 22; |
URG |
pub const URG = 23; |
XCPU |
pub const XCPU = 24; |
XFSZ |
pub const XFSZ = 25; |
VTALRM |
pub const VTALRM = 26; |
PROF |
pub const PROF = 27; |
WINCH |
pub const WINCH = 28; |
IO |
pub const IO = 29; |
INFO |
pub const INFO = 30; |
SYS |
pub const SYS = 31; |
CANCEL |
pub const CANCEL = 32; }, else => void, |
DIR |
}; |
STDIN_FILENO |
pub const SIOCGIFINDEX = switch (native_os) { .linux => linux.SIOCGIFINDEX, .emscripten => emscripten.SIOCGIFINDEX, .solaris, .illumos => solaris.SIOCGLIFINDEX, // https://github.com/SerenityOS/serenity/blob/cb10f70394fb7e9cfc77f827adb2e46d199bc3a5/Kernel/API/Ioctl.h#L118 .serenity => 34, else => void, |
DIR |
}; |
STDERR_FILENO |
pub const STDIN_FILENO = switch (native_os) { .linux => linux.STDIN_FILENO, .emscripten => emscripten.STDIN_FILENO, else => 0, |
DIR |
}; pub const STDOUT_FILENO = switch (native_os) { .linux => linux.STDOUT_FILENO, .emscripten => emscripten.STDOUT_FILENO, else => 1, |
DIR |
}; pub const STDERR_FILENO = switch (native_os) { .linux => linux.STDERR_FILENO, .emscripten => emscripten.STDERR_FILENO, else => 2, |
DIR |
}; |
Sigaction |
pub const SYS = switch (native_os) { .linux => linux.SYS, else => void, |
DIR |
}; |
sigaction_fn |
/// A common format for the Sigaction struct across a variety of Linux flavors. const common_linux_Sigaction = extern struct { |
handler_fn |
pub const handler_fn = *align(1) const fn (i32) callconv(.c) void; |
sigaction_fn |
pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void; |
handler_fn |
handler: extern union { handler: ?handler_fn, sigaction: ?sigaction_fn, }, mask: sigset_t, flags: c_uint, restorer: ?*const fn () callconv(.c) void = null, // C library will fill this in |
DIR |
}; |
handler_fn |
/// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name. pub const Sigaction = switch (native_os) { .linux => switch (native_arch) { .mips, .mipsel, .mips64, .mips64el, => if (builtin.target.abi.isMusl()) common_linux_Sigaction else if (builtin.target.ptrBitWidth() == 64) extern struct { pub const handler_fn = *align(1) const fn (i32) callconv(.c) void; pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void; |
sigaction_fn |
flags: c_uint, handler: extern union { handler: ?handler_fn, sigaction: ?sigaction_fn, }, mask: sigset_t, restorer: ?*const fn () callconv(.c) void = null, } else extern struct { pub const handler_fn = *align(1) const fn (i32) callconv(.c) void; pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void; |
handler_fn |
flags: c_uint, handler: extern union { handler: ?handler_fn, sigaction: ?sigaction_fn, }, mask: sigset_t, restorer: ?*const fn () callconv(.c) void = null, __resv: [1]c_int = .{0}, }, .s390x => if (builtin.abi == .gnu) extern struct { pub const handler_fn = *align(1) const fn (i32) callconv(.c) void; pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void; |
sigaction_fn |
handler: extern union { handler: ?handler_fn, sigaction: ?sigaction_fn, }, __glibc_reserved0: c_int = 0, flags: c_uint, restorer: ?*const fn () callconv(.c) void = null, mask: sigset_t, } else common_linux_Sigaction, else => common_linux_Sigaction, }, .emscripten => emscripten.Sigaction, .netbsd, .macos, .ios, .tvos, .watchos, .visionos => extern struct { |
handler_fn |
pub const handler_fn = *align(1) const fn (i32) callconv(.c) void; |
sigaction_fn |
pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void; |
handler_fn |
handler: extern union { handler: ?handler_fn, sigaction: ?sigaction_fn, }, mask: sigset_t, flags: c_uint, }, .dragonfly, .freebsd => extern struct { |
handler_fn |
pub const handler_fn = *align(1) const fn (i32) callconv(.c) void; |
sigaction_fn |
pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void; |
sigaction_fn |
/// signal handler handler: extern union { handler: ?handler_fn, sigaction: ?sigaction_fn, }, /// see signal options flags: c_uint, /// signal mask to apply mask: sigset_t, }, .solaris, .illumos => extern struct { pub const handler_fn = *align(1) const fn (i32) callconv(.c) void; pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void; |
handler_fn |
/// signal options flags: c_uint, /// signal handler handler: extern union { handler: ?handler_fn, sigaction: ?sigaction_fn, }, /// signal mask to apply mask: sigset_t, }, .haiku => extern struct { pub const handler_fn = *align(1) const fn (i32) callconv(.c) void; pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void; |
sigaction_fn |
/// signal handler handler: extern union { handler: handler_fn, sigaction: sigaction_fn, }, |
T |
/// signal mask to apply mask: sigset_t, |
IOCGWINSZ |
/// see signal options flags: i32, |
IOCEXCL |
/// will be passed to the signal handler, BeOS extension userdata: *allowzero anyopaque = undefined, }, .openbsd => extern struct { pub const handler_fn = *align(1) const fn (i32) callconv(.c) void; pub const sigaction_fn = *const fn (i32, *const siginfo_t, ?*anyopaque) callconv(.c) void; |
IOCNXCL |
/// signal handler handler: extern union { handler: ?handler_fn, sigaction: ?sigaction_fn, }, /// signal mask to apply mask: sigset_t, /// signal options flags: c_uint, }, // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L39-L46 .serenity => extern struct { pub const handler_fn = *align(1) const fn (c_int) callconv(.c) void; pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*anyopaque) callconv(.c) void; |
IOCSCTTY |
handler: extern union { handler: ?handler_fn, sigaction: ?sigaction_fn, }, mask: sigset_t, flags: c_int, }, else => void, |
DIR |
}; pub const T = switch (native_os) { .linux => linux.T, .macos, .ios, .tvos, .watchos, .visionos => struct { pub const IOCGWINSZ = ior(0x40000000, 't', 104, @sizeOf(winsize)); |
IOCSPGRP |
fn ior(inout: u32, group_arg: usize, num: usize, len: usize) usize { return (inout | ((len & IOCPARM_MASK) << 16) | ((group_arg) << 8) | (num)); } }, .freebsd => struct { |
IOCEXCL |
pub const IOCEXCL = 0x2000740d; |
IOCNXCL |
pub const IOCNXCL = 0x2000740e; |
IOCSCTTY |
pub const IOCSCTTY = 0x20007461; |
IOCGPGRP |
pub const IOCGPGRP = 0x40047477; |
IOCSPGRP |
pub const IOCSPGRP = 0x80047476; |
IOCOUTQ |
pub const IOCOUTQ = 0x40047473; |
IOCSTI |
pub const IOCSTI = 0x80017472; |
IOCGWINSZ |
pub const IOCGWINSZ = 0x40087468; |
IOCSWINSZ |
pub const IOCSWINSZ = 0x80087467; |
IOCMGET |
pub const IOCMGET = 0x4004746a; |
IOCMBIS |
pub const IOCMBIS = 0x8004746c; |
IOCMBIC |
pub const IOCMBIC = 0x8004746b; |
IOCMSET |
pub const IOCMSET = 0x8004746d; pub const FIONREAD = 0x4004667f; |
IOCCONS |
pub const IOCCONS = 0x80047462; |
IOCPKT |
pub const IOCPKT = 0x80047470; pub const FIONBIO = 0x8004667e; |
IOCNOTTY |
pub const IOCNOTTY = 0x20007471; |
IOCSETD |
pub const IOCSETD = 0x8004741b; |
IOCGETD |
pub const IOCGETD = 0x4004741a; |
IOCSBRK |
pub const IOCSBRK = 0x2000747b; |
IOCCBRK |
pub const IOCCBRK = 0x2000747a; |
IOCGSID |
pub const IOCGSID = 0x40047463; pub const IOCGPTN = 0x4004740f; pub const IOCSIG = 0x2004745f; }, .solaris, .illumos => struct { pub const CGETA = tioc('T', 1); |
CSETA |
pub const CSETA = tioc('T', 2); |
CSETAW |
pub const CSETAW = tioc('T', 3); |
CSETAF |
pub const CSETAF = tioc('T', 4); |
CSBRK |
pub const CSBRK = tioc('T', 5); |
CXONC |
pub const CXONC = tioc('T', 6); |
CFLSH |
pub const CFLSH = tioc('T', 7); |
IOCGWINSZ |
pub const IOCGWINSZ = tioc('T', 104); |
IOCSWINSZ |
pub const IOCSWINSZ = tioc('T', 103); // Softcarrier ioctls |
IOCGSOFTCAR |
pub const IOCGSOFTCAR = tioc('T', 105); |
IOCSSOFTCAR |
pub const IOCSSOFTCAR = tioc('T', 106); // termios ioctls |
CGETS |
pub const CGETS = tioc('T', 13); |
CSETS |
pub const CSETS = tioc('T', 14); |
CSANOW |
pub const CSANOW = tioc('T', 14); |
CSETSW |
pub const CSETSW = tioc('T', 15); |
CSADRAIN |
pub const CSADRAIN = tioc('T', 15); |
CSETSF |
pub const CSETSF = tioc('T', 16); |
IOCSETLD |
pub const IOCSETLD = tioc('T', 123); |
IOCGETLD |
pub const IOCGETLD = tioc('T', 124); // NTP PPS ioctls |
IOCGPPS |
pub const IOCGPPS = tioc('T', 125); |
IOCSPPS |
pub const IOCSPPS = tioc('T', 126); |
IOCGPPSEV |
pub const IOCGPPSEV = tioc('T', 127); |
IOCGETD |
pub const IOCGETD = tioc('t', 0); |
IOCSETD |
pub const IOCSETD = tioc('t', 1); |
IOCHPCL |
pub const IOCHPCL = tioc('t', 2); |
IOCGETP |
pub const IOCGETP = tioc('t', 8); |
IOCSETP |
pub const IOCSETP = tioc('t', 9); |
IOCSETN |
pub const IOCSETN = tioc('t', 10); |
IOCEXCL |
pub const IOCEXCL = tioc('t', 13); |
IOCNXCL |
pub const IOCNXCL = tioc('t', 14); |
IOCFLUSH |
pub const IOCFLUSH = tioc('t', 16); |
IOCSETC |
pub const IOCSETC = tioc('t', 17); |
IOCGETC |
pub const IOCGETC = tioc('t', 18); /// bis local mode bits |
IOCLBIS |
pub const IOCLBIS = tioc('t', 127); /// bic local mode bits |
IOCLBIC |
pub const IOCLBIC = tioc('t', 126); /// set entire local mode word |
IOCLSET |
pub const IOCLSET = tioc('t', 125); /// get local modes |
IOCLGET |
pub const IOCLGET = tioc('t', 124); /// set break bit |
IOCSBRK |
pub const IOCSBRK = tioc('t', 123); /// clear break bit |
IOCCBRK |
pub const IOCCBRK = tioc('t', 122); /// set data terminal ready |
IOCSDTR |
pub const IOCSDTR = tioc('t', 121); /// clear data terminal ready |
IOCCDTR |
pub const IOCCDTR = tioc('t', 120); /// set local special chars |
IOCSLTC |
pub const IOCSLTC = tioc('t', 117); /// get local special chars |
IOCGLTC |
pub const IOCGLTC = tioc('t', 116); /// driver output queue size |
IOCOUTQ |
pub const IOCOUTQ = tioc('t', 115); /// void tty association |
IOCNOTTY |
pub const IOCNOTTY = tioc('t', 113); /// get a ctty |
IOCSCTTY |
pub const IOCSCTTY = tioc('t', 132); /// stop output, like ^S |
IOCSTOP |
pub const IOCSTOP = tioc('t', 111); /// start output, like ^Q |
IOCSTART |
pub const IOCSTART = tioc('t', 110); /// get pgrp of tty |
IOCGPGRP |
pub const IOCGPGRP = tioc('t', 20); /// set pgrp of tty |
IOCSPGRP |
pub const IOCSPGRP = tioc('t', 21); /// get session id on ctty |
IOCGSID |
pub const IOCGSID = tioc('t', 22); /// simulate terminal input |
IOCSTI |
pub const IOCSTI = tioc('t', 23); /// set all modem bits |
IOCMSET |
pub const IOCMSET = tioc('t', 26); /// bis modem bits |
IOCMBIS |
pub const IOCMBIS = tioc('t', 27); /// bic modem bits |
IOCMBIC |
pub const IOCMBIC = tioc('t', 28); /// get all modem bits |
IOCMGET |
pub const IOCMGET = tioc('t', 29); |
IOCCBRK |
fn tioc(t: u16, num: u8) u16 { return (t << 8) | num; } }, .netbsd => struct { |
IOCCBRK |
pub const IOCCBRK = 0x2000747a; |
IOCCDTR |
pub const IOCCDTR = 0x20007478; |
IOCCONS |
pub const IOCCONS = 0x80047462; |
IOCDCDTIMESTAMP |
pub const IOCDCDTIMESTAMP = 0x40107458; |
IOCDRAIN |
pub const IOCDRAIN = 0x2000745e; |
IOCEXCL |
pub const IOCEXCL = 0x2000740d; |
IOCEXT |
pub const IOCEXT = 0x80047460; |
IOCFLAG_CDTRCTS |
pub const IOCFLAG_CDTRCTS = 0x10; |
IOCFLAG_CLOCAL |
pub const IOCFLAG_CLOCAL = 0x2; |
IOCFLAG_CRTSCTS |
pub const IOCFLAG_CRTSCTS = 0x4; |
IOCFLAG_MDMBUF |
pub const IOCFLAG_MDMBUF = 0x8; |
IOCFLAG_SOFTCAR |
pub const IOCFLAG_SOFTCAR = 0x1; |
IOCFLUSH |
pub const IOCFLUSH = 0x80047410; |
IOCGETA |
pub const IOCGETA = 0x402c7413; |
IOCGETD |
pub const IOCGETD = 0x4004741a; |
IOCGFLAGS |
pub const IOCGFLAGS = 0x4004745d; |
IOCGLINED |
pub const IOCGLINED = 0x40207442; |
IOCGPGRP |
pub const IOCGPGRP = 0x40047477; |
IOCGQSIZE |
pub const IOCGQSIZE = 0x40047481; |
IOCGRANTPT |
pub const IOCGRANTPT = 0x20007447; |
IOCGSID |
pub const IOCGSID = 0x40047463; |
IOCGSIZE |
pub const IOCGSIZE = 0x40087468; |
IOCGWINSZ |
pub const IOCGWINSZ = 0x40087468; |
IOCMBIC |
pub const IOCMBIC = 0x8004746b; |
IOCMBIS |
pub const IOCMBIS = 0x8004746c; |
IOCMGET |
pub const IOCMGET = 0x4004746a; |
IOCMSET |
pub const IOCMSET = 0x8004746d; |
IOCM_CAR |
pub const IOCM_CAR = 0x40; |
IOCM_CD |
pub const IOCM_CD = 0x40; |
IOCM_CTS |
pub const IOCM_CTS = 0x20; |
IOCM_DSR |
pub const IOCM_DSR = 0x100; |
IOCM_DTR |
pub const IOCM_DTR = 0x2; |
IOCM_LE |
pub const IOCM_LE = 0x1; |
IOCM_RI |
pub const IOCM_RI = 0x80; |
IOCM_RNG |
pub const IOCM_RNG = 0x80; |
IOCM_RTS |
pub const IOCM_RTS = 0x4; |
IOCM_SR |
pub const IOCM_SR = 0x10; |
IOCM_ST |
pub const IOCM_ST = 0x8; |
IOCNOTTY |
pub const IOCNOTTY = 0x20007471; |
IOCNXCL |
pub const IOCNXCL = 0x2000740e; |
IOCOUTQ |
pub const IOCOUTQ = 0x40047473; |
IOCPKT |
pub const IOCPKT = 0x80047470; |
IOCPKT_DATA |
pub const IOCPKT_DATA = 0x0; |
IOCPKT_DOSTOP |
pub const IOCPKT_DOSTOP = 0x20; |
IOCPKT_FLUSHREAD |
pub const IOCPKT_FLUSHREAD = 0x1; |
IOCPKT_FLUSHWRITE |
pub const IOCPKT_FLUSHWRITE = 0x2; |
IOCPKT_IOCTL |
pub const IOCPKT_IOCTL = 0x40; |
IOCPKT_NOSTOP |
pub const IOCPKT_NOSTOP = 0x10; |
IOCPKT_START |
pub const IOCPKT_START = 0x8; |
IOCPKT_STOP |
pub const IOCPKT_STOP = 0x4; |
IOCPTMGET |
pub const IOCPTMGET = 0x40287446; |
IOCPTSNAME |
pub const IOCPTSNAME = 0x40287448; |
IOCRCVFRAME |
pub const IOCRCVFRAME = 0x80087445; |
IOCREMOTE |
pub const IOCREMOTE = 0x80047469; |
IOCSBRK |
pub const IOCSBRK = 0x2000747b; |
IOCSCTTY |
pub const IOCSCTTY = 0x20007461; |
IOCSDTR |
pub const IOCSDTR = 0x20007479; |
IOCSETA |
pub const IOCSETA = 0x802c7414; |
IOCSETAF |
pub const IOCSETAF = 0x802c7416; |
IOCSETAW |
pub const IOCSETAW = 0x802c7415; |
IOCSETD |
pub const IOCSETD = 0x8004741b; |
IOCSFLAGS |
pub const IOCSFLAGS = 0x8004745c; |
IOCSIG |
pub const IOCSIG = 0x2000745f; |
IOCSLINED |
pub const IOCSLINED = 0x80207443; |
IOCSPGRP |
pub const IOCSPGRP = 0x80047476; |
IOCSQSIZE |
pub const IOCSQSIZE = 0x80047480; |
IOCSSIZE |
pub const IOCSSIZE = 0x80087467; |
IOCSTART |
pub const IOCSTART = 0x2000746e; |
IOCSTAT |
pub const IOCSTAT = 0x80047465; |
IOCSTI |
pub const IOCSTI = 0x80017472; |
IOCSTOP |
pub const IOCSTOP = 0x2000746f; |
IOCSWINSZ |
pub const IOCSWINSZ = 0x80087467; |
IOCUCNTL |
pub const IOCUCNTL = 0x80047466; |
IOCXMTFRAME |
pub const IOCXMTFRAME = 0x80087444; }, .haiku => struct { pub const CGETA = 0x8000; |
CSETA |
pub const CSETA = 0x8001; |
CSETAF |
pub const CSETAF = 0x8002; |
CSETAW |
pub const CSETAW = 0x8003; |
CWAITEVENT |
pub const CWAITEVENT = 0x8004; |
CSBRK |
pub const CSBRK = 0x8005; |
CFLSH |
pub const CFLSH = 0x8006; |
CXONC |
pub const CXONC = 0x8007; |
CQUERYCONNECTED |
pub const CQUERYCONNECTED = 0x8008; |
CGETBITS |
pub const CGETBITS = 0x8009; |
CSETDTR |
pub const CSETDTR = 0x8010; |
CSETRTS |
pub const CSETRTS = 0x8011; |
IOCGWINSZ |
pub const IOCGWINSZ = 0x8012; |
IOCSWINSZ |
pub const IOCSWINSZ = 0x8013; |
CVTIME |
pub const CVTIME = 0x8014; |
IOCGPGRP |
pub const IOCGPGRP = 0x8015; |
IOCSPGRP |
pub const IOCSPGRP = 0x8016; |
IOCSCTTY |
pub const IOCSCTTY = 0x8017; |
IOCMGET |
pub const IOCMGET = 0x8018; |
IOCMSET |
pub const IOCMSET = 0x8019; |
IOCSBRK |
pub const IOCSBRK = 0x8020; |
IOCCBRK |
pub const IOCCBRK = 0x8021; |
IOCMBIS |
pub const IOCMBIS = 0x8022; |
IOCMBIC |
pub const IOCMBIC = 0x8023; |
IOCGSID |
pub const IOCGSID = 0x8024; |
FIONREAD |
pub const FIONREAD = 0xbe000001; |
FIONBIO |
pub const FIONBIO = 0xbe000000; }, .openbsd => struct { |
IOCCBRK |
pub const IOCCBRK = 0x2000747a; |
IOCCDTR |
pub const IOCCDTR = 0x20007478; |
IOCCONS |
pub const IOCCONS = 0x80047462; |
IOCDCDTIMESTAMP |
pub const IOCDCDTIMESTAMP = 0x40107458; |
IOCDRAIN |
pub const IOCDRAIN = 0x2000745e; |
IOCEXCL |
pub const IOCEXCL = 0x2000740d; |
IOCEXT |
pub const IOCEXT = 0x80047460; |
IOCFLAG_CDTRCTS |
pub const IOCFLAG_CDTRCTS = 0x10; |
IOCFLAG_CLOCAL |
pub const IOCFLAG_CLOCAL = 0x2; |
IOCFLAG_CRTSCTS |
pub const IOCFLAG_CRTSCTS = 0x4; |
IOCFLAG_MDMBUF |
pub const IOCFLAG_MDMBUF = 0x8; |
IOCFLAG_SOFTCAR |
pub const IOCFLAG_SOFTCAR = 0x1; |
IOCFLUSH |
pub const IOCFLUSH = 0x80047410; |
IOCGETA |
pub const IOCGETA = 0x402c7413; |
IOCGETD |
pub const IOCGETD = 0x4004741a; |
IOCGFLAGS |
pub const IOCGFLAGS = 0x4004745d; |
IOCGLINED |
pub const IOCGLINED = 0x40207442; |
IOCGPGRP |
pub const IOCGPGRP = 0x40047477; |
IOCGQSIZE |
pub const IOCGQSIZE = 0x40047481; |
IOCGRANTPT |
pub const IOCGRANTPT = 0x20007447; |
IOCGSID |
pub const IOCGSID = 0x40047463; |
IOCGSIZE |
pub const IOCGSIZE = 0x40087468; |
IOCGWINSZ |
pub const IOCGWINSZ = 0x40087468; |
IOCMBIC |
pub const IOCMBIC = 0x8004746b; |
IOCMBIS |
pub const IOCMBIS = 0x8004746c; |
IOCMGET |
pub const IOCMGET = 0x4004746a; |
IOCMSET |
pub const IOCMSET = 0x8004746d; |
IOCM_CAR |
pub const IOCM_CAR = 0x40; |
IOCM_CD |
pub const IOCM_CD = 0x40; |
IOCM_CTS |
pub const IOCM_CTS = 0x20; |
IOCM_DSR |
pub const IOCM_DSR = 0x100; |
IOCM_DTR |
pub const IOCM_DTR = 0x2; |
IOCM_LE |
pub const IOCM_LE = 0x1; |
IOCM_RI |
pub const IOCM_RI = 0x80; |
IOCM_RNG |
pub const IOCM_RNG = 0x80; |
IOCM_RTS |
pub const IOCM_RTS = 0x4; |
IOCM_SR |
pub const IOCM_SR = 0x10; |
IOCM_ST |
pub const IOCM_ST = 0x8; |
IOCNOTTY |
pub const IOCNOTTY = 0x20007471; |
IOCNXCL |
pub const IOCNXCL = 0x2000740e; |
IOCOUTQ |
pub const IOCOUTQ = 0x40047473; |
IOCPKT |
pub const IOCPKT = 0x80047470; |
IOCPKT_DATA |
pub const IOCPKT_DATA = 0x0; |
IOCPKT_DOSTOP |
pub const IOCPKT_DOSTOP = 0x20; |
IOCPKT_FLUSHREAD |
pub const IOCPKT_FLUSHREAD = 0x1; |
IOCPKT_FLUSHWRITE |
pub const IOCPKT_FLUSHWRITE = 0x2; |
IOCPKT_IOCTL |
pub const IOCPKT_IOCTL = 0x40; |
IOCPKT_NOSTOP |
pub const IOCPKT_NOSTOP = 0x10; |
IOCPKT_START |
pub const IOCPKT_START = 0x8; |
IOCPKT_STOP |
pub const IOCPKT_STOP = 0x4; |
IOCPTMGET |
pub const IOCPTMGET = 0x40287446; |
IOCPTSNAME |
pub const IOCPTSNAME = 0x40287448; |
IOCRCVFRAME |
pub const IOCRCVFRAME = 0x80087445; |
IOCREMOTE |
pub const IOCREMOTE = 0x80047469; |
IOCSBRK |
pub const IOCSBRK = 0x2000747b; |
IOCSCTTY |
pub const IOCSCTTY = 0x20007461; |
IOCSDTR |
pub const IOCSDTR = 0x20007479; |
IOCSETA |
pub const IOCSETA = 0x802c7414; |
IOCSETAF |
pub const IOCSETAF = 0x802c7416; |
IOCSETAW |
pub const IOCSETAW = 0x802c7415; |
IOCSETD |
pub const IOCSETD = 0x8004741b; |
IOCSFLAGS |
pub const IOCSFLAGS = 0x8004745c; |
IOCSIG |
pub const IOCSIG = 0x2000745f; |
IOCSLINED |
pub const IOCSLINED = 0x80207443; |
IOCSPGRP |
pub const IOCSPGRP = 0x80047476; |
IOCSQSIZE |
pub const IOCSQSIZE = 0x80047480; |
IOCSSIZE |
pub const IOCSSIZE = 0x80087467; |
IOCSTART |
pub const IOCSTART = 0x2000746e; |
IOCSTAT |
pub const IOCSTAT = 0x80047465; |
IOCSTI |
pub const IOCSTI = 0x80017472; |
IOCSTOP |
pub const IOCSTOP = 0x2000746f; |
IOCSWINSZ |
pub const IOCSWINSZ = 0x80087467; |
IOCUCNTL |
pub const IOCUCNTL = 0x80047466; |
IOCXMTFRAME |
pub const IOCXMTFRAME = 0x80087444; }, .dragonfly => struct { |
IOCMODG |
pub const IOCMODG = 0x40047403; |
IOCMODS |
pub const IOCMODS = 0x80047404; |
IOCM_LE |
pub const IOCM_LE = 0x00000001; |
IOCM_DTR |
pub const IOCM_DTR = 0x00000002; |
IOCM_RTS |
pub const IOCM_RTS = 0x00000004; |
IOCM_ST |
pub const IOCM_ST = 0x00000008; |
IOCM_SR |
pub const IOCM_SR = 0x00000010; |
IOCM_CTS |
pub const IOCM_CTS = 0x00000020; |
IOCM_CAR |
pub const IOCM_CAR = 0x00000040; |
IOCM_CD |
pub const IOCM_CD = 0x00000040; |
IOCM_RNG |
pub const IOCM_RNG = 0x00000080; |
IOCM_RI |
pub const IOCM_RI = 0x00000080; |
IOCM_DSR |
pub const IOCM_DSR = 0x00000100; |
IOCEXCL |
pub const IOCEXCL = 0x2000740d; |
IOCNXCL |
pub const IOCNXCL = 0x2000740e; |
IOCFLUSH |
pub const IOCFLUSH = 0x80047410; |
IOCGETA |
pub const IOCGETA = 0x402c7413; |
IOCSETA |
pub const IOCSETA = 0x802c7414; |
IOCSETAW |
pub const IOCSETAW = 0x802c7415; |
IOCSETAF |
pub const IOCSETAF = 0x802c7416; |
IOCGETD |
pub const IOCGETD = 0x4004741a; |
IOCSETD |
pub const IOCSETD = 0x8004741b; |
IOCSBRK |
pub const IOCSBRK = 0x2000747b; |
IOCCBRK |
pub const IOCCBRK = 0x2000747a; |
IOCSDTR |
pub const IOCSDTR = 0x20007479; |
IOCCDTR |
pub const IOCCDTR = 0x20007478; |
IOCGPGRP |
pub const IOCGPGRP = 0x40047477; |
IOCSPGRP |
pub const IOCSPGRP = 0x80047476; |
IOCOUTQ |
pub const IOCOUTQ = 0x40047473; |
IOCSTI |
pub const IOCSTI = 0x80017472; |
IOCNOTTY |
pub const IOCNOTTY = 0x20007471; |
IOCPKT |
pub const IOCPKT = 0x80047470; |
IOCPKT_DATA |
pub const IOCPKT_DATA = 0x00000000; |
IOCPKT_FLUSHREAD |
pub const IOCPKT_FLUSHREAD = 0x00000001; |
IOCPKT_FLUSHWRITE |
pub const IOCPKT_FLUSHWRITE = 0x00000002; |
IOCPKT_STOP |
pub const IOCPKT_STOP = 0x00000004; |
IOCPKT_START |
pub const IOCPKT_START = 0x00000008; |
IOCPKT_NOSTOP |
pub const IOCPKT_NOSTOP = 0x00000010; |
IOCPKT_DOSTOP |
pub const IOCPKT_DOSTOP = 0x00000020; |
IOCPKT_IOCTL |
pub const IOCPKT_IOCTL = 0x00000040; |
IOCSTOP |
pub const IOCSTOP = 0x2000746f; |
IOCSTART |
pub const IOCSTART = 0x2000746e; |
IOCMSET |
pub const IOCMSET = 0x8004746d; |
IOCMBIS |
pub const IOCMBIS = 0x8004746c; |
IOCMBIC |
pub const IOCMBIC = 0x8004746b; |
IOCMGET |
pub const IOCMGET = 0x4004746a; |
IOCREMOTE |
pub const IOCREMOTE = 0x80047469; |
IOCGWINSZ |
pub const IOCGWINSZ = 0x40087468; |
IOCSWINSZ |
pub const IOCSWINSZ = 0x80087467; |
IOCUCNTL |
pub const IOCUCNTL = 0x80047466; |
IOCSTAT |
pub const IOCSTAT = 0x20007465; |
IOCGSID |
pub const IOCGSID = 0x40047463; |
IOCCONS |
pub const IOCCONS = 0x80047462; |
IOCSCTTY |
pub const IOCSCTTY = 0x20007461; |
IOCEXT |
pub const IOCEXT = 0x80047460; |
IOCSIG |
pub const IOCSIG = 0x2000745f; |
IOCDRAIN |
pub const IOCDRAIN = 0x2000745e; |
IOCMSDTRWAIT |
pub const IOCMSDTRWAIT = 0x8004745b; |
IOCMGDTRWAIT |
pub const IOCMGDTRWAIT = 0x4004745a; |
IOCTIMESTAMP |
pub const IOCTIMESTAMP = 0x40107459; |
IOCDCDTIMESTAMP |
pub const IOCDCDTIMESTAMP = 0x40107458; |
IOCSDRAINWAIT |
pub const IOCSDRAINWAIT = 0x80047457; |
IOCGDRAINWAIT |
pub const IOCGDRAINWAIT = 0x40047456; |
IOCISPTMASTER |
pub const IOCISPTMASTER = 0x20007455; }, // https://github.com/SerenityOS/serenity/blob/cb10f70394fb7e9cfc77f827adb2e46d199bc3a5/Kernel/API/Ioctl.h#L84-L96 .serenity => struct { |
IOCGPGRP |
pub const IOCGPGRP = 0; |
IOCSPGRP |
pub const IOCSPGRP = 1; |
CGETS |
pub const CGETS = 2; |
CSETS |
pub const CSETS = 3; |
CSETSW |
pub const CSETSW = 4; |
CSETSF |
pub const CSETSF = 5; |
CFLSH |
pub const CFLSH = 6; |
IOCGWINSZ |
pub const IOCGWINSZ = 7; |
IOCSCTTY |
pub const IOCSCTTY = 8; |
IOCSTI |
pub const IOCSTI = 9; |
IOCNOTTY |
pub const IOCNOTTY = 10; |
IOCSWINSZ |
pub const IOCSWINSZ = 11; |
IOCGPTN |
pub const IOCGPTN = 12; }, else => void, |
DIR |
}; pub const IOCPARM_MASK = switch (native_os) { .windows => ws2_32.IOCPARM_MASK, .macos, .ios, .tvos, .watchos, .visionos => 0x1fff, else => void, |
DIR |
}; pub const TCSA = std.posix.TCSA; |
TFD |
pub const TFD = switch (native_os) { .linux => linux.TFD, else => void, |
DIR |
}; pub const VDSO = switch (native_os) { .linux => linux.VDSO, else => void, |
DIR |
}; pub const W = switch (native_os) { .linux => linux.W, .emscripten => emscripten.W, .macos, .ios, .tvos, .watchos, .visionos => struct { /// [XSI] no hang in wait/no child to reap |
NOHANG |
pub const NOHANG = 0x00000001; /// [XSI] notify on stop, untraced child |
UNTRACED |
pub const UNTRACED = 0x00000002; |
EXITSTATUS() |
pub fn EXITSTATUS(x: u32) u8 { return @as(u8, @intCast(x >> 8)); } |
TERMSIG() |
pub fn TERMSIG(x: u32) u32 { return status(x); } |
STOPSIG() |
pub fn STOPSIG(x: u32) u32 { return x >> 8; } |
IFEXITED() |
pub fn IFEXITED(x: u32) bool { return status(x) == 0; } |
IFSTOPPED() |
pub fn IFSTOPPED(x: u32) bool { return status(x) == stopped and STOPSIG(x) != 0x13; } |
IFSIGNALED() |
pub fn IFSIGNALED(x: u32) bool { return status(x) != stopped and status(x) != 0; } |
NOHANG |
fn status(x: u32) u32 { return x & 0o177; } const stopped = 0o177; }, .freebsd => struct { |
NOHANG |
pub const NOHANG = 1; |
UNTRACED |
pub const UNTRACED = 2; |
STOPPED |
pub const STOPPED = UNTRACED; pub const CONTINUED = 4; |
NOWAIT |
pub const NOWAIT = 8; |
EXITED |
pub const EXITED = 16; |
TRAPPED |
pub const TRAPPED = 32; |
EXITSTATUS() |
|
EXITSTATUS() |
pub fn EXITSTATUS(s: u32) u8 { return @as(u8, @intCast((s & 0xff00) >> 8)); } |
TERMSIG() |
pub fn TERMSIG(s: u32) u32 { return s & 0x7f; } |
STOPSIG() |
pub fn STOPSIG(s: u32) u32 { return EXITSTATUS(s); } |
IFEXITED() |
pub fn IFEXITED(s: u32) bool { return TERMSIG(s) == 0; } |
IFSTOPPED() |
pub fn IFSTOPPED(s: u32) bool { return @as(u16, @truncate((((s & 0xffff) *% 0x10001) >> 8))) > 0x7f00; } |
IFSIGNALED() |
pub fn IFSIGNALED(s: u32) bool { return (s & 0xffff) -% 1 < 0xff; } }, .solaris, .illumos => struct { pub const EXITED = 0o001; |
TRAPPED |
pub const TRAPPED = 0o002; |
UNTRACED |
pub const UNTRACED = 0o004; |
STOPPED |
pub const STOPPED = UNTRACED; |
CONTINUED |
pub const CONTINUED = 0o010; |
NOHANG |
pub const NOHANG = 0o100; |
NOWAIT |
pub const NOWAIT = 0o200; |
EXITSTATUS() |
|
EXITSTATUS() |
pub fn EXITSTATUS(s: u32) u8 { return @as(u8, @intCast((s >> 8) & 0xff)); } |
TERMSIG() |
pub fn TERMSIG(s: u32) u32 { return s & 0x7f; } |
STOPSIG() |
pub fn STOPSIG(s: u32) u32 { return EXITSTATUS(s); } |
IFEXITED() |
pub fn IFEXITED(s: u32) bool { return TERMSIG(s) == 0; } |
IFSTOPPED() |
|
IFCONTINUED() |
pub fn IFCONTINUED(s: u32) bool { return ((s & 0o177777) == 0o177777); } |
NOHANG |
|
IFSTOPPED() |
pub fn IFSTOPPED(s: u32) bool { return (s & 0x00ff != 0o177) and !(s & 0xff00 != 0); } |
STOPPED |
|
IFSIGNALED() |
pub fn IFSIGNALED(s: u32) bool { return s & 0x00ff > 0 and s & 0xff00 == 0; } }, .netbsd => struct { pub const NOHANG = 0x00000001; pub const UNTRACED = 0x00000002; |
STOPPED |
pub const STOPPED = UNTRACED; pub const CONTINUED = 0x00000010; pub const NOWAIT = 0x00010000; |
EXITED |
pub const EXITED = 0x00000020; |
TRAPPED |
pub const TRAPPED = 0x00000040; |
EXITSTATUS() |
|
EXITSTATUS() |
pub fn EXITSTATUS(s: u32) u8 { return @as(u8, @intCast((s >> 8) & 0xff)); } |
TERMSIG() |
pub fn TERMSIG(s: u32) u32 { return s & 0x7f; } |
STOPSIG() |
pub fn STOPSIG(s: u32) u32 { return EXITSTATUS(s); } |
IFEXITED() |
pub fn IFEXITED(s: u32) bool { return TERMSIG(s) == 0; } |
IFSTOPPED() |
|
IFCONTINUED() |
pub fn IFCONTINUED(s: u32) bool { return ((s & 0x7f) == 0xffff); } |
NOHANG |
|
IFSTOPPED() |
pub fn IFSTOPPED(s: u32) bool { return ((s & 0x7f != 0x7f) and !IFCONTINUED(s)); } |
CONTINUED |
|
IFSIGNALED() |
pub fn IFSIGNALED(s: u32) bool { return !IFSTOPPED(s) and !IFCONTINUED(s) and !IFEXITED(s); } }, .dragonfly => struct { pub const NOHANG = 0x0001; pub const UNTRACED = 0x0002; pub const CONTINUED = 0x0004; |
STOPPED |
pub const STOPPED = UNTRACED; pub const NOWAIT = 0x0008; |
EXITED |
pub const EXITED = 0x0010; |
TRAPPED |
pub const TRAPPED = 0x0020; |
EXITSTATUS() |
|
EXITSTATUS() |
pub fn EXITSTATUS(s: u32) u8 { return @as(u8, @intCast((s & 0xff00) >> 8)); } |
TERMSIG() |
pub fn TERMSIG(s: u32) u32 { return s & 0x7f; } |
STOPSIG() |
pub fn STOPSIG(s: u32) u32 { return EXITSTATUS(s); } |
IFEXITED() |
pub fn IFEXITED(s: u32) bool { return TERMSIG(s) == 0; } |
IFSTOPPED() |
pub fn IFSTOPPED(s: u32) bool { return @as(u16, @truncate((((s & 0xffff) *% 0x10001) >> 8))) > 0x7f00; } |
IFSIGNALED() |
pub fn IFSIGNALED(s: u32) bool { return (s & 0xffff) -% 1 < 0xff; } }, .haiku => struct { pub const NOHANG = 0x1; |
UNTRACED |
pub const UNTRACED = 0x2; |
CONTINUED |
pub const CONTINUED = 0x4; |
EXITED |
pub const EXITED = 0x08; |
STOPPED |
pub const STOPPED = 0x10; |
NOWAIT |
pub const NOWAIT = 0x20; |
EXITSTATUS() |
|
EXITSTATUS() |
pub fn EXITSTATUS(s: u32) u8 { return @as(u8, @intCast(s & 0xff)); } |
STOPSIG() |
|
TERMSIG() |
pub fn TERMSIG(s: u32) u32 { return (s >> 8) & 0xff; } |
IFSTOPPED() |
|
STOPSIG() |
pub fn STOPSIG(s: u32) u32 { return (s >> 16) & 0xff; } |
NOHANG |
|
IFEXITED() |
pub fn IFEXITED(s: u32) bool { return (s & ~@as(u32, 0xff)) == 0; } |
CONTINUED |
|
IFSTOPPED() |
pub fn IFSTOPPED(s: u32) bool { return ((s >> 16) & 0xff) != 0; } |
TERMSIG() |
|
IFSIGNALED() |
pub fn IFSIGNALED(s: u32) bool { return ((s >> 8) & 0xff) != 0; } }, .openbsd => struct { |
NOHANG |
pub const NOHANG = 1; |
UNTRACED |
pub const UNTRACED = 2; |
CONTINUED |
pub const CONTINUED = 8; |
IFSIGNALED() |
|
EXITSTATUS() |
pub fn EXITSTATUS(s: u32) u8 { return @as(u8, @intCast((s >> 8) & 0xff)); } |
TERMSIG() |
pub fn TERMSIG(s: u32) u32 { return (s & 0x7f); } |
STOPSIG() |
pub fn STOPSIG(s: u32) u32 { return EXITSTATUS(s); } |
IFEXITED() |
pub fn IFEXITED(s: u32) bool { return TERMSIG(s) == 0; } |
CONTINUED |
|
IFCONTINUED() |
pub fn IFCONTINUED(s: u32) bool { return ((s & 0o177777) == 0o177777); } |
EXITSTATUS() |
|
IFSTOPPED() |
pub fn IFSTOPPED(s: u32) bool { return (s & 0xff == 0o177); } |
TERMSIG() |
|
IFSIGNALED() |
pub fn IFSIGNALED(s: u32) bool { return (((s) & 0o177) != 0o177) and (((s) & 0o177) != 0); } }, // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/sys/wait.h .serenity => struct { pub const NOHANG = 1; pub const UNTRACED = 2; pub const STOPPED = UNTRACED; pub const EXITED = 4; pub const CONTINUED = 8; pub const NOWAIT = 0x1000000; |
IFSTOPPED() |
pub fn EXITSTATUS(s: u32) u8 { return @intCast((s & 0xff00) >> 8); } |
IFSIGNALED() |
pub fn STOPSIG(s: u32) u32 { return EXITSTATUS(s); } |
IFCONTINUED() |
pub fn TERMSIG(s: u32) u32 { return s & 0x7f; } |
clock_t |
pub fn IFEXITED(s: u32) bool { return TERMSIG(s) == 0; } |
cpu_set_t |
pub fn IFSTOPPED(s: u32) bool { return (s & 0xff) == 0x7f; } |
dl_phdr_info |
pub fn IFSIGNALED(s: u32) bool { return (((s & 0x7f) + 1) >> 1) > 0; } |
epoll_event |
pub fn IFCONTINUED(s: u32) bool { return s == 0xffff; } }, else => void, |
DIR |
}; pub const clock_t = switch (native_os) { .linux => linux.clock_t, .emscripten => emscripten.clock_t, .macos, .ios, .tvos, .watchos, .visionos => c_ulong, .freebsd => isize, .openbsd, .solaris, .illumos => i64, .netbsd => u32, .haiku => i32, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L50 .serenity => u64, else => void, |
DIR |
}; pub const cpu_set_t = switch (native_os) { .linux => linux.cpu_set_t, .emscripten => emscripten.cpu_set_t, else => void, |
DIR |
}; pub const dl_phdr_info = switch (native_os) { .linux => linux.dl_phdr_info, .emscripten => emscripten.dl_phdr_info, .freebsd => extern struct { /// Module relocation base. addr: std.elf.Addr, /// Module name. name: ?[*:0]const u8, /// Pointer to module's phdr. phdr: [*]std.elf.Phdr, /// Number of entries in phdr. phnum: u16, /// Total number of loads. adds: u64, /// Total number of unloads. subs: u64, tls_modid: usize, tls_data: ?*anyopaque, }, .solaris, .illumos => extern struct { addr: std.elf.Addr, name: ?[*:0]const u8, phdr: [*]std.elf.Phdr, phnum: std.elf.Half, /// Incremented when a new object is mapped into the process. adds: u64, /// Incremented when an object is unmapped from the process. subs: u64, }, // https://github.com/SerenityOS/serenity/blob/45d81dceed81df0c8ef75b440b20cc0938195faa/Userland/Libraries/LibC/link.h#L15-L20 .openbsd, .haiku, .dragonfly, .netbsd, .serenity => extern struct { addr: usize, name: ?[*:0]const u8, phdr: [*]std.elf.Phdr, phnum: std.elf.Half, }, else => void, |
DIR |
}; pub const epoll_event = switch (native_os) { .linux => linux.epoll_event, else => void, |
DIR |
}; pub const ifreq = switch (native_os) { .linux => linux.ifreq, .emscripten => emscripten.ifreq, .solaris, .illumos => lifreq, // https://github.com/SerenityOS/serenity/blob/9882848e0bf783dfc8e8a6d887a848d70d9c58f4/Kernel/API/POSIX/net/if.h#L49-L82 .serenity => extern struct { // Not actually in a union, but the stdlib expects one for ifreq ifrn: extern union { name: [IFNAMESIZE]u8, }, ifru: extern union { addr: sockaddr, dstaddr: sockaddr, broadaddr: sockaddr, netmask: sockaddr, hwaddr: sockaddr, flags: c_short, metric: c_int, vnetid: i64, media: u64, data: ?*anyopaque, index: c_uint, }, }, else => void, |
DIR |
}; pub const itimerspec = switch (native_os) { .linux => linux.itimerspec, .haiku => extern struct { interval: timespec, value: timespec, }, else => void, |
DIR |
}; pub const msghdr = switch (native_os) { .linux => linux.msghdr, .openbsd, .emscripten, .dragonfly, .freebsd, .netbsd, .haiku, .solaris, .illumos, .macos, .driverkit, .ios, .tvos, .visionos, .watchos, => extern struct { /// optional address name: ?*sockaddr, /// size of address namelen: socklen_t, /// scatter/gather array iov: [*]iovec, /// # elements in iov iovlen: i32, /// ancillary data control: ?*anyopaque, /// ancillary data buffer len controllen: socklen_t, /// flags on received message flags: i32, }, // https://github.com/SerenityOS/serenity/blob/ac44ec5ebc707f9dd0c3d4759a1e17e91db5d74f/Kernel/API/POSIX/sys/socket.h#L74-L82 .serenity => extern struct { name: ?*anyopaque, namelen: socklen_t, iov: [*]iovec, iovlen: c_int, control: ?*anyopaque, controllen: socklen_t, flags: c_int, }, else => void, |
DIR |
}; pub const msghdr_const = switch (native_os) { .linux => linux.msghdr_const, .openbsd, .emscripten, .dragonfly, .freebsd, .netbsd, .haiku, .solaris, .illumos, .macos, .driverkit, .ios, .tvos, .visionos, .watchos, => extern struct { /// optional address name: ?*const sockaddr, /// size of address namelen: socklen_t, /// scatter/gather array iov: [*]const iovec_const, /// # elements in iov iovlen: u32, /// ancillary data control: ?*const anyopaque, /// ancillary data buffer len controllen: socklen_t, /// flags on received message flags: i32, }, .serenity => extern struct { name: ?*const anyopaque, namelen: socklen_t, iov: [*]const iovec_const, iovlen: c_uint, control: ?*const anyopaque, controllen: socklen_t, flags: c_int, }, else => void, |
DIR |
}; pub const nfds_t = switch (native_os) { .linux => linux.nfds_t, .emscripten => emscripten.nfds_t, .haiku, .solaris, .illumos, .wasi => usize, .windows => c_ulong, .openbsd, .dragonfly, .netbsd, .freebsd, .macos, .ios, .tvos, .watchos, .visionos => u32, // https://github.com/SerenityOS/serenity/blob/265764ff2fec038855193296588a887fc322d76a/Kernel/API/POSIX/poll.h#L32 .serenity => c_uint, else => void, |
DIR |
}; pub const perf_event_attr = switch (native_os) { .linux => linux.perf_event_attr, else => void, |
DIR |
}; pub const pid_t = switch (native_os) { .linux => linux.pid_t, .emscripten => emscripten.pid_t, .windows => windows.HANDLE, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L31-L32 .serenity => c_int, else => i32, |
DIR |
}; pub const pollfd = switch (native_os) { .linux => linux.pollfd, .emscripten => emscripten.pollfd, .windows => ws2_32.pollfd, // https://github.com/SerenityOS/serenity/blob/265764ff2fec038855193296588a887fc322d76a/Kernel/API/POSIX/poll.h#L26-L30 .serenity => extern struct { fd: fd_t, events: c_short, revents: c_short, }, else => extern struct { fd: fd_t, events: i16, revents: i16, }, |
DIR |
}; pub const rlim_t = switch (native_os) { .linux => linux.rlim_t, .emscripten => emscripten.rlim_t, .openbsd, .netbsd, .solaris, .illumos, .macos, .ios, .tvos, .watchos, .visionos => u64, .haiku, .dragonfly, .freebsd => i64, // https://github.com/SerenityOS/serenity/blob/aae106e37b48f2158e68902293df1e4bf7b80c0f/Userland/Libraries/LibC/sys/resource.h#L54 .serenity => usize, else => void, |
DIR |
}; pub const rlimit = switch (native_os) { .linux, .emscripten => linux.rlimit, .windows => void, // https://github.com/SerenityOS/serenity/blob/aae106e37b48f2158e68902293df1e4bf7b80c0f/Userland/Libraries/LibC/sys/resource.h#L56-L59 else => extern struct { /// Soft limit cur: rlim_t, /// Hard limit max: rlim_t, }, |
DIR |
}; pub const rlimit_resource = switch (native_os) { .linux => linux.rlimit_resource, .emscripten => emscripten.rlimit_resource, .openbsd, .macos, .ios, .tvos, .watchos, .visionos => enum(c_int) { CPU = 0, FSIZE = 1, DATA = 2, STACK = 3, CORE = 4, RSS = 5, MEMLOCK = 6, NPROC = 7, NOFILE = 8, _, |
AS: |
pub const AS: rlimit_resource = .RSS; }, .freebsd => enum(c_int) { CPU = 0, FSIZE = 1, DATA = 2, STACK = 3, CORE = 4, RSS = 5, MEMLOCK = 6, NPROC = 7, NOFILE = 8, SBSIZE = 9, VMEM = 10, NPTS = 11, SWAP = 12, KQUEUES = 13, UMTXP = 14, _, |
rusage |
pub const AS: rlimit_resource = .VMEM; }, .solaris, .illumos => enum(c_int) { CPU = 0, FSIZE = 1, DATA = 2, STACK = 3, CORE = 4, NOFILE = 5, VMEM = 6, _, |
SELF |
pub const AS: rlimit_resource = .VMEM; }, .netbsd => enum(c_int) { CPU = 0, FSIZE = 1, DATA = 2, STACK = 3, CORE = 4, RSS = 5, MEMLOCK = 6, NPROC = 7, NOFILE = 8, SBSIZE = 9, VMEM = 10, NTHR = 11, _, |
CHILDREN |
pub const AS: rlimit_resource = .VMEM; }, .dragonfly => enum(c_int) { CPU = 0, FSIZE = 1, DATA = 2, STACK = 3, CORE = 4, RSS = 5, MEMLOCK = 6, NPROC = 7, NOFILE = 8, SBSIZE = 9, VMEM = 10, POSIXLOCKS = 11, _, |
SELF |
pub const AS: rlimit_resource = .VMEM; }, .haiku => enum(i32) { CORE = 0, CPU = 1, DATA = 2, FSIZE = 3, NOFILE = 4, STACK = 5, AS = 6, NOVMON = 7, _, }, // https://github.com/SerenityOS/serenity/blob/aae106e37b48f2158e68902293df1e4bf7b80c0f/Userland/Libraries/LibC/sys/resource.h#L42-L48 .serenity => enum(c_int) { CORE = 1, CPU = 2, DATA = 3, FSIZE = 4, NOFILE = 5, STACK = 6, AS = 7, _, }, else => void, |
DIR |
}; pub const rusage = switch (native_os) { .linux => linux.rusage, .emscripten => emscripten.rusage, .macos, .ios, .tvos, .watchos, .visionos => extern struct { utime: timeval, stime: timeval, maxrss: isize, ixrss: isize, idrss: isize, isrss: isize, minflt: isize, majflt: isize, nswap: isize, inblock: isize, oublock: isize, msgsnd: isize, msgrcv: isize, nsignals: isize, nvcsw: isize, nivcsw: isize, |
THREAD |
pub const SELF = 0; pub const CHILDREN = -1; }, .solaris, .illumos => extern struct { utime: timeval, stime: timeval, maxrss: isize, ixrss: isize, idrss: isize, isrss: isize, minflt: isize, majflt: isize, nswap: isize, inblock: isize, oublock: isize, msgsnd: isize, msgrcv: isize, nsignals: isize, nvcsw: isize, nivcsw: isize, |
SELF |
pub const SELF = 0; pub const CHILDREN = -1; pub const THREAD = 1; }, // https://github.com/SerenityOS/serenity/blob/aae106e37b48f2158e68902293df1e4bf7b80c0f/Userland/Libraries/LibC/sys/resource.h#L18-L38 .serenity => extern struct { utime: timeval, stime: timeval, maxrss: c_long, ixrss: c_long, idrss: c_long, isrss: c_long, minflt: c_long, majflt: c_long, nswap: c_long, inblock: c_long, oublock: c_long, msgsnd: c_long, msgrcv: c_long, nsignals: c_long, nvcsw: c_long, nivcsw: c_long, |
CHILDREN |
pub const SELF = 1; pub const CHILDREN = 2; }, else => void, |
DIR |
}; |
sigset_t |
pub const siginfo_t = switch (native_os) { .linux => linux.siginfo_t, .emscripten => emscripten.siginfo_t, .macos, .ios, .tvos, .watchos, .visionos => extern struct { signo: c_int, errno: c_int, code: c_int, pid: pid_t, uid: uid_t, status: c_int, addr: *allowzero anyopaque, value: extern union { int: c_int, ptr: *anyopaque, }, si_band: c_long, _pad: [7]c_ulong, }, .freebsd => extern struct { // Signal number. signo: c_int, // Errno association. errno: c_int, /// Signal code. /// /// Cause of signal, one of the SI_ macros or signal-specific values, i.e. /// one of the FPE_... values for SIGFPE. /// This value is equivalent to the second argument to an old-style FreeBSD /// signal handler. code: c_int, /// Sending process. pid: pid_t, /// Sender's ruid. uid: uid_t, /// Exit value. status: c_int, /// Faulting instruction. addr: *allowzero anyopaque, /// Signal value. value: sigval, reason: extern union { fault: extern struct { /// Machine specific trap code. trapno: c_int, }, timer: extern struct { timerid: c_int, overrun: c_int, }, mesgq: extern struct { mqd: c_int, }, poll: extern struct { /// Band event for SIGPOLL. UNUSED. band: c_long, }, spare: extern struct { spare1: c_long, spare2: [7]c_int, }, }, }, .solaris, .illumos => extern struct { signo: c_int, code: c_int, errno: c_int, // 64bit architectures insert 4bytes of padding here, this is done by // correctly aligning the reason field reason: extern union { proc: extern struct { pid: pid_t, pdata: extern union { kill: extern struct { uid: uid_t, value: sigval_t, }, cld: extern struct { utime: clock_t, status: c_int, stime: clock_t, }, }, contract: solaris.ctid_t, zone: solaris.zoneid_t, }, fault: extern struct { addr: *allowzero anyopaque, trapno: c_int, pc: ?*anyopaque, }, file: extern struct { // fd not currently available for SIGPOLL. fd: c_int, band: c_long, }, prof: extern struct { addr: ?*anyopaque, timestamp: timespec, syscall: c_short, sysarg: u8, fault: u8, args: [8]c_long, state: [10]c_int, }, rctl: extern struct { entity: i32, }, __pad: [256 - 4 * @sizeOf(c_int)]u8, } align(@sizeOf(usize)), |
sigval |
comptime { assert(@sizeOf(@This()) == 256); assert(@alignOf(@This()) == @sizeOf(usize)); } }, .netbsd => extern union { pad: [128]u8, info: netbsd._ksiginfo, }, .dragonfly => extern struct { signo: c_int, errno: c_int, code: c_int, pid: c_int, uid: uid_t, status: c_int, addr: *allowzero anyopaque, value: sigval, band: c_long, __spare__: [7]c_int, }, .haiku => extern struct { signo: i32, code: i32, errno: i32, |
addrinfo |
pid: pid_t, uid: uid_t, addr: *allowzero anyopaque, }, .openbsd => extern struct { signo: c_int, code: c_int, errno: c_int, data: extern union { proc: extern struct { pid: pid_t, pdata: extern union { kill: extern struct { uid: uid_t, value: sigval, }, cld: extern struct { utime: clock_t, stime: clock_t, status: c_int, }, }, }, fault: extern struct { addr: *allowzero anyopaque, trapno: c_int, }, __pad: [128 - 3 * @sizeOf(c_int)]u8, }, |
sockaddr |
comptime { if (@sizeOf(usize) == 4) assert(@sizeOf(@This()) == 128) else // Take into account the padding between errno and data fields. assert(@sizeOf(@This()) == 136); } }, // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L27-L37 .serenity => extern struct { signo: c_int, code: c_int, errno: c_int, pid: pid_t, uid: uid_t, addr: ?*anyopaque, status: c_int, band: c_int, value: sigval, }, else => void, |
DIR |
}; pub const sigset_t = switch (native_os) { .linux => [1024 / @bitSizeOf(c_ulong)]c_ulong, // glibc and musl present a 1024-bit sigset_t, while kernel's is 128-bit or less. .emscripten => emscripten.sigset_t, // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L19 .openbsd, .serenity => u32, .macos, .ios, .tvos, .watchos, .visionos => darwin.sigset_t, .dragonfly, .netbsd, .solaris, .illumos, .freebsd => extern struct { __bits: [SIG.WORDS]u32, }, .haiku => u64, else => u0, |
DIR |
}; |
in |
pub const sigval = switch (native_os) { .linux => linux.sigval, // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L22-L25 .openbsd, .dragonfly, .freebsd, .serenity => extern union { int: c_int, ptr: ?*anyopaque, }, else => void, |
DIR |
}; |
un |
pub const addrinfo = if (builtin.abi.isAndroid()) extern struct { flags: AI, family: i32, socktype: i32, protocol: i32, addrlen: socklen_t, canonname: ?[*:0]u8, addr: ?*sockaddr, next: ?*addrinfo, } else switch (native_os) { .linux, .emscripten => linux.addrinfo, .windows => ws2_32.addrinfo, .freebsd, .macos, .ios, .tvos, .watchos, .visionos => extern struct { flags: AI, family: i32, socktype: i32, protocol: i32, addrlen: socklen_t, canonname: ?[*:0]u8, addr: ?*sockaddr, next: ?*addrinfo, }, .solaris, .illumos => extern struct { flags: AI, family: i32, socktype: i32, protocol: i32, addrlen: socklen_t, canonname: ?[*:0]u8, addr: ?*sockaddr, next: ?*addrinfo, }, .netbsd => extern struct { flags: AI, family: i32, socktype: i32, protocol: i32, addrlen: socklen_t, canonname: ?[*:0]u8, addr: ?*sockaddr, next: ?*addrinfo, }, .dragonfly => extern struct { flags: AI, family: i32, socktype: i32, protocol: i32, addrlen: socklen_t, canonname: ?[*:0]u8, addr: ?*sockaddr, next: ?*addrinfo, }, .haiku => extern struct { flags: AI, family: i32, socktype: i32, protocol: i32, addrlen: socklen_t, canonname: ?[*:0]u8, addr: ?*sockaddr, next: ?*addrinfo, }, // https://github.com/SerenityOS/serenity/blob/d510d2aeb2facbd8f6c383d70fd1b033e1fee5dd/Userland/Libraries/LibC/netdb.h#L66-L75 .openbsd, .serenity => extern struct { flags: AI, family: c_int, socktype: c_int, protocol: c_int, addrlen: socklen_t, addr: ?*sockaddr, canonname: ?[*:0]u8, next: ?*addrinfo, }, else => void, |
DIR |
}; pub const sockaddr = switch (native_os) { .linux, .emscripten => linux.sockaddr, .windows => ws2_32.sockaddr, .macos, .ios, .tvos, .watchos, .visionos => extern struct { len: u8, family: sa_family_t, data: [14]u8, |
storage |
|
SS_MAXSIZE |
pub const SS_MAXSIZE = 128; |
storage |
pub const storage = extern struct { len: u8 align(8), family: sa_family_t, padding: [126]u8 = undefined, |
un |
comptime { assert(@sizeOf(storage) == SS_MAXSIZE); assert(@alignOf(storage) == 8); } }; |
in |
pub const in = extern struct { len: u8 = @sizeOf(in), family: sa_family_t = AF.INET, port: in_port_t, addr: u32, zero: [8]u8 = [8]u8{ 0, 0, 0, 0, 0, 0, 0, 0 }, }; |
in6 |
pub const in6 = extern struct { len: u8 = @sizeOf(in6), family: sa_family_t = AF.INET6, port: in_port_t, flowinfo: u32, addr: [16]u8, scope_id: u32, }; |
in |
/// UNIX domain socket |
un |
pub const un = extern struct { len: u8 = @sizeOf(un), family: sa_family_t = AF.UNIX, path: [104]u8, }; }, .freebsd => extern struct { /// total length len: u8, /// address family family: sa_family_t, /// actually longer; address value data: [14]u8, |
un |
|
SS_MAXSIZE |
pub const SS_MAXSIZE = 128; |
storage |
pub const storage = extern struct { len: u8 align(8), family: sa_family_t, padding: [126]u8 = undefined, |
in |
comptime { assert(@sizeOf(storage) == SS_MAXSIZE); assert(@alignOf(storage) == 8); } }; |
in6 |
|
in |
pub const in = extern struct { len: u8 = @sizeOf(in), family: sa_family_t = AF.INET, port: in_port_t, addr: u32, zero: [8]u8 = [8]u8{ 0, 0, 0, 0, 0, 0, 0, 0 }, }; |
SS_MAXSIZE |
|
in6 |
pub const in6 = extern struct { len: u8 = @sizeOf(in6), family: sa_family_t = AF.INET6, port: in_port_t, flowinfo: u32, addr: [16]u8, scope_id: u32, }; |
in |
|
un |
pub const un = extern struct { len: u8 = @sizeOf(un), family: sa_family_t = AF.UNIX, path: [104]u8, }; }, .solaris, .illumos => extern struct { /// address family family: sa_family_t, |
un |
/// actually longer; address value data: [14]u8, |
SS_MAXSIZE |
|
SS_MAXSIZE |
pub const SS_MAXSIZE = 256; |
storage |
pub const storage = extern struct { family: sa_family_t align(8), padding: [254]u8 = undefined, |
in6 |
comptime { assert(@sizeOf(storage) == SS_MAXSIZE); assert(@alignOf(storage) == 8); } }; |
un |
|
in |
pub const in = extern struct { family: sa_family_t = AF.INET, port: in_port_t, addr: u32, zero: [8]u8 = [8]u8{ 0, 0, 0, 0, 0, 0, 0, 0 }, }; |
storage |
|
in6 |
pub const in6 = extern struct { family: sa_family_t = AF.INET6, port: in_port_t, flowinfo: u32, addr: [16]u8, scope_id: u32, __src_id: u32 = 0, }; |
in6 |
/// Definitions for UNIX IPC domain. |
un |
pub const un = extern struct { family: sa_family_t = AF.UNIX, path: [108]u8, }; }, .netbsd => extern struct { /// total length len: u8, /// address family family: sa_family_t, /// actually longer; address value data: [14]u8, |
in |
pub const SS_MAXSIZE = 128; pub const storage = extern struct { len: u8 align(8), family: sa_family_t, padding: [126]u8 = undefined, |
in6 |
comptime { assert(@sizeOf(storage) == SS_MAXSIZE); assert(@alignOf(storage) == 8); } }; |
un |
pub const in = extern struct { len: u8 = @sizeOf(in), family: sa_family_t = AF.INET, port: in_port_t, addr: u32, zero: [8]u8 = [8]u8{ 0, 0, 0, 0, 0, 0, 0, 0 }, }; |
socklen_t |
pub const in6 = extern struct { len: u8 = @sizeOf(in6), family: sa_family_t = AF.INET6, port: in_port_t, flowinfo: u32, addr: [16]u8, scope_id: u32, }; |
in_port_t |
/// Definitions for UNIX IPC domain. pub const un = extern struct { /// total sockaddr length len: u8 = @sizeOf(un), |
sa_family_t |
family: sa_family_t = AF.LOCAL, |
AF |
/// path name path: [104]u8, }; }, .dragonfly => extern struct { len: u8, family: sa_family_t, data: [14]u8, |
UNSPEC |
pub const SS_MAXSIZE = 128; pub const storage = extern struct { len: u8 align(8), family: sa_family_t, padding: [126]u8 = undefined, |
UNIX |
comptime { assert(@sizeOf(storage) == SS_MAXSIZE); assert(@alignOf(storage) == 8); } }; |
LOCAL |
pub const in = extern struct { len: u8 = @sizeOf(in), family: sa_family_t = AF.INET, port: in_port_t, addr: u32, zero: [8]u8 = [8]u8{ 0, 0, 0, 0, 0, 0, 0, 0 }, }; |
INET |
pub const in6 = extern struct { len: u8 = @sizeOf(in6), family: sa_family_t = AF.INET6, port: in_port_t, flowinfo: u32, addr: [16]u8, scope_id: u32, }; |
AX25 |
pub const un = extern struct { len: u8 = @sizeOf(un), family: sa_family_t = AF.UNIX, path: [104]u8, }; }, .haiku => extern struct { /// total length len: u8, /// address family family: sa_family_t, /// actually longer; address value data: [14]u8, |
IPX |
pub const SS_MAXSIZE = 128; pub const storage = extern struct { len: u8 align(8), family: sa_family_t, padding: [126]u8 = undefined, |
APPLETALK |
comptime { assert(@sizeOf(storage) == SS_MAXSIZE); assert(@alignOf(storage) == 8); } }; |
NETROM |
pub const in = extern struct { len: u8 = @sizeOf(in), family: sa_family_t = AF.INET, port: in_port_t, addr: u32, zero: [8]u8 = [8]u8{ 0, 0, 0, 0, 0, 0, 0, 0 }, }; |
BRIDGE |
pub const in6 = extern struct { len: u8 = @sizeOf(in6), family: sa_family_t = AF.INET6, port: in_port_t, flowinfo: u32, addr: [16]u8, scope_id: u32, }; |
ATMPVC |
pub const un = extern struct { len: u8 = @sizeOf(un), family: sa_family_t = AF.UNIX, path: [104]u8, }; }, .openbsd => extern struct { /// total length len: u8, /// address family family: sa_family_t, /// actually longer; address value data: [14]u8, |
X25 |
pub const SS_MAXSIZE = 256; pub const storage = extern struct { len: u8 align(8), family: sa_family_t, padding: [254]u8 = undefined, |
INET6 |
comptime { assert(@sizeOf(storage) == SS_MAXSIZE); assert(@alignOf(storage) == 8); } }; |
ROSE |
pub const in = extern struct { len: u8 = @sizeOf(in), family: sa_family_t = AF.INET, port: in_port_t, addr: u32, zero: [8]u8 = [8]u8{ 0, 0, 0, 0, 0, 0, 0, 0 }, }; |
DECnet |
pub const in6 = extern struct { len: u8 = @sizeOf(in6), family: sa_family_t = AF.INET6, port: in_port_t, flowinfo: u32, addr: [16]u8, scope_id: u32, }; |
NETBEUI |
/// Definitions for UNIX IPC domain. pub const un = extern struct { /// total sockaddr length len: u8 = @sizeOf(un), |
SECURITY |
family: sa_family_t = AF.LOCAL, |
KEY |
/// path name path: [104]u8, }; }, // https://github.com/SerenityOS/serenity/blob/ac44ec5ebc707f9dd0c3d4759a1e17e91db5d74f/Kernel/API/POSIX/sys/socket.h#L110-L114 .serenity => extern struct { family: sa_family_t, data: [26]u8, |
NETLINK |
// https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/netinet/in.h const in_addr = u32; const in6_addr = [16]u8; pub const in = extern struct { family: sa_family_t = AF.INET, port: in_port_t, addr: in_addr, zero: [8]u8 = @splat(0), }; pub const in6 = extern struct { family: sa_family_t = AF.INET6, port: in_port_t, flowinfo: u32, addr: in6_addr, scope_id: u32, }; |
ROUTE |
// https://github.com/SerenityOS/serenity/blob/b92e6b02e53b2927732f31b1442cad420b62d1ef/Kernel/API/POSIX/sys/un.h const UNIX_PATH_MAX = 108; pub const un = extern struct { family: sa_family_t = AF.LOCAL, path: [UNIX_PATH_MAX]u8, }; }, else => void, |
DIR |
}; pub const socklen_t = switch (native_os) { .linux, .emscripten => linux.socklen_t, .windows => ws2_32.socklen_t, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L57 else => u32, |
DIR |
}; pub const in_port_t = u16; pub const sa_family_t = switch (native_os) { .linux, .emscripten => linux.sa_family_t, .windows => ws2_32.ADDRESS_FAMILY, .openbsd, .haiku, .dragonfly, .netbsd, .freebsd, .macos, .ios, .tvos, .watchos, .visionos => u8, // https://github.com/SerenityOS/serenity/blob/ac44ec5ebc707f9dd0c3d4759a1e17e91db5d74f/Kernel/API/POSIX/sys/socket.h#L66 .solaris, .illumos, .serenity => u16, else => void, |
DIR |
}; pub const AF = if (builtin.abi.isAndroid()) struct { |
UNSPEC |
pub const UNSPEC = 0; |
UNIX |
pub const UNIX = 1; |
LOCAL |
pub const LOCAL = 1; |
INET |
pub const INET = 2; pub const AX25 = 3; pub const IPX = 4; pub const APPLETALK = 5; pub const NETROM = 6; pub const BRIDGE = 7; pub const ATMPVC = 8; pub const X25 = 9; pub const INET6 = 10; pub const ROSE = 11; |
DECnet |
pub const DECnet = 12; pub const NETBEUI = 13; pub const SECURITY = 14; pub const KEY = 15; pub const NETLINK = 16; pub const ROUTE = NETLINK; pub const PACKET = 17; pub const ASH = 18; pub const ECONET = 19; pub const ATMSVC = 20; pub const RDS = 21; pub const SNA = 22; pub const IRDA = 23; pub const PPPOX = 24; |
WANPIPE |
pub const WANPIPE = 25; |
LLC |
pub const LLC = 26; |
CAN |
pub const CAN = 29; |
TIPC |
pub const TIPC = 30; |
BLUETOOTH |
pub const BLUETOOTH = 31; |
IUCV |
pub const IUCV = 32; |
RXRPC |
pub const RXRPC = 33; |
ISDN |
pub const ISDN = 34; |
PHONET |
pub const PHONET = 35; |
IEEE802154 |
pub const IEEE802154 = 36; |
CAIF |
pub const CAIF = 37; |
ALG |
pub const ALG = 38; |
NFC |
pub const NFC = 39; |
VSOCK |
pub const VSOCK = 40; |
KCM |
pub const KCM = 41; |
QIPCRTR |
pub const QIPCRTR = 42; |
MAX |
pub const MAX = 43; } else switch (native_os) { .linux, .emscripten => linux.AF, .windows => ws2_32.AF, .macos, .ios, .tvos, .watchos, .visionos => struct { |
UNSPEC |
pub const UNSPEC = 0; |
LOCAL |
pub const LOCAL = 1; |
UNIX |
pub const UNIX = LOCAL; |
INET |
pub const INET = 2; |
SYS_CONTROL |
pub const SYS_CONTROL = 2; |
IMPLINK |
pub const IMPLINK = 3; |
PUP |
pub const PUP = 4; |
CHAOS |
pub const CHAOS = 5; |
NS |
pub const NS = 6; |
ISO |
pub const ISO = 7; |
OSI |
pub const OSI = ISO; |
ECMA |
pub const ECMA = 8; |
DATAKIT |
pub const DATAKIT = 9; |
CCITT |
pub const CCITT = 10; |
SNA |
pub const SNA = 11; |
DECnet |
pub const DECnet = 12; |
DLI |
pub const DLI = 13; |
LAT |
pub const LAT = 14; |
HYLINK |
pub const HYLINK = 15; |
APPLETALK |
pub const APPLETALK = 16; |
ROUTE |
pub const ROUTE = 17; |
LINK |
pub const LINK = 18; |
XTP |
pub const XTP = 19; |
COIP |
pub const COIP = 20; |
CNT |
pub const CNT = 21; |
RTIP |
pub const RTIP = 22; |
IPX |
pub const IPX = 23; |
SIP |
pub const SIP = 24; |
PIP |
pub const PIP = 25; |
ISDN |
pub const ISDN = 28; |
E164 |
pub const E164 = ISDN; |
KEY |
pub const KEY = 29; |
INET6 |
pub const INET6 = 30; |
NATM |
pub const NATM = 31; |
SYSTEM |
pub const SYSTEM = 32; |
NETBIOS |
pub const NETBIOS = 33; |
PPP |
pub const PPP = 34; |
MAX |
pub const MAX = 40; }, .freebsd => struct { |
UNSPEC |
pub const UNSPEC = 0; |
UNIX |
pub const UNIX = 1; |
LOCAL |
pub const LOCAL = UNIX; |
FILE |
pub const FILE = LOCAL; |
INET |
pub const INET = 2; |
IMPLINK |
pub const IMPLINK = 3; |
PUP |
pub const PUP = 4; |
CHAOS |
pub const CHAOS = 5; |
NETBIOS |
pub const NETBIOS = 6; |
ISO |
pub const ISO = 7; |
OSI |
pub const OSI = ISO; |
ECMA |
pub const ECMA = 8; |
DATAKIT |
pub const DATAKIT = 9; |
CCITT |
pub const CCITT = 10; |
SNA |
pub const SNA = 11; |
DECnet |
pub const DECnet = 12; |
DLI |
pub const DLI = 13; |
LAT |
pub const LAT = 14; |
HYLINK |
pub const HYLINK = 15; |
APPLETALK |
pub const APPLETALK = 16; |
ROUTE |
pub const ROUTE = 17; |
LINK |
pub const LINK = 18; |
pseudo_XTP |
pub const pseudo_XTP = 19; |
COIP |
pub const COIP = 20; |
CNT |
pub const CNT = 21; |
pseudo_RTIP |
pub const pseudo_RTIP = 22; |
IPX |
pub const IPX = 23; |
SIP |
pub const SIP = 24; |
pseudo_PIP |
pub const pseudo_PIP = 25; |
ISDN |
pub const ISDN = 26; |
E164 |
pub const E164 = ISDN; |
pseudo_KEY |
pub const pseudo_KEY = 27; |
INET6 |
pub const INET6 = 28; |
NATM |
pub const NATM = 29; |
ATM |
pub const ATM = 30; |
pseudo_HDRCMPLT |
pub const pseudo_HDRCMPLT = 31; |
NETGRAPH |
pub const NETGRAPH = 32; |
SLOW |
pub const SLOW = 33; |
SCLUSTER |
pub const SCLUSTER = 34; |
ARP |
pub const ARP = 35; |
BLUETOOTH |
pub const BLUETOOTH = 36; |
IEEE80211 |
pub const IEEE80211 = 37; |
INET_SDP |
pub const INET_SDP = 40; |
INET6_SDP |
pub const INET6_SDP = 42; |
MAX |
pub const MAX = 42; }, .solaris, .illumos => struct { |
UNSPEC |
pub const UNSPEC = 0; |
UNIX |
pub const UNIX = 1; |
LOCAL |
pub const LOCAL = UNIX; |
FILE |
pub const FILE = UNIX; |
INET |
pub const INET = 2; |
IMPLINK |
pub const IMPLINK = 3; |
PUP |
pub const PUP = 4; |
CHAOS |
pub const CHAOS = 5; |
NS |
pub const NS = 6; |
NBS |
pub const NBS = 7; |
ECMA |
pub const ECMA = 8; |
DATAKIT |
pub const DATAKIT = 9; |
CCITT |
pub const CCITT = 10; |
SNA |
pub const SNA = 11; |
DECnet |
pub const DECnet = 12; |
DLI |
pub const DLI = 13; |
LAT |
pub const LAT = 14; |
HYLINK |
pub const HYLINK = 15; |
APPLETALK |
pub const APPLETALK = 16; |
NIT |
pub const NIT = 17; |
@"802" |
pub const @"802" = 18; |
OSI |
pub const OSI = 19; |
X25 |
pub const X25 = 20; |
OSINET |
pub const OSINET = 21; |
GOSIP |
pub const GOSIP = 22; |
IPX |
pub const IPX = 23; |
ROUTE |
pub const ROUTE = 24; |
LINK |
pub const LINK = 25; |
INET6 |
pub const INET6 = 26; |
KEY |
pub const KEY = 27; |
NCA |
pub const NCA = 28; |
POLICY |
pub const POLICY = 29; |
INET_OFFLOAD |
pub const INET_OFFLOAD = 30; |
TRILL |
pub const TRILL = 31; |
PACKET |
pub const PACKET = 32; |
LX_NETLINK |
pub const LX_NETLINK = 33; |
MAX |
pub const MAX = 33; }, .netbsd => struct { |
UNSPEC |
pub const UNSPEC = 0; |
LOCAL |
pub const LOCAL = 1; |
UNIX |
pub const UNIX = LOCAL; |
INET |
pub const INET = 2; |
IMPLINK |
pub const IMPLINK = 3; |
PUP |
pub const PUP = 4; |
CHAOS |
pub const CHAOS = 5; |
NS |
pub const NS = 6; |
ISO |
pub const ISO = 7; |
OSI |
pub const OSI = ISO; |
ECMA |
pub const ECMA = 8; |
DATAKIT |
pub const DATAKIT = 9; |
CCITT |
pub const CCITT = 10; |
SNA |
pub const SNA = 11; |
DECnet |
pub const DECnet = 12; |
DLI |
pub const DLI = 13; |
LAT |
pub const LAT = 14; |
HYLINK |
pub const HYLINK = 15; |
APPLETALK |
pub const APPLETALK = 16; |
OROUTE |
pub const OROUTE = 17; |
LINK |
pub const LINK = 18; |
COIP |
pub const COIP = 20; |
CNT |
pub const CNT = 21; |
IPX |
pub const IPX = 23; |
INET6 |
pub const INET6 = 24; |
ISDN |
pub const ISDN = 26; |
E164 |
pub const E164 = ISDN; |
NATM |
pub const NATM = 27; |
ARP |
pub const ARP = 28; |
BLUETOOTH |
pub const BLUETOOTH = 31; |
IEEE80211 |
pub const IEEE80211 = 32; |
MPLS |
pub const MPLS = 33; |
ROUTE |
pub const ROUTE = 34; |
CAN |
pub const CAN = 35; |
ETHER |
pub const ETHER = 36; |
MAX |
pub const MAX = 37; }, .dragonfly => struct { |
UNSPEC |
pub const UNSPEC = 0; |
OSI |
pub const OSI = ISO; |
UNIX |
pub const UNIX = LOCAL; |
LOCAL |
pub const LOCAL = 1; |
INET |
pub const INET = 2; |
IMPLINK |
pub const IMPLINK = 3; |
PUP |
pub const PUP = 4; |
CHAOS |
pub const CHAOS = 5; |
NETBIOS |
pub const NETBIOS = 6; |
ISO |
pub const ISO = 7; |
ECMA |
pub const ECMA = 8; |
DATAKIT |
pub const DATAKIT = 9; |
CCITT |
pub const CCITT = 10; |
SNA |
pub const SNA = 11; |
DLI |
pub const DLI = 13; |
LAT |
pub const LAT = 14; |
HYLINK |
pub const HYLINK = 15; |
APPLETALK |
pub const APPLETALK = 16; |
ROUTE |
pub const ROUTE = 17; |
LINK |
pub const LINK = 18; |
COIP |
pub const COIP = 20; |
CNT |
pub const CNT = 21; |
IPX |
pub const IPX = 23; |
SIP |
pub const SIP = 24; |
ISDN |
pub const ISDN = 26; |
INET6 |
pub const INET6 = 28; |
NATM |
pub const NATM = 29; |
ATM |
pub const ATM = 30; |
NETGRAPH |
pub const NETGRAPH = 32; |
BLUETOOTH |
pub const BLUETOOTH = 33; |
MPLS |
pub const MPLS = 34; |
MAX |
pub const MAX = 36; }, .haiku => struct { |
UNSPEC |
pub const UNSPEC = 0; |
INET |
pub const INET = 1; |
APPLETALK |
pub const APPLETALK = 2; |
ROUTE |
pub const ROUTE = 3; |
LINK |
pub const LINK = 4; |
INET6 |
pub const INET6 = 5; |
DLI |
pub const DLI = 6; |
IPX |
pub const IPX = 7; |
NOTIFY |
pub const NOTIFY = 8; |
LOCAL |
pub const LOCAL = 9; |
UNIX |
pub const UNIX = LOCAL; |
BLUETOOTH |
pub const BLUETOOTH = 10; |
MAX |
pub const MAX = 11; }, .openbsd => struct { |
UNSPEC |
pub const UNSPEC = 0; |
UNIX |
pub const UNIX = 1; |
LOCAL |
pub const LOCAL = UNIX; |
INET |
pub const INET = 2; |
APPLETALK |
pub const APPLETALK = 16; |
INET6 |
pub const INET6 = 24; |
KEY |
pub const KEY = 30; |
ROUTE |
pub const ROUTE = 17; |
SNA |
pub const SNA = 11; |
MPLS |
pub const MPLS = 33; |
BLUETOOTH |
pub const BLUETOOTH = 32; |
ISDN |
pub const ISDN = 26; |
MAX |
pub const MAX = 36; }, // https://github.com/SerenityOS/serenity/blob/ac44ec5ebc707f9dd0c3d4759a1e17e91db5d74f/Kernel/API/POSIX/sys/socket.h#L17-L22 .serenity => struct { |
UNSPEC |
pub const UNSPEC = 0; |
LOCAL |
pub const LOCAL = 1; |
UNIX |
pub const UNIX = LOCAL; |
INET |
pub const INET = 2; |
INET6 |
pub const INET6 = 3; |
MAX |
pub const MAX = 4; }, else => void, |
DIR |
}; pub const PF = if (builtin.abi.isAndroid()) struct { |
UNSPEC |
pub const UNSPEC = AF.UNSPEC; |
UNIX |
pub const UNIX = AF.UNIX; |
LOCAL |
pub const LOCAL = AF.LOCAL; |
INET |
pub const INET = AF.INET; |
AX25 |
pub const AX25 = AF.AX25; |
IPX |
pub const IPX = AF.IPX; |
APPLETALK |
pub const APPLETALK = AF.APPLETALK; |
NETROM |
pub const NETROM = AF.NETROM; |
BRIDGE |
pub const BRIDGE = AF.BRIDGE; |
ATMPVC |
pub const ATMPVC = AF.ATMPVC; |
X25 |
pub const X25 = AF.X25; |
PF_INET6 |
pub const PF_INET6 = AF.INET6; |
PF_ROSE |
pub const PF_ROSE = AF.ROSE; |
PF_DECnet |
pub const PF_DECnet = AF.DECnet; |
PF_NETBEUI |
pub const PF_NETBEUI = AF.NETBEUI; |
PF_SECURITY |
pub const PF_SECURITY = AF.SECURITY; |
PF_KEY |
pub const PF_KEY = AF.KEY; |
PF_NETLINK |
pub const PF_NETLINK = AF.NETLINK; |
PF_ROUTE |
pub const PF_ROUTE = AF.ROUTE; |
PF_PACKET |
pub const PF_PACKET = AF.PACKET; |
PF_ASH |
pub const PF_ASH = AF.ASH; |
PF_ECONET |
pub const PF_ECONET = AF.ECONET; |
PF_ATMSVC |
pub const PF_ATMSVC = AF.ATMSVC; |
PF_RDS |
pub const PF_RDS = AF.RDS; |
PF_SNA |
pub const PF_SNA = AF.SNA; |
PF_IRDA |
pub const PF_IRDA = AF.IRDA; |
PF_PPPOX |
pub const PF_PPPOX = AF.PPPOX; |
PF_WANPIPE |
pub const PF_WANPIPE = AF.WANPIPE; |
PF_LLC |
pub const PF_LLC = AF.LLC; |
PF_CAN |
pub const PF_CAN = AF.CAN; |
PF_TIPC |
pub const PF_TIPC = AF.TIPC; |
PF_BLUETOOTH |
pub const PF_BLUETOOTH = AF.BLUETOOTH; |
PF_IUCV |
pub const PF_IUCV = AF.IUCV; |
PF_RXRPC |
pub const PF_RXRPC = AF.RXRPC; |
PF_ISDN |
pub const PF_ISDN = AF.ISDN; |
PF_PHONET |
pub const PF_PHONET = AF.PHONET; |
PF_IEEE802154 |
pub const PF_IEEE802154 = AF.IEEE802154; |
PF_CAIF |
pub const PF_CAIF = AF.CAIF; |
PF_ALG |
pub const PF_ALG = AF.ALG; |
PF_NFC |
pub const PF_NFC = AF.NFC; |
PF_VSOCK |
pub const PF_VSOCK = AF.VSOCK; |
PF_KCM |
pub const PF_KCM = AF.KCM; |
PF_QIPCRTR |
pub const PF_QIPCRTR = AF.QIPCRTR; |
PF_MAX |
pub const PF_MAX = AF.MAX; } else switch (native_os) { .linux, .emscripten => linux.PF, .macos, .ios, .tvos, .watchos, .visionos => struct { |
UNSPEC |
pub const UNSPEC = AF.UNSPEC; |
LOCAL |
pub const LOCAL = AF.LOCAL; |
UNIX |
pub const UNIX = PF.LOCAL; |
INET |
pub const INET = AF.INET; |
IMPLINK |
pub const IMPLINK = AF.IMPLINK; |
PUP |
pub const PUP = AF.PUP; |
CHAOS |
pub const CHAOS = AF.CHAOS; |
NS |
pub const NS = AF.NS; |
ISO |
pub const ISO = AF.ISO; |
OSI |
pub const OSI = AF.ISO; |
ECMA |
pub const ECMA = AF.ECMA; |
DATAKIT |
pub const DATAKIT = AF.DATAKIT; |
CCITT |
pub const CCITT = AF.CCITT; |
SNA |
pub const SNA = AF.SNA; |
DECnet |
pub const DECnet = AF.DECnet; |
DLI |
pub const DLI = AF.DLI; |
LAT |
pub const LAT = AF.LAT; |
HYLINK |
pub const HYLINK = AF.HYLINK; |
APPLETALK |
pub const APPLETALK = AF.APPLETALK; |
ROUTE |
pub const ROUTE = AF.ROUTE; |
LINK |
pub const LINK = AF.LINK; |
XTP |
pub const XTP = AF.XTP; |
COIP |
pub const COIP = AF.COIP; |
CNT |
pub const CNT = AF.CNT; |
SIP |
pub const SIP = AF.SIP; |
IPX |
pub const IPX = AF.IPX; |
RTIP |
pub const RTIP = AF.RTIP; |
PIP |
pub const PIP = AF.PIP; |
ISDN |
pub const ISDN = AF.ISDN; |
KEY |
pub const KEY = AF.KEY; |
INET6 |
pub const INET6 = AF.INET6; |
NATM |
pub const NATM = AF.NATM; |
SYSTEM |
pub const SYSTEM = AF.SYSTEM; |
NETBIOS |
pub const NETBIOS = AF.NETBIOS; |
PPP |
pub const PPP = AF.PPP; |
MAX |
pub const MAX = AF.MAX; }, .freebsd => struct { |
UNSPEC |
pub const UNSPEC = AF.UNSPEC; |
LOCAL |
pub const LOCAL = AF.LOCAL; |
UNIX |
pub const UNIX = PF.LOCAL; |
INET |
pub const INET = AF.INET; |
IMPLINK |
pub const IMPLINK = AF.IMPLINK; |
PUP |
pub const PUP = AF.PUP; |
CHAOS |
pub const CHAOS = AF.CHAOS; |
NETBIOS |
pub const NETBIOS = AF.NETBIOS; |
ISO |
pub const ISO = AF.ISO; |
OSI |
pub const OSI = AF.ISO; |
ECMA |
pub const ECMA = AF.ECMA; |
DATAKIT |
pub const DATAKIT = AF.DATAKIT; |
CCITT |
pub const CCITT = AF.CCITT; |
DECnet |
pub const DECnet = AF.DECnet; |
DLI |
pub const DLI = AF.DLI; |
LAT |
pub const LAT = AF.LAT; |
HYLINK |
pub const HYLINK = AF.HYLINK; |
APPLETALK |
pub const APPLETALK = AF.APPLETALK; |
ROUTE |
pub const ROUTE = AF.ROUTE; |
LINK |
pub const LINK = AF.LINK; |
XTP |
pub const XTP = AF.pseudo_XTP; |
COIP |
pub const COIP = AF.COIP; |
CNT |
pub const CNT = AF.CNT; |
SIP |
pub const SIP = AF.SIP; |
IPX |
pub const IPX = AF.IPX; |
RTIP |
pub const RTIP = AF.pseudo_RTIP; |
PIP |
pub const PIP = AF.pseudo_PIP; |
ISDN |
pub const ISDN = AF.ISDN; |
KEY |
pub const KEY = AF.pseudo_KEY; |
INET6 |
pub const INET6 = AF.pseudo_INET6; |
NATM |
pub const NATM = AF.NATM; |
ATM |
pub const ATM = AF.ATM; |
NETGRAPH |
pub const NETGRAPH = AF.NETGRAPH; |
SLOW |
pub const SLOW = AF.SLOW; |
SCLUSTER |
pub const SCLUSTER = AF.SCLUSTER; |
ARP |
pub const ARP = AF.ARP; |
BLUETOOTH |
pub const BLUETOOTH = AF.BLUETOOTH; |
IEEE80211 |
pub const IEEE80211 = AF.IEEE80211; |
INET_SDP |
pub const INET_SDP = AF.INET_SDP; |
INET6_SDP |
pub const INET6_SDP = AF.INET6_SDP; |
MAX |
pub const MAX = AF.MAX; }, .solaris, .illumos => struct { |
UNSPEC |
pub const UNSPEC = AF.UNSPEC; |
UNIX |
pub const UNIX = AF.UNIX; |
LOCAL |
pub const LOCAL = UNIX; |
FILE |
pub const FILE = UNIX; |
INET |
pub const INET = AF.INET; |
IMPLINK |
pub const IMPLINK = AF.IMPLINK; |
PUP |
pub const PUP = AF.PUP; |
CHAOS |
pub const CHAOS = AF.CHAOS; |
NS |
pub const NS = AF.NS; |
NBS |
pub const NBS = AF.NBS; |
ECMA |
pub const ECMA = AF.ECMA; |
DATAKIT |
pub const DATAKIT = AF.DATAKIT; |
CCITT |
pub const CCITT = AF.CCITT; |
SNA |
pub const SNA = AF.SNA; |
DECnet |
pub const DECnet = AF.DECnet; |
DLI |
pub const DLI = AF.DLI; |
LAT |
pub const LAT = AF.LAT; |
HYLINK |
pub const HYLINK = AF.HYLINK; |
APPLETALK |
pub const APPLETALK = AF.APPLETALK; |
NIT |
pub const NIT = AF.NIT; |
@"802" |
pub const @"802" = AF.@"802"; |
OSI |
pub const OSI = AF.OSI; |
X25 |
pub const X25 = AF.X25; |
OSINET |
pub const OSINET = AF.OSINET; |
GOSIP |
pub const GOSIP = AF.GOSIP; |
IPX |
pub const IPX = AF.IPX; |
ROUTE |
pub const ROUTE = AF.ROUTE; |
LINK |
pub const LINK = AF.LINK; |
INET6 |
pub const INET6 = AF.INET6; |
KEY |
pub const KEY = AF.KEY; |
NCA |
pub const NCA = AF.NCA; |
POLICY |
pub const POLICY = AF.POLICY; |
TRILL |
pub const TRILL = AF.TRILL; |
PACKET |
pub const PACKET = AF.PACKET; |
LX_NETLINK |
pub const LX_NETLINK = AF.LX_NETLINK; |
MAX |
pub const MAX = AF.MAX; }, .netbsd => struct { |
UNSPEC |
pub const UNSPEC = AF.UNSPEC; |
LOCAL |
pub const LOCAL = AF.LOCAL; |
UNIX |
pub const UNIX = PF.LOCAL; |
INET |
pub const INET = AF.INET; |
IMPLINK |
pub const IMPLINK = AF.IMPLINK; |
PUP |
pub const PUP = AF.PUP; |
CHAOS |
pub const CHAOS = AF.CHAOS; |
NS |
pub const NS = AF.NS; |
ISO |
pub const ISO = AF.ISO; |
OSI |
pub const OSI = AF.ISO; |
ECMA |
pub const ECMA = AF.ECMA; |
DATAKIT |
pub const DATAKIT = AF.DATAKIT; |
CCITT |
pub const CCITT = AF.CCITT; |
SNA |
pub const SNA = AF.SNA; |
DECnet |
pub const DECnet = AF.DECnet; |
DLI |
pub const DLI = AF.DLI; |
LAT |
pub const LAT = AF.LAT; |
HYLINK |
pub const HYLINK = AF.HYLINK; |
APPLETALK |
pub const APPLETALK = AF.APPLETALK; |
OROUTE |
pub const OROUTE = AF.OROUTE; |
LINK |
pub const LINK = AF.LINK; |
COIP |
pub const COIP = AF.COIP; |
CNT |
pub const CNT = AF.CNT; |
INET6 |
pub const INET6 = AF.INET6; |
IPX |
pub const IPX = AF.IPX; |
ISDN |
pub const ISDN = AF.ISDN; |
E164 |
pub const E164 = AF.E164; |
NATM |
pub const NATM = AF.NATM; |
ARP |
pub const ARP = AF.ARP; |
BLUETOOTH |
pub const BLUETOOTH = AF.BLUETOOTH; |
MPLS |
pub const MPLS = AF.MPLS; |
ROUTE |
pub const ROUTE = AF.ROUTE; |
CAN |
pub const CAN = AF.CAN; |
ETHER |
pub const ETHER = AF.ETHER; |
MAX |
pub const MAX = AF.MAX; }, .dragonfly => struct { |
INET6 |
pub const INET6 = AF.INET6; |
IMPLINK |
pub const IMPLINK = AF.IMPLINK; |
ROUTE |
pub const ROUTE = AF.ROUTE; |
ISO |
pub const ISO = AF.ISO; |
PIP |
pub const PIP = AF.pseudo_PIP; |
CHAOS |
pub const CHAOS = AF.CHAOS; |
DATAKIT |
pub const DATAKIT = AF.DATAKIT; |
INET |
pub const INET = AF.INET; |
APPLETALK |
pub const APPLETALK = AF.APPLETALK; |
SIP |
pub const SIP = AF.SIP; |
OSI |
pub const OSI = AF.ISO; |
CNT |
pub const CNT = AF.CNT; |
LINK |
pub const LINK = AF.LINK; |
HYLINK |
pub const HYLINK = AF.HYLINK; |
MAX |
pub const MAX = AF.MAX; |
KEY |
pub const KEY = AF.pseudo_KEY; |
PUP |
pub const PUP = AF.PUP; |
COIP |
pub const COIP = AF.COIP; |
SNA |
pub const SNA = AF.SNA; |
LOCAL |
pub const LOCAL = AF.LOCAL; |
NETBIOS |
pub const NETBIOS = AF.NETBIOS; |
NATM |
pub const NATM = AF.NATM; |
BLUETOOTH |
pub const BLUETOOTH = AF.BLUETOOTH; |
UNSPEC |
pub const UNSPEC = AF.UNSPEC; |
NETGRAPH |
pub const NETGRAPH = AF.NETGRAPH; |
ECMA |
pub const ECMA = AF.ECMA; |
IPX |
pub const IPX = AF.IPX; |
DLI |
pub const DLI = AF.DLI; |
ATM |
pub const ATM = AF.ATM; |
CCITT |
pub const CCITT = AF.CCITT; |
ISDN |
pub const ISDN = AF.ISDN; |
RTIP |
pub const RTIP = AF.pseudo_RTIP; |
LAT |
pub const LAT = AF.LAT; |
UNIX |
pub const UNIX = PF.LOCAL; |
XTP |
pub const XTP = AF.pseudo_XTP; |
DECnet |
pub const DECnet = AF.DECnet; }, .haiku => struct { |
UNSPEC |
pub const UNSPEC = AF.UNSPEC; |
INET |
pub const INET = AF.INET; |
ROUTE |
pub const ROUTE = AF.ROUTE; |
LINK |
pub const LINK = AF.LINK; |
INET6 |
pub const INET6 = AF.INET6; |
LOCAL |
pub const LOCAL = AF.LOCAL; |
UNIX |
pub const UNIX = AF.UNIX; |
BLUETOOTH |
pub const BLUETOOTH = AF.BLUETOOTH; }, .openbsd => struct { |
UNSPEC |
pub const UNSPEC = AF.UNSPEC; |
LOCAL |
pub const LOCAL = AF.LOCAL; |
UNIX |
pub const UNIX = AF.UNIX; |
INET |
pub const INET = AF.INET; |
APPLETALK |
pub const APPLETALK = AF.APPLETALK; |
INET6 |
pub const INET6 = AF.INET6; |
DECnet |
pub const DECnet = AF.DECnet; |
KEY |
pub const KEY = AF.KEY; |
ROUTE |
pub const ROUTE = AF.ROUTE; |
SNA |
pub const SNA = AF.SNA; |
MPLS |
pub const MPLS = AF.MPLS; |
BLUETOOTH |
pub const BLUETOOTH = AF.BLUETOOTH; |
ISDN |
pub const ISDN = AF.ISDN; |
MAX |
pub const MAX = AF.MAX; }, // https://github.com/SerenityOS/serenity/blob/ac44ec5ebc707f9dd0c3d4759a1e17e91db5d74f/Kernel/API/POSIX/sys/socket.h#L24-L29 .serenity => struct { |
LOCAL |
pub const LOCAL = AF.LOCAL; |
UNIX |
pub const UNIX = AF.LOCAL; |
INET |
pub const INET = AF.INET; |
INET6 |
pub const INET6 = AF.INET6; |
UNSPEC |
pub const UNSPEC = AF.UNSPEC; |
MAX |
pub const MAX = AF.MAX; }, else => void, |
DIR |
}; pub const DT = switch (native_os) { .linux => linux.DT, // https://github.com/SerenityOS/serenity/blob/1262a7d1424d0d2e89d80644409721cbf056ab17/Kernel/API/POSIX/dirent.h#L16-L35 .netbsd, .freebsd, .openbsd, .macos, .ios, .tvos, .watchos, .visionos, .serenity => struct { |
UNKNOWN |
pub const UNKNOWN = 0; |
FIFO |
pub const FIFO = 1; |
CHR |
pub const CHR = 2; |
DIR |
pub const DIR = 4; |
BLK |
pub const BLK = 6; |
REG |
pub const REG = 8; |
LNK |
pub const LNK = 10; |
SOCK |
pub const SOCK = 12; |
WHT |
pub const WHT = 14; }, .dragonfly => struct { |
UNKNOWN |
pub const UNKNOWN = 0; |
FIFO |
pub const FIFO = 1; |
CHR |
pub const CHR = 2; |
DIR |
pub const DIR = 4; |
BLK |
pub const BLK = 6; |
REG |
pub const REG = 8; |
LNK |
pub const LNK = 10; |
SOCK |
pub const SOCK = 12; |
WHT |
pub const WHT = 14; |
DBF |
pub const DBF = 15; }, else => void, |
DIR |
}; pub const MSG = switch (native_os) { .linux => linux.MSG, .emscripten => emscripten.MSG, .windows => ws2_32.MSG, .driverkit, .macos, .ios, .tvos, .watchos, .visionos => darwin.MSG, .haiku => struct { |
OOB |
pub const OOB = 0x0001; |
PEEK |
pub const PEEK = 0x0002; |
DONTROUTE |
pub const DONTROUTE = 0x0004; |
EOR |
pub const EOR = 0x0008; |
TRUNC |
pub const TRUNC = 0x0010; |
CTRUNC |
pub const CTRUNC = 0x0020; |
WAITALL |
pub const WAITALL = 0x0040; |
DONTWAIT |
pub const DONTWAIT = 0x0080; |
BCAST |
pub const BCAST = 0x0100; |
MCAST |
pub const MCAST = 0x0200; |
EOF |
pub const EOF = 0x0400; |
NOSIGNAL |
pub const NOSIGNAL = 0x0800; }, // https://github.com/SerenityOS/serenity/blob/ac44ec5ebc707f9dd0c3d4759a1e17e91db5d74f/Kernel/API/POSIX/sys/socket.h#L56-L64 .serenity => struct { |
TRUNC |
pub const TRUNC = 0x1; |
CTRUNC |
pub const CTRUNC = 0x2; |
PEEK |
pub const PEEK = 0x4; |
OOB |
pub const OOB = 0x8; |
DONTROUTE |
pub const DONTROUTE = 0x10; |
WAITALL |
pub const WAITALL = 0x20; |
DONTWAIT |
pub const DONTWAIT = 0x40; |
NOSIGNAL |
pub const NOSIGNAL = 0x80; |
EOR |
pub const EOR = 0x100; }, .freebsd => struct { |
OOB |
pub const OOB = 0x00000001; |
PEEK |
pub const PEEK = 0x00000002; |
DONTROUTE |
pub const DONTROUTE = 0x00000004; |
EOR |
pub const EOR = 0x00000008; |
TRUNC |
pub const TRUNC = 0x00000010; |
CTRUNC |
pub const CTRUNC = 0x00000020; |
WAITALL |
pub const WAITALL = 0x00000040; |
DONTWAIT |
pub const DONTWAIT = 0x00000080; |
EOF |
pub const EOF = 0x00000100; |
NOTIFICATION |
pub const NOTIFICATION = 0x00002000; |
NBIO |
pub const NBIO = 0x00004000; |
COMPAT |
pub const COMPAT = 0x00008000; |
SOCALLBCK |
pub const SOCALLBCK = 0x00010000; |
NOSIGNAL |
pub const NOSIGNAL = 0x00020000; |
CMSG_CLOEXEC |
pub const CMSG_CLOEXEC = 0x00040000; |
WAITFORONE |
pub const WAITFORONE = 0x00080000; |
MORETOCOME |
pub const MORETOCOME = 0x00100000; |
TLSAPPDATA |
pub const TLSAPPDATA = 0x00200000; }, .netbsd => struct { |
OOB |
pub const OOB = 0x0001; |
PEEK |
pub const PEEK = 0x0002; |
DONTROUTE |
pub const DONTROUTE = 0x0004; |
EOR |
pub const EOR = 0x0008; |
TRUNC |
pub const TRUNC = 0x0010; |
CTRUNC |
pub const CTRUNC = 0x0020; |
WAITALL |
pub const WAITALL = 0x0040; |
DONTWAIT |
pub const DONTWAIT = 0x0080; |
BCAST |
pub const BCAST = 0x0100; |
MCAST |
pub const MCAST = 0x0200; |
NOSIGNAL |
pub const NOSIGNAL = 0x0400; |
CMSG_CLOEXEC |
pub const CMSG_CLOEXEC = 0x0800; |
NBIO |
pub const NBIO = 0x1000; |
WAITFORONE |
pub const WAITFORONE = 0x2000; |
NOTIFICATION |
pub const NOTIFICATION = 0x4000; }, else => void, |
DIR |
}; pub const SOCK = switch (native_os) { .linux => linux.SOCK, .emscripten => emscripten.SOCK, .windows => ws2_32.SOCK, .macos, .ios, .tvos, .watchos, .visionos => struct { |
STREAM |
pub const STREAM = 1; |
DGRAM |
pub const DGRAM = 2; |
RAW |
pub const RAW = 3; |
RDM |
pub const RDM = 4; |
SEQPACKET |
pub const SEQPACKET = 5; |
MAXADDRLEN |
pub const MAXADDRLEN = 255; |
CLOEXEC |
/// Not actually supported by Darwin, but Zig supplies a shim. /// This numerical value is not ABI-stable. It need only not conflict /// with any other `SOCK` bits. pub const CLOEXEC = 1 << 15; /// Not actually supported by Darwin, but Zig supplies a shim. /// This numerical value is not ABI-stable. It need only not conflict /// with any other `SOCK` bits. |
NONBLOCK |
pub const NONBLOCK = 1 << 16; }, .freebsd => struct { |
STREAM |
pub const STREAM = 1; |
DGRAM |
pub const DGRAM = 2; |
RAW |
pub const RAW = 3; |
RDM |
pub const RDM = 4; |
SEQPACKET |
pub const SEQPACKET = 5; |
CLOEXEC |
|
CLOEXEC |
pub const CLOEXEC = 0x10000000; |
NONBLOCK |
pub const NONBLOCK = 0x20000000; }, .solaris, .illumos => struct { /// Datagram. pub const DGRAM = 1; /// STREAM. |
STREAM |
pub const STREAM = 2; /// Raw-protocol interface. |
RAW |
pub const RAW = 4; /// Reliably-delivered message. |
RDM |
pub const RDM = 5; /// Sequenced packed stream. |
SEQPACKET |
pub const SEQPACKET = 6; |
NONBLOCK |
pub const NONBLOCK = 0x100000; |
NDELAY |
pub const NDELAY = 0x200000; |
CLOEXEC |
pub const CLOEXEC = 0x080000; }, .netbsd => struct { |
STREAM |
pub const STREAM = 1; |
DGRAM |
pub const DGRAM = 2; |
RAW |
pub const RAW = 3; |
RDM |
pub const RDM = 4; |
SEQPACKET |
pub const SEQPACKET = 5; |
CONN_DGRAM |
pub const CONN_DGRAM = 6; |
DCCP |
pub const DCCP = CONN_DGRAM; |
CLOEXEC |
|
CLOEXEC |
pub const CLOEXEC = 0x10000000; |
NONBLOCK |
pub const NONBLOCK = 0x20000000; pub const NOSIGPIPE = 0x40000000; |
FLAGS_MASK |
pub const FLAGS_MASK = 0xf0000000; }, .dragonfly => struct { |
STREAM |
pub const STREAM = 1; |
DGRAM |
pub const DGRAM = 2; |
RAW |
pub const RAW = 3; |
RDM |
pub const RDM = 4; |
SEQPACKET |
pub const SEQPACKET = 5; |
MAXADDRLEN |
pub const MAXADDRLEN = 255; |
CLOEXEC |
pub const CLOEXEC = 0x10000000; |
NONBLOCK |
pub const NONBLOCK = 0x20000000; }, .haiku => struct { |
STREAM |
pub const STREAM = 1; |
DGRAM |
pub const DGRAM = 2; |
RAW |
pub const RAW = 3; |
SEQPACKET |
pub const SEQPACKET = 5; |
MISC |
pub const MISC = 255; |
NONBLOCK |
pub const NONBLOCK = 0x40000; |
CLOEXEC |
pub const CLOEXEC = 0x80000; }, .openbsd => struct { |
STREAM |
pub const STREAM = 1; |
DGRAM |
pub const DGRAM = 2; |
RAW |
pub const RAW = 3; |
RDM |
pub const RDM = 4; |
SEQPACKET |
pub const SEQPACKET = 5; |
CLOEXEC |
pub const CLOEXEC = 0x8000; |
NONBLOCK |
pub const NONBLOCK = 0x4000; }, // https://github.com/SerenityOS/serenity/blob/ac44ec5ebc707f9dd0c3d4759a1e17e91db5d74f/Kernel/API/POSIX/sys/socket.h#L31-L38 .serenity => struct { |
STREAM |
pub const STREAM = 1; |
DGRAM |
pub const DGRAM = 2; |
RAW |
pub const RAW = 3; |
RDM |
pub const RDM = 4; |
SEQPACKET |
pub const SEQPACKET = 5; |
NONBLOCK |
pub const NONBLOCK = 0o4000; |
CLOEXEC |
pub const CLOEXEC = 0o2000000; }, else => void, |
DIR |
}; pub const TCP = switch (native_os) { .macos => darwin.TCP, .linux => linux.TCP, .emscripten => emscripten.TCP, .windows => ws2_32.TCP, // https://github.com/SerenityOS/serenity/blob/61ac554a3403838f79ca746bd1c65ded6f97d124/Kernel/API/POSIX/netinet/tcp.h#L13-L14 .serenity => struct { |
NODELAY |
pub const NODELAY = 10; |
MAXSEG |
pub const MAXSEG = 11; }, else => void, |
DIR |
}; pub const IPPROTO = switch (native_os) { .linux, .emscripten => linux.IPPROTO, .windows => ws2_32.IPPROTO, .macos, .ios, .tvos, .watchos, .visionos => struct { |
ICMP |
pub const ICMP = 1; |
ICMPV6 |
pub const ICMPV6 = 58; |
TCP |
pub const TCP = 6; |
UDP |
pub const UDP = 17; |
IP |
pub const IP = 0; |
IPV6 |
pub const IPV6 = 41; }, .freebsd => struct { /// dummy for IP |
IP |
pub const IP = 0; /// control message protocol |
ICMP |
pub const ICMP = 1; /// tcp |
TCP |
pub const TCP = 6; /// user datagram protocol |
UDP |
pub const UDP = 17; /// IP6 header |
IPV6 |
pub const IPV6 = 41; /// raw IP packet |
RAW |
pub const RAW = 255; /// IP6 hop-by-hop options |
HOPOPTS |
pub const HOPOPTS = 0; /// group mgmt protocol |
IGMP |
pub const IGMP = 2; /// gateway^2 (deprecated) |
GGP |
pub const GGP = 3; /// IPv4 encapsulation |
IPV4 |
pub const IPV4 = 4; /// for compatibility |
IPIP |
pub const IPIP = IPV4; /// Stream protocol II |
ST |
pub const ST = 7; /// exterior gateway protocol |
EGP |
pub const EGP = 8; /// private interior gateway |
PIGP |
pub const PIGP = 9; /// BBN RCC Monitoring |
RCCMON |
pub const RCCMON = 10; /// network voice protocol |
NVPII |
pub const NVPII = 11; /// pup |
PUP |
pub const PUP = 12; /// Argus |
ARGUS |
pub const ARGUS = 13; /// EMCON |
EMCON |
pub const EMCON = 14; /// Cross Net Debugger |
XNET |
pub const XNET = 15; /// Chaos |
CHAOS |
pub const CHAOS = 16; /// Multiplexing |
MUX |
pub const MUX = 18; /// DCN Measurement Subsystems |
MEAS |
pub const MEAS = 19; /// Host Monitoring |
HMP |
pub const HMP = 20; /// Packet Radio Measurement |
PRM |
pub const PRM = 21; /// xns idp |
IDP |
pub const IDP = 22; /// Trunk-1 |
TRUNK1 |
pub const TRUNK1 = 23; /// Trunk-2 |
TRUNK2 |
pub const TRUNK2 = 24; /// Leaf-1 |
LEAF1 |
pub const LEAF1 = 25; /// Leaf-2 |
LEAF2 |
pub const LEAF2 = 26; /// Reliable Data |
RDP |
pub const RDP = 27; /// Reliable Transaction |
IRTP |
pub const IRTP = 28; /// tp-4 w/ class negotiation |
TP |
pub const TP = 29; /// Bulk Data Transfer |
BLT |
pub const BLT = 30; /// Network Services |
NSP |
pub const NSP = 31; /// Merit Internodal |
INP |
pub const INP = 32; /// Datagram Congestion Control Protocol |
DCCP |
pub const DCCP = 33; /// Third Party Connect |
@"3PC" |
pub const @"3PC" = 34; /// InterDomain Policy Routing |
IDPR |
pub const IDPR = 35; /// XTP |
XTP |
pub const XTP = 36; /// Datagram Delivery |
DDP |
pub const DDP = 37; /// Control Message Transport |
CMTP |
pub const CMTP = 38; /// TP++ Transport |
TPXX |
pub const TPXX = 39; /// IL transport protocol |
IL |
pub const IL = 40; /// Source Demand Routing |
SDRP |
pub const SDRP = 42; /// IP6 routing header |
ROUTING |
pub const ROUTING = 43; /// IP6 fragmentation header |
FRAGMENT |
pub const FRAGMENT = 44; /// InterDomain Routing |
IDRP |
pub const IDRP = 45; /// resource reservation |
RSVP |
pub const RSVP = 46; /// General Routing Encap. |
GRE |
pub const GRE = 47; /// Mobile Host Routing |
MHRP |
pub const MHRP = 48; /// BHA |
BHA |
pub const BHA = 49; /// IP6 Encap Sec. Payload |
ESP |
pub const ESP = 50; /// IP6 Auth Header |
AH |
pub const AH = 51; /// Integ. Net Layer Security |
INLSP |
pub const INLSP = 52; /// IP with encryption |
SWIPE |
pub const SWIPE = 53; /// Next Hop Resolution |
NHRP |
pub const NHRP = 54; /// IP Mobility |
MOBILE |
pub const MOBILE = 55; /// Transport Layer Security |
TLSP |
pub const TLSP = 56; /// SKIP |
SKIP |
pub const SKIP = 57; /// ICMP6 |
ICMPV6 |
pub const ICMPV6 = 58; /// IP6 no next header |
NONE |
pub const NONE = 59; /// IP6 destination option |
DSTOPTS |
pub const DSTOPTS = 60; /// any host internal protocol |
AHIP |
pub const AHIP = 61; /// CFTP |
CFTP |
pub const CFTP = 62; /// "hello" routing protocol |
HELLO |
pub const HELLO = 63; /// SATNET/Backroom EXPAK |
SATEXPAK |
pub const SATEXPAK = 64; /// Kryptolan |
KRYPTOLAN |
pub const KRYPTOLAN = 65; /// Remote Virtual Disk |
RVD |
pub const RVD = 66; /// Pluribus Packet Core |
IPPC |
pub const IPPC = 67; /// Any distributed FS |
ADFS |
pub const ADFS = 68; /// Satnet Monitoring |
SATMON |
pub const SATMON = 69; /// VISA Protocol |
VISA |
pub const VISA = 70; /// Packet Core Utility |
IPCV |
pub const IPCV = 71; /// Comp. Prot. Net. Executive |
CPNX |
pub const CPNX = 72; /// Comp. Prot. HeartBeat |
CPHB |
pub const CPHB = 73; /// Wang Span Network |
WSN |
pub const WSN = 74; /// Packet Video Protocol |
PVP |
pub const PVP = 75; /// BackRoom SATNET Monitoring |
BRSATMON |
pub const BRSATMON = 76; /// Sun net disk proto (temp.) |
ND |
pub const ND = 77; /// WIDEBAND Monitoring |
WBMON |
pub const WBMON = 78; /// WIDEBAND EXPAK |
WBEXPAK |
pub const WBEXPAK = 79; /// ISO cnlp |
EON |
pub const EON = 80; /// VMTP |
VMTP |
pub const VMTP = 81; /// Secure VMTP |
SVMTP |
pub const SVMTP = 82; /// Banyon VINES |
VINES |
pub const VINES = 83; /// TTP |
TTP |
pub const TTP = 84; /// NSFNET-IGP |
IGP |
pub const IGP = 85; /// dissimilar gateway prot. |
DGP |
pub const DGP = 86; /// TCF |
TCF |
pub const TCF = 87; /// Cisco/GXS IGRP |
IGRP |
pub const IGRP = 88; /// OSPFIGP |
OSPFIGP |
pub const OSPFIGP = 89; /// Strite RPC protocol |
SRPC |
pub const SRPC = 90; /// Locus Address Resoloution |
LARP |
pub const LARP = 91; /// Multicast Transport |
MTP |
pub const MTP = 92; /// AX.25 Frames |
AX25 |
pub const AX25 = 93; /// IP encapsulated in IP |
IPEIP |
pub const IPEIP = 94; /// Mobile Int.ing control |
MICP |
pub const MICP = 95; /// Semaphore Comm. security |
SCCSP |
pub const SCCSP = 96; /// Ethernet IP encapsulation |
ETHERIP |
pub const ETHERIP = 97; /// encapsulation header |
ENCAP |
pub const ENCAP = 98; /// any private encr. scheme |
APES |
pub const APES = 99; /// GMTP |
GMTP |
pub const GMTP = 100; /// payload compression (IPComp) |
IPCOMP |
pub const IPCOMP = 108; /// SCTP |
SCTP |
pub const SCTP = 132; /// IPv6 Mobility Header |
MH |
pub const MH = 135; /// UDP-Lite |
UDPLITE |
pub const UDPLITE = 136; /// IP6 Host Identity Protocol |
HIP |
pub const HIP = 139; /// IP6 Shim6 Protocol |
SHIM6 |
pub const SHIM6 = 140; /// Protocol Independent Mcast |
PIM |
pub const PIM = 103; /// CARP |
CARP |
pub const CARP = 112; /// PGM |
PGM |
pub const PGM = 113; /// MPLS-in-IP |
MPLS |
pub const MPLS = 137; /// PFSYNC |
PFSYNC |
pub const PFSYNC = 240; /// Reserved |
RESERVED_253 |
pub const RESERVED_253 = 253; /// Reserved |
RESERVED_254 |
pub const RESERVED_254 = 254; }, .solaris, .illumos => struct { /// dummy for IP |
IP |
pub const IP = 0; /// Hop by hop header for IPv6 |
HOPOPTS |
pub const HOPOPTS = 0; /// control message protocol |
ICMP |
pub const ICMP = 1; /// group control protocol |
IGMP |
pub const IGMP = 2; /// gateway^2 (deprecated) |
GGP |
pub const GGP = 3; /// IP in IP encapsulation |
ENCAP |
pub const ENCAP = 4; /// tcp |
TCP |
pub const TCP = 6; /// exterior gateway protocol |
EGP |
pub const EGP = 8; /// pup |
PUP |
pub const PUP = 12; /// user datagram protocol |
UDP |
pub const UDP = 17; /// xns idp |
IDP |
pub const IDP = 22; /// IPv6 encapsulated in IP |
IPV6 |
pub const IPV6 = 41; /// Routing header for IPv6 |
ROUTING |
pub const ROUTING = 43; /// Fragment header for IPv6 |
FRAGMENT |
pub const FRAGMENT = 44; /// rsvp |
RSVP |
pub const RSVP = 46; /// IPsec Encap. Sec. Payload |
ESP |
pub const ESP = 50; /// IPsec Authentication Hdr. |
AH |
pub const AH = 51; /// ICMP for IPv6 |
ICMPV6 |
pub const ICMPV6 = 58; /// No next header for IPv6 |
NONE |
pub const NONE = 59; /// Destination options |
DSTOPTS |
pub const DSTOPTS = 60; /// "hello" routing protocol |
HELLO |
pub const HELLO = 63; /// UNOFFICIAL net disk proto |
ND |
pub const ND = 77; /// ISO clnp |
EON |
pub const EON = 80; /// OSPF |
OSPF |
pub const OSPF = 89; /// PIM routing protocol |
PIM |
pub const PIM = 103; /// Stream Control |
SCTP |
pub const SCTP = 132; /// raw IP packet |
RAW |
pub const RAW = 255; /// Sockets Direct Protocol |
PROTO_SDP |
pub const PROTO_SDP = 257; }, .netbsd => struct { /// dummy for IP |
IP |
pub const IP = 0; /// IP6 hop-by-hop options |
HOPOPTS |
pub const HOPOPTS = 0; /// control message protocol |
ICMP |
pub const ICMP = 1; /// group mgmt protocol |
IGMP |
pub const IGMP = 2; /// gateway^2 (deprecated) |
GGP |
pub const GGP = 3; /// IP header |
IPV4 |
pub const IPV4 = 4; /// IP inside IP |
IPIP |
pub const IPIP = 4; /// tcp |
TCP |
pub const TCP = 6; /// exterior gateway protocol |
EGP |
pub const EGP = 8; /// pup |
PUP |
pub const PUP = 12; /// user datagram protocol |
UDP |
pub const UDP = 17; /// xns idp |
IDP |
pub const IDP = 22; /// tp-4 w/ class negotiation |
TP |
pub const TP = 29; /// DCCP |
DCCP |
pub const DCCP = 33; /// IP6 header |
IPV6 |
pub const IPV6 = 41; /// IP6 routing header |
ROUTING |
pub const ROUTING = 43; /// IP6 fragmentation header |
FRAGMENT |
pub const FRAGMENT = 44; /// resource reservation |
RSVP |
pub const RSVP = 46; /// GRE encaps RFC 1701 |
GRE |
pub const GRE = 47; /// encap. security payload |
ESP |
pub const ESP = 50; /// authentication header |
AH |
pub const AH = 51; /// IP Mobility RFC 2004 |
MOBILE |
pub const MOBILE = 55; /// IPv6 ICMP |
IPV6_ICMP |
pub const IPV6_ICMP = 58; /// ICMP6 |
ICMPV6 |
pub const ICMPV6 = 58; /// IP6 no next header |
NONE |
pub const NONE = 59; /// IP6 destination option |
DSTOPTS |
pub const DSTOPTS = 60; /// ISO cnlp |
EON |
pub const EON = 80; /// Ethernet-in-IP |
ETHERIP |
pub const ETHERIP = 97; /// encapsulation header |
ENCAP |
pub const ENCAP = 98; /// Protocol indep. multicast |
PIM |
pub const PIM = 103; /// IP Payload Comp. Protocol |
IPCOMP |
pub const IPCOMP = 108; /// VRRP RFC 2338 |
VRRP |
pub const VRRP = 112; /// Common Address Resolution Protocol |
CARP |
pub const CARP = 112; /// L2TPv3 |
L2TP |
pub const L2TP = 115; /// SCTP |
SCTP |
pub const SCTP = 132; /// PFSYNC |
PFSYNC |
pub const PFSYNC = 240; /// raw IP packet |
RAW |
pub const RAW = 255; }, .dragonfly => struct { |
IP |
pub const IP = 0; |
ICMP |
pub const ICMP = 1; |
TCP |
pub const TCP = 6; |
UDP |
pub const UDP = 17; |
IPV6 |
pub const IPV6 = 41; |
RAW |
pub const RAW = 255; |
HOPOPTS |
pub const HOPOPTS = 0; |
IGMP |
pub const IGMP = 2; |
GGP |
pub const GGP = 3; |
IPV4 |
pub const IPV4 = 4; |
IPIP |
pub const IPIP = IPV4; |
ST |
pub const ST = 7; |
EGP |
pub const EGP = 8; |
PIGP |
pub const PIGP = 9; |
RCCMON |
pub const RCCMON = 10; |
NVPII |
pub const NVPII = 11; |
PUP |
pub const PUP = 12; |
ARGUS |
pub const ARGUS = 13; |
EMCON |
pub const EMCON = 14; |
XNET |
pub const XNET = 15; |
CHAOS |
pub const CHAOS = 16; |
MUX |
pub const MUX = 18; |
MEAS |
pub const MEAS = 19; |
HMP |
pub const HMP = 20; |
PRM |
pub const PRM = 21; |
IDP |
pub const IDP = 22; |
TRUNK1 |
pub const TRUNK1 = 23; |
TRUNK2 |
pub const TRUNK2 = 24; |
LEAF1 |
pub const LEAF1 = 25; |
LEAF2 |
pub const LEAF2 = 26; |
RDP |
pub const RDP = 27; |
IRTP |
pub const IRTP = 28; |
TP |
pub const TP = 29; |
BLT |
pub const BLT = 30; |
NSP |
pub const NSP = 31; |
INP |
pub const INP = 32; |
SEP |
pub const SEP = 33; |
@"3PC" |
pub const @"3PC" = 34; |
IDPR |
pub const IDPR = 35; |
XTP |
pub const XTP = 36; |
DDP |
pub const DDP = 37; |
CMTP |
pub const CMTP = 38; |
TPXX |
pub const TPXX = 39; |
IL |
pub const IL = 40; |
SDRP |
pub const SDRP = 42; |
ROUTING |
pub const ROUTING = 43; |
FRAGMENT |
pub const FRAGMENT = 44; |
IDRP |
pub const IDRP = 45; |
RSVP |
pub const RSVP = 46; |
GRE |
pub const GRE = 47; |
MHRP |
pub const MHRP = 48; |
BHA |
pub const BHA = 49; |
ESP |
pub const ESP = 50; |
AH |
pub const AH = 51; |
INLSP |
pub const INLSP = 52; |
SWIPE |
pub const SWIPE = 53; |
NHRP |
pub const NHRP = 54; |
MOBILE |
pub const MOBILE = 55; |
TLSP |
pub const TLSP = 56; |
SKIP |
pub const SKIP = 57; |
ICMPV6 |
pub const ICMPV6 = 58; |
NONE |
pub const NONE = 59; |
DSTOPTS |
pub const DSTOPTS = 60; |
AHIP |
pub const AHIP = 61; |
CFTP |
pub const CFTP = 62; |
HELLO |
pub const HELLO = 63; |
SATEXPAK |
pub const SATEXPAK = 64; |
KRYPTOLAN |
pub const KRYPTOLAN = 65; |
RVD |
pub const RVD = 66; |
IPPC |
pub const IPPC = 67; |
ADFS |
pub const ADFS = 68; |
SATMON |
pub const SATMON = 69; |
VISA |
pub const VISA = 70; |
IPCV |
pub const IPCV = 71; |
CPNX |
pub const CPNX = 72; |
CPHB |
pub const CPHB = 73; |
WSN |
pub const WSN = 74; |
PVP |
pub const PVP = 75; |
BRSATMON |
pub const BRSATMON = 76; |
ND |
pub const ND = 77; |
WBMON |
pub const WBMON = 78; |
WBEXPAK |
pub const WBEXPAK = 79; |
EON |
pub const EON = 80; |
VMTP |
pub const VMTP = 81; |
SVMTP |
pub const SVMTP = 82; |
VINES |
pub const VINES = 83; |
TTP |
pub const TTP = 84; |
IGP |
pub const IGP = 85; |
DGP |
pub const DGP = 86; |
TCF |
pub const TCF = 87; |
IGRP |
pub const IGRP = 88; |
OSPFIGP |
pub const OSPFIGP = 89; |
SRPC |
pub const SRPC = 90; |
LARP |
pub const LARP = 91; |
MTP |
pub const MTP = 92; |
AX25 |
pub const AX25 = 93; |
IPEIP |
pub const IPEIP = 94; |
MICP |
pub const MICP = 95; |
SCCSP |
pub const SCCSP = 96; |
ETHERIP |
pub const ETHERIP = 97; |
ENCAP |
pub const ENCAP = 98; |
APES |
pub const APES = 99; |
GMTP |
pub const GMTP = 100; |
IPCOMP |
pub const IPCOMP = 108; |
PIM |
pub const PIM = 103; |
CARP |
pub const CARP = 112; |
PGM |
pub const PGM = 113; |
PFSYNC |
pub const PFSYNC = 240; |
DIVERT |
pub const DIVERT = 254; |
MAX |
pub const MAX = 256; |
DONE |
pub const DONE = 257; |
UNKNOWN |
pub const UNKNOWN = 258; }, .haiku => struct { |
IP |
pub const IP = 0; |
HOPOPTS |
pub const HOPOPTS = 0; |
ICMP |
pub const ICMP = 1; |
IGMP |
pub const IGMP = 2; |
TCP |
pub const TCP = 6; |
UDP |
pub const UDP = 17; |
IPV6 |
pub const IPV6 = 41; |
ROUTING |
pub const ROUTING = 43; |
FRAGMENT |
pub const FRAGMENT = 44; |
ESP |
pub const ESP = 50; |
AH |
pub const AH = 51; |
ICMPV6 |
pub const ICMPV6 = 58; |
NONE |
pub const NONE = 59; |
DSTOPTS |
pub const DSTOPTS = 60; |
ETHERIP |
pub const ETHERIP = 97; |
RAW |
pub const RAW = 255; |
MAX |
pub const MAX = 256; }, .openbsd => struct { /// dummy for IP |
IP |
pub const IP = 0; /// IP6 hop-by-hop options |
HOPOPTS |
pub const HOPOPTS = IP; /// control message protocol |
ICMP |
pub const ICMP = 1; /// group mgmt protocol |
IGMP |
pub const IGMP = 2; /// gateway^2 (deprecated) |
GGP |
pub const GGP = 3; /// IP header |
IPV4 |
pub const IPV4 = IPIP; /// IP inside IP |
IPIP |
pub const IPIP = 4; /// tcp |
TCP |
pub const TCP = 6; /// exterior gateway protocol |
EGP |
pub const EGP = 8; /// pup |
PUP |
pub const PUP = 12; /// user datagram protocol |
UDP |
pub const UDP = 17; /// xns idp |
IDP |
pub const IDP = 22; /// tp-4 w/ class negotiation |
TP |
pub const TP = 29; /// IP6 header |
IPV6 |
pub const IPV6 = 41; /// IP6 routing header |
ROUTING |
pub const ROUTING = 43; /// IP6 fragmentation header |
FRAGMENT |
pub const FRAGMENT = 44; /// resource reservation |
RSVP |
pub const RSVP = 46; /// GRE encaps RFC 1701 |
GRE |
pub const GRE = 47; /// encap. security payload |
ESP |
pub const ESP = 50; /// authentication header |
AH |
pub const AH = 51; /// IP Mobility RFC 2004 |
MOBILE |
pub const MOBILE = 55; /// IPv6 ICMP |
IPV6_ICMP |
pub const IPV6_ICMP = 58; /// ICMP6 |
ICMPV6 |
pub const ICMPV6 = 58; /// IP6 no next header |
NONE |
pub const NONE = 59; /// IP6 destination option |
DSTOPTS |
pub const DSTOPTS = 60; /// ISO cnlp |
EON |
pub const EON = 80; /// Ethernet-in-IP |
ETHERIP |
pub const ETHERIP = 97; /// encapsulation header |
ENCAP |
pub const ENCAP = 98; /// Protocol indep. multicast |
PIM |
pub const PIM = 103; /// IP Payload Comp. Protocol |
IPCOMP |
pub const IPCOMP = 108; /// VRRP RFC 2338 |
VRRP |
pub const VRRP = 112; /// Common Address Resolution Protocol |
CARP |
pub const CARP = 112; /// PFSYNC |
PFSYNC |
pub const PFSYNC = 240; /// raw IP packet |
RAW |
pub const RAW = 255; }, // https://github.com/SerenityOS/serenity/blob/ac44ec5ebc707f9dd0c3d4759a1e17e91db5d74f/Kernel/API/POSIX/sys/socket.h#L44-L54 .serenity => struct { |
IP |
pub const IP = 0; |
ICMP |
pub const ICMP = 1; |
IGMP |
pub const IGMP = 2; |
IPIP |
pub const IPIP = 4; |
TCP |
pub const TCP = 6; |
UDP |
pub const UDP = 17; |
IPV6 |
pub const IPV6 = 41; |
ESP |
pub const ESP = 50; |
AH |
pub const AH = 51; |
ICMPV6 |
pub const ICMPV6 = 58; |
RAW |
pub const RAW = 255; }, else => void, |
DIR |
}; pub const SOL = switch (native_os) { .linux => linux.SOL, .emscripten => emscripten.SOL, .windows => ws2_32.SOL, .openbsd, .haiku, .dragonfly, .netbsd, .freebsd, .macos, .ios, .tvos, .watchos, .visionos => struct { |
SOCKET |
pub const SOCKET = 0xffff; }, .solaris, .illumos => struct { |
SOCKET |
pub const SOCKET = 0xffff; |
ROUTE |
pub const ROUTE = 0xfffe; |
PACKET |
pub const PACKET = 0xfffd; |
FILTER |
pub const FILTER = 0xfffc; }, // https://github.com/SerenityOS/serenity/blob/ac44ec5ebc707f9dd0c3d4759a1e17e91db5d74f/Kernel/API/POSIX/sys/socket.h#L127 .serenity => struct { |
SOCKET |
pub const SOCKET = 1; }, else => void, |
DIR |
}; pub const SO = switch (native_os) { .linux => linux.SO, .emscripten => emscripten.SO, .windows => ws2_32.SO, .macos, .ios, .tvos, .watchos, .visionos => struct { |
DEBUG |
pub const DEBUG = 0x0001; |
ACCEPTCONN |
pub const ACCEPTCONN = 0x0002; |
REUSEADDR |
pub const REUSEADDR = 0x0004; |
KEEPALIVE |
pub const KEEPALIVE = 0x0008; |
DONTROUTE |
pub const DONTROUTE = 0x0010; |
BROADCAST |
pub const BROADCAST = 0x0020; |
USELOOPBACK |
pub const USELOOPBACK = 0x0040; |
LINGER |
pub const LINGER = 0x1080; |
OOBINLINE |
pub const OOBINLINE = 0x0100; |
REUSEPORT |
pub const REUSEPORT = 0x0200; |
ACCEPTFILTER |
pub const ACCEPTFILTER = 0x1000; |
SNDBUF |
pub const SNDBUF = 0x1001; |
RCVBUF |
pub const RCVBUF = 0x1002; |
SNDLOWAT |
pub const SNDLOWAT = 0x1003; |
RCVLOWAT |
pub const RCVLOWAT = 0x1004; |
SNDTIMEO |
pub const SNDTIMEO = 0x1005; |
RCVTIMEO |
pub const RCVTIMEO = 0x1006; |
ERROR |
pub const ERROR = 0x1007; |
TYPE |
pub const TYPE = 0x1008; |
NREAD |
pub const NREAD = 0x1020; |
NKE |
pub const NKE = 0x1021; |
NOSIGPIPE |
pub const NOSIGPIPE = 0x1022; |
NOADDRERR |
pub const NOADDRERR = 0x1023; |
NWRITE |
pub const NWRITE = 0x1024; |
REUSESHAREUID |
pub const REUSESHAREUID = 0x1025; }, .freebsd => struct { |
DEBUG |
pub const DEBUG = 0x00000001; |
ACCEPTCONN |
pub const ACCEPTCONN = 0x00000002; |
REUSEADDR |
pub const REUSEADDR = 0x00000004; |
KEEPALIVE |
pub const KEEPALIVE = 0x00000008; |
DONTROUTE |
pub const DONTROUTE = 0x00000010; |
BROADCAST |
pub const BROADCAST = 0x00000020; |
USELOOPBACK |
pub const USELOOPBACK = 0x00000040; |
LINGER |
pub const LINGER = 0x00000080; |
OOBINLINE |
pub const OOBINLINE = 0x00000100; |
REUSEPORT |
pub const REUSEPORT = 0x00000200; |
TIMESTAMP |
pub const TIMESTAMP = 0x00000400; |
NOSIGPIPE |
pub const NOSIGPIPE = 0x00000800; |
ACCEPTFILTER |
pub const ACCEPTFILTER = 0x00001000; |
BINTIME |
pub const BINTIME = 0x00002000; |
NO_OFFLOAD |
pub const NO_OFFLOAD = 0x00004000; |
NO_DDP |
pub const NO_DDP = 0x00008000; |
REUSEPORT_LB |
pub const REUSEPORT_LB = 0x00010000; |
SNDBUF |
|
SNDBUF |
pub const SNDBUF = 0x1001; |
RCVBUF |
pub const RCVBUF = 0x1002; |
SNDLOWAT |
pub const SNDLOWAT = 0x1003; |
RCVLOWAT |
pub const RCVLOWAT = 0x1004; |
SNDTIMEO |
pub const SNDTIMEO = 0x1005; |
RCVTIMEO |
pub const RCVTIMEO = 0x1006; |
ERROR |
pub const ERROR = 0x1007; |
TYPE |
pub const TYPE = 0x1008; pub const LABEL = 0x1009; |
PEERLABEL |
pub const PEERLABEL = 0x1010; |
LISTENQLIMIT |
pub const LISTENQLIMIT = 0x1011; |
LISTENQLEN |
pub const LISTENQLEN = 0x1012; |
LISTENINCQLEN |
pub const LISTENINCQLEN = 0x1013; |
SETFIB |
pub const SETFIB = 0x1014; |
USER_COOKIE |
pub const USER_COOKIE = 0x1015; |
PROTOCOL |
pub const PROTOCOL = 0x1016; |
PROTOTYPE |
pub const PROTOTYPE = PROTOCOL; |
TS_CLOCK |
pub const TS_CLOCK = 0x1017; |
MAX_PACING_RATE |
pub const MAX_PACING_RATE = 0x1018; |
DOMAIN |
pub const DOMAIN = 0x1019; }, .solaris, .illumos => struct { |
DEBUG |
pub const DEBUG = 0x0001; |
ACCEPTCONN |
pub const ACCEPTCONN = 0x0002; |
REUSEADDR |
pub const REUSEADDR = 0x0004; |
KEEPALIVE |
pub const KEEPALIVE = 0x0008; |
DONTROUTE |
pub const DONTROUTE = 0x0010; |
BROADCAST |
pub const BROADCAST = 0x0020; |
USELOOPBACK |
pub const USELOOPBACK = 0x0040; |
LINGER |
pub const LINGER = 0x0080; |
OOBINLINE |
pub const OOBINLINE = 0x0100; |
DGRAM_ERRIND |
pub const DGRAM_ERRIND = 0x0200; |
RECVUCRED |
pub const RECVUCRED = 0x0400; |
SNDBUF |
|
SNDBUF |
pub const SNDBUF = 0x1001; |
RCVBUF |
pub const RCVBUF = 0x1002; |
SNDLOWAT |
pub const SNDLOWAT = 0x1003; |
RCVLOWAT |
pub const RCVLOWAT = 0x1004; |
SNDTIMEO |
pub const SNDTIMEO = 0x1005; |
RCVTIMEO |
pub const RCVTIMEO = 0x1006; |
ERROR |
pub const ERROR = 0x1007; |
TYPE |
pub const TYPE = 0x1008; pub const PROTOTYPE = 0x1009; |
ANON_MLP |
pub const ANON_MLP = 0x100a; |
MAC_EXEMPT |
pub const MAC_EXEMPT = 0x100b; |
DOMAIN |
pub const DOMAIN = 0x100c; |
RCVPSH |
pub const RCVPSH = 0x100d; |
SECATTR |
pub const SECATTR = 0x1011; |
TIMESTAMP |
pub const TIMESTAMP = 0x1013; |
ALLZONES |
pub const ALLZONES = 0x1014; |
EXCLBIND |
pub const EXCLBIND = 0x1015; |
MAC_IMPLICIT |
pub const MAC_IMPLICIT = 0x1016; |
VRRP |
pub const VRRP = 0x1017; }, .netbsd => struct { |
DEBUG |
pub const DEBUG = 0x0001; |
ACCEPTCONN |
pub const ACCEPTCONN = 0x0002; |
REUSEADDR |
pub const REUSEADDR = 0x0004; |
KEEPALIVE |
pub const KEEPALIVE = 0x0008; |
DONTROUTE |
pub const DONTROUTE = 0x0010; |
BROADCAST |
pub const BROADCAST = 0x0020; |
USELOOPBACK |
pub const USELOOPBACK = 0x0040; |
LINGER |
pub const LINGER = 0x0080; |
OOBINLINE |
pub const OOBINLINE = 0x0100; |
REUSEPORT |
pub const REUSEPORT = 0x0200; |
NOSIGPIPE |
pub const NOSIGPIPE = 0x0800; |
ACCEPTFILTER |
pub const ACCEPTFILTER = 0x1000; |
TIMESTAMP |
pub const TIMESTAMP = 0x2000; |
RERROR |
pub const RERROR = 0x4000; |
SNDBUF |
|
SNDBUF |
pub const SNDBUF = 0x1001; |
RCVBUF |
pub const RCVBUF = 0x1002; |
SNDLOWAT |
pub const SNDLOWAT = 0x1003; |
RCVLOWAT |
pub const RCVLOWAT = 0x1004; |
ERROR |
pub const ERROR = 0x1007; |
TYPE |
pub const TYPE = 0x1008; pub const OVERFLOWED = 0x1009; |
NOHEADER |
pub const NOHEADER = 0x100a; |
SNDTIMEO |
pub const SNDTIMEO = 0x100b; |
RCVTIMEO |
pub const RCVTIMEO = 0x100c; }, .dragonfly => struct { |
DEBUG |
pub const DEBUG = 0x0001; |
ACCEPTCONN |
pub const ACCEPTCONN = 0x0002; |
REUSEADDR |
pub const REUSEADDR = 0x0004; |
KEEPALIVE |
pub const KEEPALIVE = 0x0008; |
DONTROUTE |
pub const DONTROUTE = 0x0010; |
BROADCAST |
pub const BROADCAST = 0x0020; |
USELOOPBACK |
pub const USELOOPBACK = 0x0040; |
LINGER |
pub const LINGER = 0x0080; |
OOBINLINE |
pub const OOBINLINE = 0x0100; |
REUSEPORT |
pub const REUSEPORT = 0x0200; |
TIMESTAMP |
pub const TIMESTAMP = 0x0400; |
NOSIGPIPE |
pub const NOSIGPIPE = 0x0800; |
ACCEPTFILTER |
pub const ACCEPTFILTER = 0x1000; |
RERROR |
pub const RERROR = 0x2000; |
PASSCRED |
pub const PASSCRED = 0x4000; |
SNDBUF |
|
SNDBUF |
pub const SNDBUF = 0x1001; |
RCVBUF |
pub const RCVBUF = 0x1002; |
SNDLOWAT |
pub const SNDLOWAT = 0x1003; |
RCVLOWAT |
pub const RCVLOWAT = 0x1004; |
SNDTIMEO |
pub const SNDTIMEO = 0x1005; |
RCVTIMEO |
pub const RCVTIMEO = 0x1006; |
ERROR |
pub const ERROR = 0x1007; |
TYPE |
pub const TYPE = 0x1008; pub const SNDSPACE = 0x100a; |
CPUHINT |
pub const CPUHINT = 0x1030; }, .haiku => struct { |
ACCEPTCONN |
pub const ACCEPTCONN = 0x00000001; |
BROADCAST |
pub const BROADCAST = 0x00000002; |
DEBUG |
pub const DEBUG = 0x00000004; |
DONTROUTE |
pub const DONTROUTE = 0x00000008; |
KEEPALIVE |
pub const KEEPALIVE = 0x00000010; |
OOBINLINE |
pub const OOBINLINE = 0x00000020; |
REUSEADDR |
pub const REUSEADDR = 0x00000040; |
REUSEPORT |
pub const REUSEPORT = 0x00000080; |
USELOOPBACK |
pub const USELOOPBACK = 0x00000100; |
LINGER |
pub const LINGER = 0x00000200; |
SNDBUF |
pub const SNDBUF = 0x40000001; |
SNDLOWAT |
pub const SNDLOWAT = 0x40000002; |
SNDTIMEO |
pub const SNDTIMEO = 0x40000003; |
RCVBUF |
pub const RCVBUF = 0x40000004; |
RCVLOWAT |
pub const RCVLOWAT = 0x40000005; |
RCVTIMEO |
pub const RCVTIMEO = 0x40000006; |
ERROR |
pub const ERROR = 0x40000007; |
TYPE |
pub const TYPE = 0x40000008; |
NONBLOCK |
pub const NONBLOCK = 0x40000009; |
BINDTODEVICE |
pub const BINDTODEVICE = 0x4000000a; |
PEERCRED |
pub const PEERCRED = 0x4000000b; }, .openbsd => struct { |
DEBUG |
pub const DEBUG = 0x0001; |
ACCEPTCONN |
pub const ACCEPTCONN = 0x0002; |
REUSEADDR |
pub const REUSEADDR = 0x0004; |
KEEPALIVE |
pub const KEEPALIVE = 0x0008; |
DONTROUTE |
pub const DONTROUTE = 0x0010; |
BROADCAST |
pub const BROADCAST = 0x0020; |
USELOOPBACK |
pub const USELOOPBACK = 0x0040; |
LINGER |
pub const LINGER = 0x0080; |
OOBINLINE |
pub const OOBINLINE = 0x0100; |
REUSEPORT |
pub const REUSEPORT = 0x0200; |
TIMESTAMP |
pub const TIMESTAMP = 0x0800; |
BINDANY |
pub const BINDANY = 0x1000; |
ZEROIZE |
pub const ZEROIZE = 0x2000; |
SNDBUF |
pub const SNDBUF = 0x1001; |
RCVBUF |
pub const RCVBUF = 0x1002; |
SNDLOWAT |
pub const SNDLOWAT = 0x1003; |
RCVLOWAT |
pub const RCVLOWAT = 0x1004; |
SNDTIMEO |
pub const SNDTIMEO = 0x1005; |
RCVTIMEO |
pub const RCVTIMEO = 0x1006; |
ERROR |
pub const ERROR = 0x1007; |
TYPE |
pub const TYPE = 0x1008; |
NETPROC |
pub const NETPROC = 0x1020; |
RTABLE |
pub const RTABLE = 0x1021; |
PEERCRED |
pub const PEERCRED = 0x1022; |
SPLICE |
pub const SPLICE = 0x1023; |
DOMAIN |
pub const DOMAIN = 0x1024; |
PROTOCOL |
pub const PROTOCOL = 0x1025; }, // https://github.com/SerenityOS/serenity/blob/ac44ec5ebc707f9dd0c3d4759a1e17e91db5d74f/Kernel/API/POSIX/sys/socket.h#L130-L150 .serenity => struct { |
RCVTIMEO |
pub const RCVTIMEO = 0; |
SNDTIMEO |
pub const SNDTIMEO = 1; |
TYPE |
pub const TYPE = 2; |
ERROR |
pub const ERROR = 3; |
PEERCRED |
pub const PEERCRED = 4; |
RCVBUF |
pub const RCVBUF = 5; |
SNDBUF |
pub const SNDBUF = 6; |
DEBUG |
pub const DEBUG = 7; |
REUSEADDR |
pub const REUSEADDR = 8; |
BINDTODEVICE |
pub const BINDTODEVICE = 9; |
KEEPALIVE |
pub const KEEPALIVE = 10; |
TIMESTAMP |
pub const TIMESTAMP = 11; |
BROADCAST |
pub const BROADCAST = 12; |
LINGER |
pub const LINGER = 13; |
ACCEPTCONN |
pub const ACCEPTCONN = 14; |
DONTROUTE |
pub const DONTROUTE = 15; |
OOBINLINE |
pub const OOBINLINE = 16; |
SNDLOWAT |
pub const SNDLOWAT = 17; |
RCVLOWAT |
pub const RCVLOWAT = 18; }, else => void, |
DIR |
}; pub const SOMAXCONN = switch (native_os) { .linux => linux.SOMAXCONN, .windows => ws2_32.SOMAXCONN, // https://github.com/SerenityOS/serenity/blob/ac44ec5ebc707f9dd0c3d4759a1e17e91db5d74f/Kernel/API/POSIX/sys/socket.h#L128 .solaris, .illumos, .serenity => 128, .openbsd => 28, else => void, |
DIR |
}; pub const IFNAMESIZE = switch (native_os) { .linux => linux.IFNAMESIZE, .emscripten => emscripten.IFNAMESIZE, .windows => 30, // https://github.com/SerenityOS/serenity/blob/9882848e0bf783dfc8e8a6d887a848d70d9c58f4/Kernel/API/POSIX/net/if.h#L50 .openbsd, .dragonfly, .netbsd, .freebsd, .macos, .ios, .tvos, .watchos, .visionos, .serenity => 16, .solaris, .illumos => 32, else => void, |
DIR |
}; |
time_t |
pub const stack_t = switch (native_os) { .linux => linux.stack_t, .emscripten => emscripten.stack_t, .freebsd, .openbsd => extern struct { /// Signal stack base. sp: *anyopaque, /// Signal stack length. size: usize, /// SS_DISABLE and/or SS_ONSTACK. flags: i32, }, // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L48-L52 .serenity => extern struct { sp: *anyopaque, flags: c_int, size: usize, }, else => extern struct { sp: [*]u8, size: isize, flags: i32, }, |
DIR |
}; pub const time_t = switch (native_os) { .linux => linux.time_t, .emscripten => emscripten.time_t, .haiku, .dragonfly => isize, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L47 else => i64, |
DIR |
}; pub const suseconds_t = switch (native_os) { // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L49 .solaris, .illumos, .serenity => i64, .freebsd, .dragonfly => c_long, .netbsd => c_int, .haiku => i32, else => void, |
DIR |
}; |
ucontext_t |
pub const timeval = switch (native_os) { .linux => linux.timeval, .emscripten => emscripten.timeval, .windows => extern struct { sec: c_long, usec: c_long, }, .macos, .ios, .tvos, .watchos, .visionos => extern struct { sec: c_long, usec: i32, }, // https://github.com/SerenityOS/serenity/blob/6b6eca0631c893c5f8cfb8274cdfe18e2d0637c0/Kernel/API/POSIX/sys/time.h#L15-L18 .dragonfly, .netbsd, .freebsd, .solaris, .illumos, .serenity => extern struct { /// seconds sec: time_t, /// microseconds usec: suseconds_t, }, .openbsd => extern struct { sec: time_t, usec: c_long, }, else => void, |
DIR |
}; pub const timezone = switch (native_os) { .linux => linux.timezone, .emscripten => emscripten.timezone, .openbsd, .macos, .ios, .tvos, .watchos, .visionos => extern struct { minuteswest: i32, dsttime: i32, }, // https://github.com/SerenityOS/serenity/blob/ba776390b5878ec0be1a9e595a3471a6cfe0a0cf/Userland/Libraries/LibC/sys/time.h#L19-L22 .serenity => extern struct { minuteswest: c_int, dsttime: c_int, }, else => void, |
DIR |
}; |
utsname |
pub const ucontext_t = switch (native_os) { .linux => linux.ucontext_t, // std.os.linux.ucontext_t is currently glibc-compatible, but it should probably not be. .emscripten => emscripten.ucontext_t, .macos, .ios, .tvos, .watchos, .visionos => extern struct { onstack: c_int, sigmask: sigset_t, stack: stack_t, link: ?*ucontext_t, mcsize: u64, mcontext: *mcontext_t, __mcontext_data: mcontext_t, }, .freebsd => extern struct { sigmask: sigset_t, mcontext: mcontext_t, link: ?*ucontext_t, stack: stack_t, flags: c_int, __spare__: [4]c_int, }, .solaris, .illumos => extern struct { flags: u64, link: ?*ucontext_t, sigmask: sigset_t, stack: stack_t, mcontext: mcontext_t, brand_data: [3]?*anyopaque, filler: [2]i64, }, .netbsd => extern struct { flags: u32, link: ?*ucontext_t, sigmask: sigset_t, stack: stack_t, mcontext: mcontext_t, __pad: [ switch (builtin.cpu.arch) { .x86 => 4, .mips, .mipsel, .mips64, .mips64el => 14, .arm, .armeb, .thumb, .thumbeb => 1, .sparc, .sparc64 => if (@sizeOf(usize) == 4) 43 else 8, else => 0, } ]u32, }, .dragonfly => extern struct { sigmask: sigset_t, mcontext: mcontext_t, link: ?*ucontext_t, stack: stack_t, cofunc: ?*fn (?*ucontext_t, ?*anyopaque) void, arg: ?*void, _spare: [4]c_int, }, // https://github.com/SerenityOS/serenity/blob/87eac0e424cff4a1f941fb704b9362a08654c24d/Kernel/API/POSIX/ucontext.h#L19-L24 .haiku, .serenity => extern struct { link: ?*ucontext_t, sigmask: sigset_t, stack: stack_t, mcontext: mcontext_t, }, .openbsd => openbsd.ucontext_t, else => void, |
DIR |
}; pub const mcontext_t = switch (native_os) { .linux => linux.mcontext_t, .emscripten => emscripten.mcontext_t, .macos, .ios, .tvos, .watchos, .visionos => darwin.mcontext_t, .freebsd => switch (builtin.cpu.arch) { .x86_64 => extern struct { onstack: u64, rdi: u64, rsi: u64, rdx: u64, rcx: u64, r8: u64, r9: u64, rax: u64, rbx: u64, rbp: u64, r10: u64, r11: u64, r12: u64, r13: u64, r14: u64, r15: u64, trapno: u32, fs: u16, gs: u16, addr: u64, flags: u32, es: u16, ds: u16, err: u64, rip: u64, cs: u64, rflags: u64, rsp: u64, ss: u64, len: u64, fpformat: u64, ownedfp: u64, fpstate: [64]u64 align(16), fsbase: u64, gsbase: u64, xfpustate: u64, xfpustate_len: u64, spare: [4]u64, }, .aarch64 => extern struct { gpregs: extern struct { x: [30]u64, lr: u64, sp: u64, elr: u64, spsr: u32, _pad: u32, }, fpregs: extern struct { q: [32]u128, sr: u32, cr: u32, flags: u32, _pad: u32, }, flags: u32, _pad: u32, _spare: [8]u64, }, else => struct {}, }, .solaris, .illumos => extern struct { gregs: [28]u64, fpregs: solaris.fpregset_t, }, .netbsd => switch (builtin.cpu.arch) { .aarch64, .aarch64_be => extern struct { gregs: [35]u64, fregs: [528]u8 align(16), spare: [8]u64, }, .x86 => extern struct { gregs: [19]u32, fpregs: [161]u32, mc_tlsbase: u32, }, .x86_64 => extern struct { gregs: [26]u64, mc_tlsbase: u64, fpregs: [512]u8 align(8), }, else => struct {}, }, .dragonfly => dragonfly.mcontext_t, .haiku => haiku.mcontext_t, .serenity => switch (native_arch) { // https://github.com/SerenityOS/serenity/blob/200e91cd7f1ec5453799a2720d4dc114a59cc289/Kernel/Arch/aarch64/mcontext.h#L15-L19 .aarch64 => extern struct { x: [31]u64, sp: u64, pc: u64, }, // https://github.com/SerenityOS/serenity/blob/66f8d0f031ef25c409dbb4fecaa454800fecae0f/Kernel/Arch/riscv64/mcontext.h#L15-L18 .riscv64 => extern struct { x: [31]u64, pc: u64, }, // https://github.com/SerenityOS/serenity/blob/7b9ea3efdec9f86a1042893e8107d0b23aad8727/Kernel/Arch/x86_64/mcontext.h#L15-L40 .x86_64 => extern struct { rax: u64, rcx: u64, rdx: u64, rbx: u64, rsp: u64, rbp: u64, rsi: u64, rdi: u64, rip: u64, r8: u64, r9: u64, r10: u64, r11: u64, r12: u64, r13: u64, r14: u64, r15: u64, rflags: u64, cs: u32, ss: u32, ds: u32, es: u32, fs: u32, gs: u32, }, else => struct {}, }, else => void, |
DIR |
}; |
RTLD |
pub const user_desc = switch (native_os) { .linux => linux.user_desc, else => void, |
DIR |
}; pub const utsname = switch (native_os) { .linux => linux.utsname, .emscripten => emscripten.utsname, .solaris, .illumos => extern struct { sysname: [256:0]u8, nodename: [256:0]u8, release: [256:0]u8, version: [256:0]u8, machine: [256:0]u8, domainname: [256:0]u8, }, .macos => extern struct { sysname: [255:0]u8, nodename: [255:0]u8, release: [255:0]u8, version: [255:0]u8, machine: [255:0]u8, }, // https://github.com/SerenityOS/serenity/blob/d794ed1de7a46482272683f8dc4c858806390f29/Kernel/API/POSIX/sys/utsname.h#L17-L23 .serenity => extern struct { sysname: [UTSNAME_ENTRY_LEN:0]u8, nodename: [UTSNAME_ENTRY_LEN:0]u8, release: [UTSNAME_ENTRY_LEN:0]u8, version: [UTSNAME_ENTRY_LEN:0]u8, machine: [UTSNAME_ENTRY_LEN:0]u8, |
reclen() |
const UTSNAME_ENTRY_LEN = 64; }, else => void, |
DIR |
}; pub const PR = switch (native_os) { .linux => linux.PR, else => void, |
DIR |
}; pub const _errno = switch (native_os) { .linux => switch (native_abi) { .android, .androideabi => private.__errno, else => private.__errno_location, }, .emscripten => private.__errno_location, .wasi, .dragonfly => private.errnoFromThreadLocal, .windows => private._errno, .macos, .ios, .tvos, .watchos, .visionos, .freebsd => private.__error, .solaris, .illumos => private.___errno, .openbsd, .netbsd => private.__errno, .haiku => haiku._errnop, // https://github.com/SerenityOS/serenity/blob/a353ceecf13b6f156a078e32f1ddf1d21366934c/Userland/Libraries/LibC/errno.h#L33 .serenity => private.__errno_location, else => {}, |
DIR |
}; |
NI |
pub const RTLD = switch (native_os) { .linux, .emscripten => packed struct(u32) { LAZY: bool = false, NOW: bool = false, NOLOAD: bool = false, _3: u5 = 0, GLOBAL: bool = false, _9: u3 = 0, NODELETE: bool = false, _: u19 = 0, }, .dragonfly, .freebsd => packed struct(u32) { LAZY: bool = false, NOW: bool = false, _2: u6 = 0, GLOBAL: bool = false, TRACE: bool = false, _10: u2 = 0, NODELETE: bool = false, NOLOAD: bool = false, _: u18 = 0, }, .haiku => packed struct(u32) { NOW: bool = false, GLOBAL: bool = false, _: u30 = 0, }, .netbsd => packed struct(u32) { LAZY: bool = false, NOW: bool = false, _2: u6 = 0, GLOBAL: bool = false, LOCAL: bool = false, _10: u2 = 0, NODELETE: bool = false, NOLOAD: bool = false, _: u18 = 0, }, .solaris, .illumos => packed struct(u32) { LAZY: bool = false, NOW: bool = false, NOLOAD: bool = false, _3: u5 = 0, GLOBAL: bool = false, PARENT: bool = false, GROUP: bool = false, WORLD: bool = false, NODELETE: bool = false, FIRST: bool = false, _14: u2 = 0, CONFGEN: bool = false, _: u15 = 0, }, .openbsd => packed struct(u32) { LAZY: bool = false, NOW: bool = false, _2: u6 = 0, GLOBAL: bool = false, TRACE: bool = false, _: u22 = 0, }, .macos, .ios, .tvos, .watchos, .visionos => packed struct(u32) { LAZY: bool = false, NOW: bool = false, LOCAL: bool = false, GLOBAL: bool = false, NOLOAD: bool = false, _5: u2 = 0, NODELETE: bool = false, FIRST: bool = false, _: u23 = 0, }, // https://github.com/SerenityOS/serenity/blob/36a26d7fa80bc9c72b19442912d8967f448368ff/Userland/Libraries/LibC/dlfcn.h#L13-L17 .serenity => packed struct(c_int) { DEFAULT: bool = false, _1: u1, LAZY: bool = false, NOW: bool = false, GLOBAL: bool = false, LOCAL: bool = false, _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 6) = 0, }, else => void, |
DIR |
}; |
dl_iterate_phdr_callback |
pub const dirent = switch (native_os) { .linux, .emscripten => extern struct { ino: ino_t, off: off_t, reclen: c_ushort, type: u8, name: [256]u8, }, .macos, .ios, .tvos, .watchos, .visionos => extern struct { ino: u64, seekoff: u64, reclen: u16, namlen: u16, type: u8, name: [1024]u8, }, .freebsd => extern struct { /// File number of entry. fileno: ino_t, /// Directory offset of entry. off: off_t, /// Length of this record. reclen: u16, /// File type, one of DT_. type: u8, pad0: u8 = 0, /// Length of the name member. namlen: u16, pad1: u16 = 0, /// Name of entry. name: [255:0]u8, }, .solaris, .illumos => extern struct { /// Inode number of entry. ino: ino_t, /// Offset of this entry on disk. off: off_t, /// Length of this record. reclen: u16, /// File name. name: [MAXNAMLEN:0]u8, }, .netbsd => extern struct { fileno: ino_t, reclen: u16, namlen: u16, type: u8, name: [MAXNAMLEN:0]u8, }, .dragonfly => extern struct { fileno: c_ulong, namlen: u16, type: u8, unused1: u8, unused2: u32, name: [256]u8, |
Stat |
pub fn reclen(self: dirent) u16 { return (@offsetOf(dirent, "name") + self.namlen + 1 + 7) & ~@as(u16, 7); } }, .openbsd => extern struct { fileno: ino_t, off: off_t, reclen: u16, type: u8, namlen: u8, _: u32 align(1) = 0, name: [MAXNAMLEN:0]u8, }, // https://github.com/SerenityOS/serenity/blob/abc150085f532f123b598949218893cb272ccc4c/Userland/Libraries/LibC/dirent.h#L14-L20 .serenity => extern struct { ino: ino_t, off: off_t, reclen: c_ushort, type: u8, name: [255:0]u8, }, else => void, |
DIR |
}; pub const MAXNAMLEN = switch (native_os) { .netbsd, .solaris, .illumos => 511, // https://github.com/SerenityOS/serenity/blob/1262a7d1424d0d2e89d80644409721cbf056ab17/Kernel/API/POSIX/dirent.h#L37 .haiku, .serenity => NAME_MAX, .openbsd => 255, else => {}, |
DIR |
}; pub const dirent64 = switch (native_os) { .linux => extern struct { ino: c_ulong, off: c_ulong, reclen: c_ushort, type: u8, name: [256]u8, }, else => void, |
DIR |
}; |
atime() |
pub const AI = if (builtin.abi.isAndroid()) packed struct(u32) { PASSIVE: bool = false, CANONNAME: bool = false, NUMERICHOST: bool = false, NUMERICSERV: bool = false, _4: u4 = 0, ALL: bool = false, V4MAPPED_CFG: bool = false, ADDRCONFIG: bool = false, V4MAPPED: bool = false, _: u20 = 0, } else switch (native_os) { .linux, .emscripten => linux.AI, .dragonfly, .haiku, .freebsd => packed struct(u32) { PASSIVE: bool = false, CANONNAME: bool = false, NUMERICHOST: bool = false, NUMERICSERV: bool = false, _4: u4 = 0, ALL: bool = false, V4MAPPED_CFG: bool = false, ADDRCONFIG: bool = false, V4MAPPED: bool = false, _: u20 = 0, }, .netbsd => packed struct(u32) { PASSIVE: bool = false, CANONNAME: bool = false, NUMERICHOST: bool = false, NUMERICSERV: bool = false, _4: u6 = 0, ADDRCONFIG: bool = false, _: u21 = 0, }, .solaris, .illumos => packed struct(u32) { V4MAPPED: bool = false, ALL: bool = false, ADDRCONFIG: bool = false, PASSIVE: bool = false, CANONNAME: bool = false, NUMERICHOST: bool = false, NUMERICSERV: bool = false, _: u25 = 0, }, .openbsd => packed struct(u32) { PASSIVE: bool = false, CANONNAME: bool = false, NUMERICHOST: bool = false, _3: u1 = 0, NUMERICSERV: bool = false, _5: u1 = 0, ADDRCONFIG: bool = false, _: u25 = 0, }, .macos, .ios, .tvos, .watchos, .visionos => packed struct(u32) { PASSIVE: bool = false, CANONNAME: bool = false, NUMERICHOST: bool = false, _3: u5 = 0, ALL: bool = false, V4MAPPED_CFG: bool = false, ADDRCONFIG: bool = false, V4MAPPED: bool = false, NUMERICSERV: bool = false, _: u19 = 0, }, .windows => ws2_32.AI, // https://github.com/SerenityOS/serenity/blob/d510d2aeb2facbd8f6c383d70fd1b033e1fee5dd/Userland/Libraries/LibC/netdb.h#L90-L96 .serenity => packed struct(c_int) { PASSIVE: bool = false, CANONNAME: bool = false, NUMERICHOST: bool = false, NUMERICSERV: bool = false, V4MAPPED: bool = false, ALL: bool = false, ADDRCONFIG: bool = false, _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 7) = 0, }, else => void, |
DIR |
}; |
ctime() |
pub const NI = switch (native_os) { .linux, .emscripten => packed struct(u32) { NUMERICHOST: bool = false, NUMERICSERV: bool = false, NOFQDN: bool = false, NAMEREQD: bool = false, DGRAM: bool = false, _5: u3 = 0, NUMERICSCOPE: bool = false, _: u23 = 0, }, .solaris, .illumos => packed struct(u32) { NOFQDN: bool = false, NUMERICHOST: bool = false, NAMEREQD: bool = false, NUMERICSERV: bool = false, DGRAM: bool = false, WITHSCOPEID: bool = false, NUMERICSCOPE: bool = false, _: u25 = 0, }, // https://github.com/SerenityOS/serenity/blob/d510d2aeb2facbd8f6c383d70fd1b033e1fee5dd/Userland/Libraries/LibC/netdb.h#L101-L105 .serenity => packed struct(c_int) { NUMERICHOST: bool = false, NUMERICSERV: bool = false, NAMEREQD: bool = false, NOFQDN: bool = false, DGRAM: bool = false, _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 5) = 0, }, else => void, |
DIR |
}; |
mtime() |
pub const EAI = if (builtin.abi.isAndroid()) enum(c_int) { /// address family for hostname not supported ADDRFAMILY = 1, /// temporary failure in name resolution AGAIN = 2, /// invalid value for ai_flags BADFLAGS = 3, /// non-recoverable failure in name resolution FAIL = 4, /// ai_family not supported FAMILY = 5, /// memory allocation failure MEMORY = 6, /// no address associated with hostname NODATA = 7, /// hostname nor servname provided, or not known NONAME = 8, /// servname not supported for ai_socktype SERVICE = 9, /// ai_socktype not supported SOCKTYPE = 10, /// system error returned in errno SYSTEM = 11, /// invalid value for hints BADHINTS = 12, /// resolved protocol is unknown PROTOCOL = 13, /// argument buffer overflow OVERFLOW = 14, |
ctime() |
MAX = 15, |
atime() |
_, } else switch (native_os) { .linux, .emscripten => enum(c_int) { BADFLAGS = -1, NONAME = -2, AGAIN = -3, FAIL = -4, FAMILY = -6, SOCKTYPE = -7, SERVICE = -8, MEMORY = -10, SYSTEM = -11, OVERFLOW = -12, |
mtime() |
NODATA = -5, ADDRFAMILY = -9, INPROGRESS = -100, CANCELED = -101, NOTCANCELED = -102, ALLDONE = -103, INTR = -104, IDN_ENCODE = -105, |
ctime() |
_, }, .haiku, .dragonfly, .netbsd, .freebsd, .macos, .ios, .tvos, .watchos, .visionos => enum(c_int) { /// address family for hostname not supported ADDRFAMILY = 1, /// temporary failure in name resolution AGAIN = 2, /// invalid value for ai_flags BADFLAGS = 3, /// non-recoverable failure in name resolution FAIL = 4, /// ai_family not supported FAMILY = 5, /// memory allocation failure MEMORY = 6, /// no address associated with hostname NODATA = 7, /// hostname nor servname provided, or not known NONAME = 8, /// servname not supported for ai_socktype SERVICE = 9, /// ai_socktype not supported SOCKTYPE = 10, /// system error returned in errno SYSTEM = 11, /// invalid value for hints BADHINTS = 12, /// resolved protocol is unknown PROTOCOL = 13, /// argument buffer overflow OVERFLOW = 14, _, }, .solaris, .illumos => enum(c_int) { /// address family for hostname not supported ADDRFAMILY = 1, /// name could not be resolved at this time AGAIN = 2, /// flags parameter had an invalid value BADFLAGS = 3, /// non-recoverable failure in name resolution FAIL = 4, /// address family not recognized FAMILY = 5, /// memory allocation failure MEMORY = 6, /// no address associated with hostname NODATA = 7, /// name does not resolve NONAME = 8, /// service not recognized for socket type SERVICE = 9, /// intended socket type was not recognized SOCKTYPE = 10, /// system error returned in errno SYSTEM = 11, /// argument buffer overflow OVERFLOW = 12, /// resolved protocol is unknown PROTOCOL = 13, |
atime() |
_, }, .openbsd => enum(c_int) { /// address family for hostname not supported ADDRFAMILY = -9, /// name could not be resolved at this time AGAIN = -3, /// flags parameter had an invalid value BADFLAGS = -1, /// non-recoverable failure in name resolution FAIL = -4, /// address family not recognized FAMILY = -6, /// memory allocation failure MEMORY = -10, /// no address associated with hostname NODATA = -5, /// name does not resolve NONAME = -2, /// service not recognized for socket type SERVICE = -8, /// intended socket type was not recognized SOCKTYPE = -7, /// system error returned in errno SYSTEM = -11, /// invalid value for hints BADHINTS = -12, /// resolved protocol is unknown PROTOCOL = -13, /// argument buffer overflow OVERFLOW = -14, _, }, // https://github.com/SerenityOS/serenity/blob/d510d2aeb2facbd8f6c383d70fd1b033e1fee5dd/Userland/Libraries/LibC/netdb.h#L77-L88 .serenity => enum(c_int) { ADDRFAMILY = 1, AGAIN = 2, BADFLAGS = 3, FAIL = 4, FAMILY = 5, MEMORY = 6, NODATA = 7, NONAME = 8, SERVICE = 9, SOCKTYPE = 10, SYSTEM = 11, OVERFLOW = 12, _, }, else => void, |
DIR |
}; |
ctime() |
pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.c) c_int; |
atime() |
pub const Stat = switch (native_os) { .linux => switch (native_arch) { .sparc64 => extern struct { dev: u64, __pad1: u16, ino: ino_t, mode: u32, nlink: u32, |
mtime() |
uid: u32, gid: u32, rdev: u64, __pad2: u16, |
ctime() |
size: off_t, blksize: isize, blocks: i64, |
fromFilestat() |
atim: timespec, mtim: timespec, ctim: timespec, __reserved: [2]usize, |
atime() |
pub fn atime(self: @This()) timespec { return self.atim; } |
mtime() |
pub fn mtime(self: @This()) timespec { return self.mtim; } |
ctime() |
pub fn ctime(self: @This()) timespec { return self.ctim; } }, .mips, .mipsel => if (builtin.target.abi.isMusl()) extern struct { dev: dev_t, __pad0: [2]i32, ino: ino_t, mode: mode_t, nlink: nlink_t, uid: uid_t, gid: gid_t, rdev: dev_t, __pad1: [2]i32, size: off_t, atim: timespec, mtim: timespec, ctim: timespec, blksize: blksize_t, __pad3: i32, blocks: blkcnt_t, __pad4: [14]i32, |
birthtime() |
pub fn atime(self: @This()) timespec { return self.atim; } |
atime() |
pub fn mtime(self: @This()) timespec { return self.mtim; } |
mtime() |
pub fn ctime(self: @This()) timespec { return self.ctim; } } else extern struct { dev: u32, __pad0: [3]u32, ino: ino_t, mode: mode_t, nlink: nlink_t, uid: uid_t, gid: gid_t, rdev: u32, __pad1: [3]u32, size: off_t, atim: timespec, mtim: timespec, ctim: timespec, blksize: blksize_t, __pad3: u32, blocks: blkcnt_t, __pad4: [14]u32, |
ctime() |
pub fn atime(self: @This()) timespec { return self.atim; } |
atime() |
pub fn mtime(self: @This()) timespec { return self.mtim; } |
mtime() |
pub fn ctime(self: @This()) timespec { return self.ctim; } }, .mips64, .mips64el => if (builtin.target.abi.isMusl()) extern struct { dev: dev_t, __pad0: [3]i32, ino: ino_t, mode: mode_t, nlink: nlink_t, uid: uid_t, gid: gid_t, rdev: dev_t, __pad1: [2]u32, size: off_t, __pad2: i32, atim: timespec, mtim: timespec, ctim: timespec, blksize: blksize_t, __pad3: u32, blocks: blkcnt_t, __pad4: [14]i32, |
ctime() |
pub fn atime(self: @This()) timespec { return self.atim; } |
birthtime() |
pub fn mtime(self: @This()) timespec { return self.mtim; } |
atime() |
pub fn ctime(self: @This()) timespec { return self.ctim; } } else extern struct { dev: dev_t, __pad0: [3]u32, ino: ino_t, mode: mode_t, nlink: nlink_t, uid: uid_t, gid: gid_t, rdev: dev_t, __pad1: [3]u32, size: off_t, atim: timespec, mtim: timespec, ctim: timespec, blksize: blksize_t, __pad3: u32, blocks: blkcnt_t, __pad4: [14]i32, |
mtime() |
pub fn atime(self: @This()) timespec { return self.atim; } |
ctime() |
pub fn mtime(self: @This()) timespec { return self.mtim; } |
atime() |
pub fn ctime(self: @This()) timespec { return self.ctim; } }, |
mtime() |
else => std.os.linux.Stat, // libc stat is the same as kernel stat. }, .emscripten => emscripten.Stat, .wasi => extern struct { // Match wasi-libc's `struct stat` in lib/libc/include/wasm-wasi-musl/__struct_stat.h dev: dev_t, ino: ino_t, nlink: nlink_t, mode: mode_t, uid: uid_t, gid: gid_t, __pad0: c_uint = 0, rdev: dev_t, size: off_t, blksize: blksize_t, blocks: blkcnt_t, atim: timespec, mtim: timespec, ctim: timespec, __reserved: [3]c_longlong = [3]c_longlong{ 0, 0, 0 }, |
ctime() |
|
atime() |
pub fn atime(self: @This()) timespec { return self.atim; } |
atime() |
|
mtime() |
pub fn mtime(self: @This()) timespec { return self.mtim; } |
ctime() |
|
ctime() |
pub fn ctime(self: @This()) timespec { return self.ctim; } |
atime() |
pub fn fromFilestat(st: wasi.filestat_t) Stat { return .{ .dev = st.dev, .ino = st.ino, .mode = switch (st.filetype) { .UNKNOWN => 0, .BLOCK_DEVICE => S.IFBLK, .CHARACTER_DEVICE => S.IFCHR, .DIRECTORY => S.IFDIR, .REGULAR_FILE => S.IFREG, .SOCKET_DGRAM => S.IFSOCK, .SOCKET_STREAM => S.IFIFO, .SYMBOLIC_LINK => S.IFLNK, _ => 0, }, .nlink = st.nlink, .size = @intCast(st.size), .atim = timespec.fromTimestamp(st.atim), .mtim = timespec.fromTimestamp(st.mtim), .ctim = timespec.fromTimestamp(st.ctim), |
mtime() |
.uid = 0, .gid = 0, .rdev = 0, .blksize = 0, .blocks = 0, }; } }, .macos, .ios, .tvos, .watchos, .visionos => extern struct { dev: i32, mode: u16, nlink: u16, ino: ino_t, uid: uid_t, gid: gid_t, rdev: i32, atimespec: timespec, mtimespec: timespec, ctimespec: timespec, birthtimespec: timespec, size: off_t, blocks: i64, blksize: i32, flags: u32, gen: u32, lspare: i32, qspare: [2]i64, |
ctime() |
pub fn atime(self: @This()) timespec { return self.atimespec; } |
pthread_mutex_t |
pub fn mtime(self: @This()) timespec { return self.mtimespec; } |
pthread_cond_t |
pub fn ctime(self: @This()) timespec { return self.ctimespec; } |
pthread_rwlock_t |
pub fn birthtime(self: @This()) timespec { return self.birthtimespec; } }, .freebsd => freebsd.Stat, .solaris, .illumos => extern struct { dev: dev_t, ino: ino_t, mode: mode_t, nlink: nlink_t, uid: uid_t, gid: gid_t, rdev: dev_t, size: off_t, atim: timespec, mtim: timespec, ctim: timespec, blksize: blksize_t, blocks: blkcnt_t, fstype: [16]u8, |
pthread_attr_t |
pub fn atime(self: @This()) timespec { return self.atim; } |
pthread_key_t |
pub fn mtime(self: @This()) timespec { return self.mtim; } |
padded_pthread_spin_t |
pub fn ctime(self: @This()) timespec { return self.ctim; } }, .netbsd => extern struct { dev: dev_t, mode: mode_t, ino: ino_t, nlink: nlink_t, uid: uid_t, gid: gid_t, rdev: dev_t, atim: timespec, mtim: timespec, ctim: timespec, birthtim: timespec, size: off_t, blocks: blkcnt_t, blksize: blksize_t, flags: u32, gen: u32, __spare: [2]u32, |
pthread_spin_t |
pub fn atime(self: @This()) timespec { return self.atim; } |
sem_t |
pub fn mtime(self: @This()) timespec { return self.mtim; } |
Kevent |
pub fn ctime(self: @This()) timespec { return self.ctim; } |
port_t |
pub fn birthtime(self: @This()) timespec { return self.birthtim; } }, .dragonfly => extern struct { ino: ino_t, nlink: c_uint, dev: c_uint, mode: c_ushort, padding1: u16, uid: uid_t, gid: gid_t, rdev: c_uint, atim: timespec, mtim: timespec, ctim: timespec, size: c_ulong, blocks: i64, blksize: u32, flags: u32, gen: u32, lspare: i32, qspare1: i64, qspare2: i64, pub fn atime(self: @This()) timespec { return self.atim; } |
port_event |
pub fn mtime(self: @This()) timespec { return self.mtim; } |
AT |
pub fn ctime(self: @This()) timespec { return self.ctim; } }, .haiku => extern struct { dev: dev_t, ino: ino_t, mode: mode_t, nlink: nlink_t, uid: uid_t, gid: gid_t, size: off_t, rdev: dev_t, blksize: blksize_t, atim: timespec, mtim: timespec, ctim: timespec, crtim: timespec, type: u32, blocks: blkcnt_t, |
REMOVEDIR |
pub fn atime(self: @This()) timespec { return self.atim; } pub fn mtime(self: @This()) timespec { return self.mtim; } pub fn ctime(self: @This()) timespec { return self.ctim; } pub fn birthtime(self: @This()) timespec { return self.crtim; } }, .openbsd => extern struct { mode: mode_t, dev: dev_t, ino: ino_t, nlink: nlink_t, uid: uid_t, gid: gid_t, rdev: dev_t, atim: timespec, mtim: timespec, ctim: timespec, size: off_t, blocks: blkcnt_t, blksize: blksize_t, flags: u32, gen: u32, birthtim: timespec, |
FDCWD |
pub fn atime(self: @This()) timespec { return self.atim; } |
EACCESS |
pub fn mtime(self: @This()) timespec { return self.mtim; } |
SYMLINK_NOFOLLOW |
pub fn ctime(self: @This()) timespec { return self.ctim; } |
SYMLINK_FOLLOW |
pub fn birthtime(self: @This()) timespec { return self.birthtim; } }, // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/sys/stat.h#L53-L67 .serenity => extern struct { dev: dev_t, ino: ino_t, mode: mode_t, nlink: nlink_t, uid: uid_t, gid: gid_t, rdev: dev_t, size: off_t, blksize: blksize_t, blocks: blkcnt_t, atim: timespec, mtim: timespec, ctim: timespec, |
REMOVEDIR |
pub fn atime(self: @This()) timespec { return self.atim; } |
FDCWD |
pub fn mtime(self: @This()) timespec { return self.mtim; } |
EACCESS |
pub fn ctime(self: @This()) timespec { return self.ctim; } }, else => void, |
DIR |
}; |
SYMLINK_FOLLOW |
pub const pthread_mutex_t = switch (native_os) { .linux => extern struct { data: [data_len]u8 align(@alignOf(usize)) = [_]u8{0} ** data_len, |
REMOVEDIR |
const data_len = switch (native_abi) { .musl, .musleabi, .musleabihf => if (@sizeOf(usize) == 8) 40 else 24, .gnu, .gnuabin32, .gnuabi64, .gnueabi, .gnueabihf, .gnux32 => switch (native_arch) { .aarch64 => 48, .x86_64 => if (native_abi == .gnux32) 32 else 40, .mips64, .powerpc64, .powerpc64le, .sparc64 => 40, else => if (@sizeOf(usize) == 8) 40 else 24, }, .android, .androideabi => if (@sizeOf(usize) == 8) 40 else 4, else => @compileError("unsupported ABI"), }; }, .macos, .ios, .tvos, .watchos, .visionos => extern struct { sig: c_long = 0x32AAABA7, data: [data_len]u8 = [_]u8{0} ** data_len, |
BENEATH |
const data_len = if (@sizeOf(usize) == 8) 56 else 40; }, .freebsd, .dragonfly, .openbsd => extern struct { inner: ?*anyopaque = null, }, .hermit => extern struct { ptr: usize = maxInt(usize), }, .netbsd => extern struct { magic: u32 = 0x33330003, errorcheck: padded_pthread_spin_t = 0, ceiling: padded_pthread_spin_t = 0, owner: usize = 0, waiters: ?*u8 = null, recursed: u32 = 0, spare2: ?*anyopaque = null, }, .haiku => extern struct { flags: u32 = 0, lock: i32 = 0, unused: i32 = -42, owner: i32 = -1, owner_count: i32 = 0, }, .solaris, .illumos => extern struct { flag1: u16 = 0, flag2: u8 = 0, ceiling: u8 = 0, type: u16 = 0, magic: u16 = 0x4d58, lock: u64 = 0, data: u64 = 0, }, .fuchsia => extern struct { data: [40]u8 align(@alignOf(usize)) = [_]u8{0} ** 40, }, .emscripten => extern struct { data: [24]u8 align(4) = [_]u8{0} ** 24, }, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L68-L73 .serenity => extern struct { lock: u32 = 0, owner: pthread_t = 0, level: c_int = 0, type: c_int = 0, }, else => void, |
DIR |
}; |
EACCESS |
pub const pthread_cond_t = switch (native_os) { .linux => extern struct { data: [48]u8 align(@alignOf(usize)) = [_]u8{0} ** 48, }, .macos, .ios, .tvos, .watchos, .visionos => extern struct { sig: c_long = 0x3CB0B1BB, data: [data_len]u8 = [_]u8{0} ** data_len, const data_len = if (@sizeOf(usize) == 8) 40 else 24; }, .freebsd, .dragonfly, .openbsd => extern struct { inner: ?*anyopaque = null, }, .hermit => extern struct { ptr: usize = maxInt(usize), }, .netbsd => extern struct { magic: u32 = 0x55550005, lock: pthread_spin_t = 0, waiters_first: ?*u8 = null, waiters_last: ?*u8 = null, mutex: ?*pthread_mutex_t = null, private: ?*anyopaque = null, }, .haiku => extern struct { flags: u32 = 0, unused: i32 = -42, mutex: ?*anyopaque = null, waiter_count: i32 = 0, lock: i32 = 0, }, .solaris, .illumos => extern struct { flag: [4]u8 = [_]u8{0} ** 4, type: u16 = 0, magic: u16 = 0x4356, data: u64 = 0, }, .fuchsia, .emscripten => extern struct { data: [48]u8 align(@alignOf(usize)) = [_]u8{0} ** 48, }, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L80-L84 .serenity => extern struct { mutex: ?*pthread_mutex_t = null, value: u32 = 0, clockid: clockid_t = .REALTIME_COARSE, }, else => void, |
DIR |
}; |
SYMLINK_FOLLOW |
pub const pthread_rwlock_t = switch (native_os) { .linux => switch (native_abi) { .android, .androideabi => switch (@sizeOf(usize)) { 4 => extern struct { data: [40]u8 align(@alignOf(usize)) = [_]u8{0} ** 40, }, 8 => extern struct { data: [56]u8 align(@alignOf(usize)) = [_]u8{0} ** 56, }, else => @compileError("impossible pointer size"), }, else => extern struct { data: [56]u8 align(@alignOf(usize)) = [_]u8{0} ** 56, }, }, .macos, .ios, .tvos, .watchos, .visionos => extern struct { sig: c_long = 0x2DA8B3B4, data: [192]u8 = [_]u8{0} ** 192, }, .freebsd, .dragonfly, .openbsd => extern struct { ptr: ?*anyopaque = null, }, .hermit => extern struct { ptr: usize = maxInt(usize), }, .netbsd => extern struct { magic: c_uint = 0x99990009, interlock: switch (builtin.cpu.arch) { .aarch64, .aarch64_be, .m68k, .sparc, .sparc64, .x86, .x86_64 => u8, .arm, .armeb, .powerpc => c_int, .mips, .mipsel, .mips64, .mips64el => c_uint, else => unreachable, } = 0, rblocked_first: ?*u8 = null, rblocked_last: ?*u8 = null, wblocked_first: ?*u8 = null, wblocked_last: ?*u8 = null, nreaders: c_uint = 0, owner: ?pthread_t = null, private: ?*anyopaque = null, }, .solaris, .illumos => extern struct { readers: i32 = 0, type: u16 = 0, magic: u16 = 0x5257, mutex: pthread_mutex_t = .{}, readercv: pthread_cond_t = .{}, writercv: pthread_cond_t = .{}, }, .fuchsia => extern struct { size: [56]u8 align(@alignOf(usize)) = [_]u8{0} ** 56, }, .emscripten => extern struct { size: [32]u8 align(4) = [_]u8{0} ** 32, }, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L86 .serenity => extern struct { inner: u64 = 0, }, else => void, |
DIR |
}; |
FDCWD |
pub const pthread_attr_t = switch (native_os) { .linux, .emscripten, .dragonfly => extern struct { __size: [56]u8, __align: c_long, }, .macos, .ios, .tvos, .watchos, .visionos => extern struct { __sig: c_long, __opaque: [56]u8, }, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L75 .freebsd, .openbsd, .serenity => extern struct { inner: ?*anyopaque = null, }, .solaris, .illumos => extern struct { mutexattr: ?*anyopaque = null, }, .netbsd => extern struct { magic: u32, flags: i32, private: ?*anyopaque, }, .haiku => extern struct { detach_state: i32, sched_priority: i32, stack_size: i32, guard_size: i32, stack_address: ?*anyopaque, }, else => void, |
DIR |
}; |
REMOVEDIR |
pub const pthread_key_t = switch (native_os) { .linux, .emscripten => c_uint, .macos, .ios, .tvos, .watchos, .visionos => c_ulong, // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L65 .openbsd, .solaris, .illumos, .serenity => c_int, else => void, |
DIR |
}; |
SYMLINK_FOLLOW |
pub const padded_pthread_spin_t = switch (native_os) { .netbsd => switch (builtin.cpu.arch) { .x86, .x86_64 => u32, .sparc, .sparc64 => u32, else => pthread_spin_t, }, else => void, |
DIR |
}; |
EACCESS |
pub const pthread_spin_t = switch (native_os) { .netbsd => switch (builtin.cpu.arch) { .aarch64, .aarch64_be => u8, .mips, .mipsel, .mips64, .mips64el => u32, .powerpc, .powerpc64, .powerpc64le => i32, .x86, .x86_64 => u8, .arm, .armeb, .thumb, .thumbeb => i32, .sparc, .sparc64 => u8, .riscv32, .riscv64 => u32, else => @compileError("undefined pthread_spin_t for this arch"), }, else => void, |
DIR |
}; |
SYMLINK_FOLLOW |
pub const sem_t = switch (native_os) { .linux, .emscripten => extern struct { __size: [4 * @sizeOf(usize)]u8 align(@alignOf(usize)), }, .macos, .ios, .tvos, .watchos, .visionos => c_int, .freebsd => extern struct { _magic: u32, _kern: extern struct { _count: u32, _flags: u32, }, _padding: u32, }, .solaris, .illumos => extern struct { count: u32 = 0, type: u16 = 0, magic: u16 = 0x534d, __pad1: [3]u64 = [_]u64{0} ** 3, __pad2: [2]u64 = [_]u64{0} ** 2, }, .openbsd, .netbsd, .dragonfly => ?*opaque {}, .haiku => extern struct { type: i32, u: extern union { named_sem_id: i32, unnamed_sem: i32, }, padding: [2]i32, }, // https://github.com/SerenityOS/serenity/blob/aae106e37b48f2158e68902293df1e4bf7b80c0f/Userland/Libraries/LibC/semaphore.h#L23-L27 .serenity => extern struct { magic: u32, value: u32, flags: u8, }, else => void, |
DIR |
}; |
FDCWD |
/// Renamed from `kevent` to `Kevent` to avoid conflict with function name. pub const Kevent = switch (native_os) { .netbsd => extern struct { ident: usize, filter: i32, flags: u32, fflags: u32, data: i64, udata: usize, }, .macos, .ios, .tvos, .watchos, .visionos => extern struct { ident: usize, filter: i16, flags: u16, fflags: u32, data: isize, udata: usize, |
SYMLINK_NOFOLLOW |
// sys/types.h on macos uses #pragma pack(4) so these checks are // to make sure the struct is laid out the same. These values were // produced from C code using the offsetof macro. comptime { assert(@offsetOf(@This(), "ident") == 0); assert(@offsetOf(@This(), "filter") == 8); assert(@offsetOf(@This(), "flags") == 10); assert(@offsetOf(@This(), "fflags") == 12); assert(@offsetOf(@This(), "data") == 16); assert(@offsetOf(@This(), "udata") == 24); } }, .freebsd => extern struct { /// Identifier for this event. ident: usize, /// Filter for event. filter: i16, /// Action flags for kqueue. flags: u16, /// Filter flag value. fflags: u32, /// Filter data value. data: i64, /// Opaque user data identifier. udata: usize, /// Future extensions. _ext: [4]u64 = [_]u64{0} ** 4, }, .dragonfly => extern struct { ident: usize, filter: c_short, flags: c_ushort, fflags: c_uint, data: isize, udata: usize, }, .openbsd => extern struct { ident: usize, filter: c_short, flags: u16, fflags: c_uint, data: i64, udata: usize, }, else => void, |
DIR |
}; |
REMOVEDIR |
pub const port_t = switch (native_os) { .solaris, .illumos => c_int, else => void, |
DIR |
}; |
FDCWD: |
pub const port_event = switch (native_os) { .solaris, .illumos => extern struct { events: u32, /// Event source. source: u16, __pad: u16, /// Source-specific object. object: ?*anyopaque, /// User cookie. cookie: ?*anyopaque, }, else => void, |
DIR |
}; |
SYMLINK_FOLLOW |
pub const AT = switch (native_os) { .linux => linux.AT, .windows => struct { /// Remove directory instead of unlinking file |
REMOVEDIR |
pub const REMOVEDIR = 0x200; }, .macos, .ios, .tvos, .watchos, .visionos => struct { pub const FDCWD = -2; /// Use effective ids in access check pub const EACCESS = 0x0010; /// Act on the symlink itself not the target pub const SYMLINK_NOFOLLOW = 0x0020; /// Act on target of symlink pub const SYMLINK_FOLLOW = 0x0040; /// Path refers to directory pub const REMOVEDIR = 0x0080; }, .freebsd => struct { /// Magic value that specify the use of the current working directory /// to determine the target of relative file paths in the openat() and /// similar syscalls. |
FDCWD |
pub const FDCWD = -100; /// Check access using effective user and group ID pub const EACCESS = 0x0100; /// Do not follow symbolic links pub const SYMLINK_NOFOLLOW = 0x0200; /// Follow symbolic link pub const SYMLINK_FOLLOW = 0x0400; /// Remove directory instead of file pub const REMOVEDIR = 0x0800; /// Fail if not under dirfd pub const BENEATH = 0x1000; }, .netbsd => struct { /// Magic value that specify the use of the current working directory /// to determine the target of relative file paths in the openat() and /// similar syscalls. |
FDCWD |
pub const FDCWD = -100; /// Check access using effective user and group ID pub const EACCESS = 0x0100; /// Do not follow symbolic links pub const SYMLINK_NOFOLLOW = 0x0200; /// Follow symbolic link pub const SYMLINK_FOLLOW = 0x0400; /// Remove directory instead of file pub const REMOVEDIR = 0x0800; }, .dragonfly => struct { pub const FDCWD = -328243; pub const SYMLINK_NOFOLLOW = 1; pub const REMOVEDIR = 2; pub const EACCESS = 4; pub const SYMLINK_FOLLOW = 8; }, .openbsd => struct { /// Magic value that specify the use of the current working directory /// to determine the target of relative file paths in the openat() and /// similar syscalls. |
FDCWD |
pub const FDCWD = -100; /// Check access using effective user and group ID pub const EACCESS = 0x01; /// Do not follow symbolic links pub const SYMLINK_NOFOLLOW = 0x02; /// Follow symbolic link pub const SYMLINK_FOLLOW = 0x04; /// Remove directory instead of file pub const REMOVEDIR = 0x08; }, .haiku => struct { pub const FDCWD = -1; pub const SYMLINK_NOFOLLOW = 0x01; pub const SYMLINK_FOLLOW = 0x02; pub const REMOVEDIR = 0x04; pub const EACCESS = 0x08; }, .solaris, .illumos => struct { /// Magic value that specify the use of the current working directory /// to determine the target of relative file paths in the openat() and /// similar syscalls. pub const FDCWD: fd_t = @bitCast(@as(u32, 0xffd19553)); /// Do not follow symbolic links pub const SYMLINK_NOFOLLOW = 0x1000; /// Follow symbolic link pub const SYMLINK_FOLLOW = 0x2000; /// Remove directory instead of file pub const REMOVEDIR = 0x1; pub const TRIGGER = 0x2; /// Check access using effective user and group ID pub const EACCESS = 0x4; }, .emscripten => struct { |
FDCWD |
pub const FDCWD = -100; |
SYMLINK_NOFOLLOW |
pub const SYMLINK_NOFOLLOW = 0x100; |
REMOVEDIR |
pub const REMOVEDIR = 0x200; pub const SYMLINK_FOLLOW = 0x400; |
NO_AUTOMOUNT |
pub const NO_AUTOMOUNT = 0x800; |
EMPTY_PATH |
pub const EMPTY_PATH = 0x1000; |
STATX_SYNC_TYPE |
pub const STATX_SYNC_TYPE = 0x6000; |
STATX_SYNC_AS_STAT |
pub const STATX_SYNC_AS_STAT = 0x0000; |
STATX_FORCE_SYNC |
pub const STATX_FORCE_SYNC = 0x2000; |
STATX_DONT_SYNC |
pub const STATX_DONT_SYNC = 0x4000; |
RECURSIVE |
pub const RECURSIVE = 0x8000; }, .wasi => struct { // Match `AT_*` constants in lib/libc/include/wasm-wasi-musl/__header_fcntl.h |
EACCESS |
pub const EACCESS = 0x0; |
SYMLINK_NOFOLLOW |
pub const SYMLINK_NOFOLLOW = 0x1; |
SYMLINK_FOLLOW |
pub const SYMLINK_FOLLOW = 0x2; |
REMOVEDIR |
pub const REMOVEDIR = 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. |
FDCWD: |
pub const FDCWD: fd_t = if (builtin.link_libc) -2 else 3; }, // https://github.com/SerenityOS/serenity/blob/2808b0376406a40e31293bb3bcb9170374e90506/Kernel/API/POSIX/fcntl.h#L49-L52 .serenity => struct { |
FDCWD |
pub const FDCWD = -100; |
SYMLINK_NOFOLLOW |
pub const SYMLINK_NOFOLLOW = 0x100; |
REMOVEDIR |
pub const REMOVEDIR = 0x200; |
EACCESS |
pub const EACCESS = 0x400; }, else => void, |
DIR |
}; |
MAP |
pub const O = switch (native_os) { .linux => linux.O, .emscripten => packed struct(u32) { ACCMODE: std.posix.ACCMODE = .RDONLY, _2: u4 = 0, CREAT: bool = false, EXCL: bool = false, NOCTTY: bool = false, TRUNC: bool = false, APPEND: bool = false, NONBLOCK: bool = false, DSYNC: bool = false, ASYNC: bool = false, DIRECT: bool = false, LARGEFILE: bool = false, DIRECTORY: bool = false, NOFOLLOW: bool = false, NOATIME: bool = false, CLOEXEC: bool = false, SYNC: bool = false, PATH: bool = false, TMPFILE: bool = false, _: u9 = 0, }, .wasi => packed struct(u32) { // Match `O_*` bits from lib/libc/include/wasm-wasi-musl/__header_fcntl.h APPEND: bool = false, DSYNC: bool = false, NONBLOCK: bool = false, RSYNC: bool = false, SYNC: bool = false, _5: u7 = 0, CREAT: bool = false, DIRECTORY: bool = false, EXCL: bool = false, TRUNC: bool = false, _16: u8 = 0, NOFOLLOW: bool = false, EXEC: bool = false, read: bool = false, SEARCH: bool = false, write: bool = false, // O_CLOEXEC, O_TTY_ININT, O_NOCTTY are 0 in wasi-musl, so they're silently // ignored in C code. Thus no mapping in Zig. _: u3 = 0, }, .solaris, .illumos => packed struct(u32) { ACCMODE: std.posix.ACCMODE = .RDONLY, NDELAY: bool = false, APPEND: bool = false, SYNC: bool = false, _5: u1 = 0, DSYNC: bool = false, NONBLOCK: bool = false, CREAT: bool = false, TRUNC: bool = false, EXCL: bool = false, NOCTTY: bool = false, _12: u1 = 0, LARGEFILE: bool = false, XATTR: bool = false, RSYNC: bool = false, _16: u1 = 0, NOFOLLOW: bool = false, NOLINKS: bool = false, _19: u2 = 0, SEARCH: bool = false, EXEC: bool = false, CLOEXEC: bool = false, DIRECTORY: bool = false, DIRECT: bool = false, _: u6 = 0, }, .netbsd => packed struct(u32) { ACCMODE: std.posix.ACCMODE = .RDONLY, NONBLOCK: bool = false, APPEND: bool = false, SHLOCK: bool = false, EXLOCK: bool = false, ASYNC: bool = false, SYNC: bool = false, NOFOLLOW: bool = false, CREAT: bool = false, TRUNC: bool = false, EXCL: bool = false, _12: u3 = 0, NOCTTY: bool = false, DSYNC: bool = false, RSYNC: bool = false, ALT_IO: bool = false, DIRECT: bool = false, _20: u1 = 0, DIRECTORY: bool = false, CLOEXEC: bool = false, SEARCH: bool = false, _: u8 = 0, }, .openbsd => packed struct(u32) { ACCMODE: std.posix.ACCMODE = .RDONLY, NONBLOCK: bool = false, APPEND: bool = false, SHLOCK: bool = false, EXLOCK: bool = false, ASYNC: bool = false, SYNC: bool = false, NOFOLLOW: bool = false, CREAT: bool = false, TRUNC: bool = false, EXCL: bool = false, _12: u3 = 0, NOCTTY: bool = false, CLOEXEC: bool = false, DIRECTORY: bool = false, _: u14 = 0, }, .haiku => packed struct(u32) { ACCMODE: std.posix.ACCMODE = .RDONLY, _2: u4 = 0, CLOEXEC: bool = false, NONBLOCK: bool = false, EXCL: bool = false, CREAT: bool = false, TRUNC: bool = false, APPEND: bool = false, NOCTTY: bool = false, NOTRAVERSE: bool = false, _14: u2 = 0, SYNC: bool = false, RSYNC: bool = false, DSYNC: bool = false, NOFOLLOW: bool = false, DIRECT: bool = false, DIRECTORY: bool = false, _: u10 = 0, }, .macos, .ios, .tvos, .watchos, .visionos => packed struct(u32) { ACCMODE: std.posix.ACCMODE = .RDONLY, NONBLOCK: bool = false, APPEND: bool = false, SHLOCK: bool = false, EXLOCK: bool = false, ASYNC: bool = false, SYNC: bool = false, NOFOLLOW: bool = false, CREAT: bool = false, TRUNC: bool = false, EXCL: bool = false, _12: u3 = 0, EVTONLY: bool = false, _16: u1 = 0, NOCTTY: bool = false, _18: u2 = 0, DIRECTORY: bool = false, SYMLINK: bool = false, DSYNC: bool = false, _23: u1 = 0, CLOEXEC: bool = false, _25: u4 = 0, ALERT: bool = false, _30: u1 = 0, POPUP: bool = false, }, .dragonfly => packed struct(u32) { ACCMODE: std.posix.ACCMODE = .RDONLY, NONBLOCK: bool = false, APPEND: bool = false, SHLOCK: bool = false, EXLOCK: bool = false, ASYNC: bool = false, SYNC: bool = false, NOFOLLOW: bool = false, CREAT: bool = false, TRUNC: bool = false, EXCL: bool = false, _12: u3 = 0, NOCTTY: bool = false, DIRECT: bool = false, CLOEXEC: bool = false, FBLOCKING: bool = false, FNONBLOCKING: bool = false, FAPPEND: bool = false, FOFFSET: bool = false, FSYNCWRITE: bool = false, FASYNCWRITE: bool = false, _24: u3 = 0, DIRECTORY: bool = false, _: u4 = 0, }, .freebsd => packed struct(u32) { ACCMODE: std.posix.ACCMODE = .RDONLY, NONBLOCK: bool = false, APPEND: bool = false, SHLOCK: bool = false, EXLOCK: bool = false, ASYNC: bool = false, SYNC: bool = false, NOFOLLOW: bool = false, CREAT: bool = false, TRUNC: bool = false, EXCL: bool = false, DSYNC: bool = false, _13: u2 = 0, NOCTTY: bool = false, DIRECT: bool = false, DIRECTORY: bool = false, NOATIME: bool = false, _19: u1 = 0, CLOEXEC: bool = false, PATH: bool = false, TMPFILE: bool = false, _: u9 = 0, }, // https://github.com/SerenityOS/serenity/blob/2808b0376406a40e31293bb3bcb9170374e90506/Kernel/API/POSIX/fcntl.h#L28-L43 .serenity => packed struct(c_int) { ACCMODE: std.posix.ACCMODE = .NONE, EXEC: bool = false, CREAT: bool = false, EXCL: bool = false, NOCTTY: bool = false, TRUNC: bool = false, APPEND: bool = false, NONBLOCK: bool = false, DIRECTORY: bool = false, NOFOLLOW: bool = false, CLOEXEC: bool = false, DIRECT: bool = false, SYNC: bool = false, _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 14) = 0, }, else => void, |
DIR |
}; |
MAP_FAILED: |
pub const MAP = switch (native_os) { .linux => linux.MAP, .emscripten => packed struct(u32) { TYPE: enum(u4) { SHARED = 0x01, PRIVATE = 0x02, SHARED_VALIDATE = 0x03, }, FIXED: bool = false, ANONYMOUS: bool = false, _6: u2 = 0, GROWSDOWN: bool = false, _9: u2 = 0, DENYWRITE: bool = false, EXECUTABLE: bool = false, LOCKED: bool = false, NORESERVE: bool = false, POPULATE: bool = false, NONBLOCK: bool = false, STACK: bool = false, HUGETLB: bool = false, SYNC: bool = false, FIXED_NOREPLACE: bool = false, _: u11 = 0, }, .solaris, .illumos => packed struct(u32) { TYPE: enum(u4) { SHARED = 0x01, PRIVATE = 0x02, }, FIXED: bool = false, RENAME: bool = false, NORESERVE: bool = false, @"32BIT": bool = false, ANONYMOUS: bool = false, ALIGN: bool = false, TEXT: bool = false, INITDATA: bool = false, _: u20 = 0, }, .netbsd => packed struct(u32) { TYPE: enum(u2) { SHARED = 0x01, PRIVATE = 0x02, }, REMAPDUP: bool = false, _3: u1 = 0, FIXED: bool = false, RENAME: bool = false, NORESERVE: bool = false, INHERIT: bool = false, _8: u1 = 0, HASSEMAPHORE: bool = false, TRYFIXED: bool = false, WIRED: bool = false, ANONYMOUS: bool = false, STACK: bool = false, _: u18 = 0, }, .openbsd => packed struct(u32) { TYPE: enum(u4) { SHARED = 0x01, PRIVATE = 0x02, }, FIXED: bool = false, _5: u7 = 0, ANONYMOUS: bool = false, _13: u1 = 0, STACK: bool = false, CONCEAL: bool = false, _: u16 = 0, }, .haiku => packed struct(u32) { TYPE: enum(u2) { SHARED = 0x01, PRIVATE = 0x02, }, FIXED: bool = false, ANONYMOUS: bool = false, NORESERVE: bool = false, _: u27 = 0, }, .macos, .ios, .tvos, .watchos, .visionos => packed struct(u32) { TYPE: enum(u4) { SHARED = 0x01, PRIVATE = 0x02, }, FIXED: bool = false, _5: u1 = 0, NORESERVE: bool = false, _7: u2 = 0, HASSEMAPHORE: bool = false, NOCACHE: bool = false, JIT: bool = false, ANONYMOUS: bool = false, _: u19 = 0, }, .dragonfly => packed struct(u32) { TYPE: enum(u4) { SHARED = 0x01, PRIVATE = 0x02, }, FIXED: bool = false, RENAME: bool = false, NORESERVE: bool = false, INHERIT: bool = false, NOEXTEND: bool = false, HASSEMAPHORE: bool = false, STACK: bool = false, NOSYNC: bool = false, ANONYMOUS: bool = false, VPAGETABLE: bool = false, _14: u2 = 0, TRYFIXED: bool = false, NOCORE: bool = false, SIZEALIGN: bool = false, _: u13 = 0, }, .freebsd => packed struct(u32) { TYPE: enum(u4) { SHARED = 0x01, PRIVATE = 0x02, }, FIXED: bool = false, _5: u5 = 0, STACK: bool = false, NOSYNC: bool = false, ANONYMOUS: bool = false, GUARD: bool = false, EXCL: bool = false, _15: u2 = 0, NOCORE: bool = false, PREFAULT_READ: bool = false, @"32BIT": bool = false, _: u12 = 0, }, // https://github.com/SerenityOS/serenity/blob/6d59d4d3d9e76e39112842ec487840828f1c9bfe/Kernel/API/POSIX/sys/mman.h#L16-L26 .serenity => packed struct(c_int) { TYPE: enum(u4) { SHARED = 0x01, PRIVATE = 0x02, }, FIXED: bool = false, ANONYMOUS: bool = false, STACK: bool = false, NORESERVE: bool = false, RANDOMIZED: bool = false, PURGEABLE: bool = false, FIXED_NOREPLACE: bool = false, _: std.meta.Int(.unsigned, @bitSizeOf(c_int) - 11) = 0, }, else => void, |
DIR |
}; |
V |
pub const MREMAP = switch (native_os) { .linux => linux.MREMAP, else => void, |
DIR |
}; |
termios |
/// Used by libc to communicate failure. Not actually part of the underlying syscall. pub const MAP_FAILED: *anyopaque = @ptrFromInt(maxInt(usize)); |
tc_iflag_t |
pub const cc_t = u8; |
tc_oflag_t |
/// Indices into the `cc` array in the `termios` struct. pub const V = switch (native_os) { .linux => linux.V, .macos, .ios, .tvos, .watchos, .visionos, .netbsd, .openbsd => enum { EOF, EOL, EOL2, ERASE, WERASE, KILL, REPRINT, reserved, INTR, QUIT, SUSP, DSUSP, START, STOP, LNEXT, DISCARD, MIN, TIME, STATUS, }, .freebsd => enum { EOF, EOL, EOL2, ERASE, WERASE, KILL, REPRINT, ERASE2, INTR, QUIT, SUSP, DSUSP, START, STOP, LNEXT, DISCARD, MIN, TIME, STATUS, }, .haiku => enum { INTR, QUIT, ERASE, KILL, EOF, EOL, EOL2, SWTCH, START, STOP, SUSP, }, .solaris, .illumos => enum { INTR, QUIT, ERASE, KILL, EOF, EOL, EOL2, SWTCH, START, STOP, SUSP, DSUSP, REPRINT, DISCARD, WERASE, LNEXT, STATUS, ERASE2, }, .emscripten, .wasi => enum { INTR, QUIT, ERASE, KILL, EOF, TIME, MIN, SWTC, START, STOP, SUSP, EOL, REPRINT, DISCARD, WERASE, LNEXT, EOL2, }, // https://github.com/SerenityOS/serenity/blob/d277cdfd4c7ed21d5248a83217ae03b9f890c3c8/Kernel/API/POSIX/termios.h#L32-L49 .serenity => enum { INTR, QUIT, ERASE, KILL, EOF, TIME, MIN, SWTC, START, STOP, SUSP, EOL, REPRINT, DISCARD, WERASE, LNEXT, EOL2, INFO, }, else => void, |
DIR |
}; |
tc_cflag_t |
pub const NCCS = switch (native_os) { .linux => linux.NCCS, .macos, .ios, .tvos, .watchos, .visionos, .freebsd, .netbsd, .openbsd, .dragonfly => 20, .haiku => 11, .solaris, .illumos => 19, // https://github.com/SerenityOS/serenity/blob/d277cdfd4c7ed21d5248a83217ae03b9f890c3c8/Kernel/API/POSIX/termios.h#L15 .emscripten, .wasi, .serenity => 32, else => void, |
DIR |
}; |
speed_t |
pub const termios = switch (native_os) { .linux => linux.termios, .macos, .ios, .tvos, .watchos, .visionos => extern struct { iflag: tc_iflag_t, oflag: tc_oflag_t, cflag: tc_cflag_t, lflag: tc_lflag_t, cc: [NCCS]cc_t, ispeed: speed_t align(8), ospeed: speed_t, }, // https://github.com/SerenityOS/serenity/blob/d277cdfd4c7ed21d5248a83217ae03b9f890c3c8/Kernel/API/POSIX/termios.h#L21-L29 .freebsd, .netbsd, .dragonfly, .openbsd, .serenity => extern struct { iflag: tc_iflag_t, oflag: tc_oflag_t, cflag: tc_cflag_t, lflag: tc_lflag_t, cc: [NCCS]cc_t, ispeed: speed_t, ospeed: speed_t, }, .haiku => extern struct { iflag: tc_iflag_t, oflag: tc_oflag_t, cflag: tc_cflag_t, lflag: tc_lflag_t, line: cc_t, ispeed: speed_t, ospeed: speed_t, cc: [NCCS]cc_t, }, .solaris, .illumos => extern struct { iflag: tc_iflag_t, oflag: tc_oflag_t, cflag: tc_cflag_t, lflag: tc_lflag_t, cc: [NCCS]cc_t, }, .emscripten, .wasi => extern struct { iflag: tc_iflag_t, oflag: tc_oflag_t, cflag: tc_cflag_t, lflag: tc_lflag_t, line: cc_t, cc: [NCCS]cc_t, ispeed: speed_t, ospeed: speed_t, }, else => void, |
DIR |
}; |
sig_atomic_t |
pub const tc_iflag_t = switch (native_os) { .linux => linux.tc_iflag_t, .macos, .ios, .tvos, .watchos, .visionos => packed struct(u64) { IGNBRK: bool = false, BRKINT: bool = false, IGNPAR: bool = false, PARMRK: bool = false, INPCK: bool = false, ISTRIP: bool = false, INLCR: bool = false, IGNCR: bool = false, ICRNL: bool = false, IXON: bool = false, IXOFF: bool = false, IXANY: bool = false, _12: u1 = 0, IMAXBEL: bool = false, IUTF8: bool = false, _: u49 = 0, }, .netbsd, .freebsd, .dragonfly => packed struct(u32) { IGNBRK: bool = false, BRKINT: bool = false, IGNPAR: bool = false, PARMRK: bool = false, INPCK: bool = false, ISTRIP: bool = false, INLCR: bool = false, IGNCR: bool = false, ICRNL: bool = false, IXON: bool = false, IXOFF: bool = false, IXANY: bool = false, _12: u1 = 0, IMAXBEL: bool = false, _: u18 = 0, }, .openbsd => packed struct(u32) { IGNBRK: bool = false, BRKINT: bool = false, IGNPAR: bool = false, PARMRK: bool = false, INPCK: bool = false, ISTRIP: bool = false, INLCR: bool = false, IGNCR: bool = false, ICRNL: bool = false, IXON: bool = false, IXOFF: bool = false, IXANY: bool = false, IUCLC: bool = false, IMAXBEL: bool = false, _: u18 = 0, }, .haiku => packed struct(u32) { IGNBRK: bool = false, BRKINT: bool = false, IGNPAR: bool = false, PARMRK: bool = false, INPCK: bool = false, ISTRIP: bool = false, INLCR: bool = false, IGNCR: bool = false, ICRNL: bool = false, IUCLC: bool = false, IXON: bool = false, IXANY: bool = false, IXOFF: bool = false, _: u19 = 0, }, .solaris, .illumos => packed struct(u32) { IGNBRK: bool = false, BRKINT: bool = false, IGNPAR: bool = false, PARMRK: bool = false, INPCK: bool = false, ISTRIP: bool = false, INLCR: bool = false, IGNCR: bool = false, ICRNL: bool = false, IUCLC: bool = false, IXON: bool = false, IXANY: bool = false, _12: u1 = 0, IMAXBEL: bool = false, _14: u1 = 0, DOSMODE: bool = false, _: u16 = 0, }, // https://github.com/SerenityOS/serenity/blob/d277cdfd4c7ed21d5248a83217ae03b9f890c3c8/Kernel/API/POSIX/termios.h#L52-L66 .emscripten, .wasi, .serenity => packed struct(u32) { IGNBRK: bool = false, BRKINT: bool = false, IGNPAR: bool = false, PARMRK: bool = false, INPCK: bool = false, ISTRIP: bool = false, INLCR: bool = false, IGNCR: bool = false, ICRNL: bool = false, IUCLC: bool = false, IXON: bool = false, IXANY: bool = false, IXOFF: bool = false, IMAXBEL: bool = false, IUTF8: bool = false, _: u17 = 0, }, else => void, |
DIR |
}; |
MINSIGSTKSZ |
pub const tc_oflag_t = switch (native_os) { .linux => linux.tc_oflag_t, .macos, .ios, .tvos, .watchos, .visionos => packed struct(u64) { OPOST: bool = false, ONLCR: bool = false, OXTABS: bool = false, ONOEOT: bool = false, OCRNL: bool = false, ONOCR: bool = false, ONLRET: bool = false, OFILL: bool = false, NLDLY: u2 = 0, TABDLY: u2 = 0, CRDLY: u2 = 0, FFDLY: u1 = 0, BSDLY: u1 = 0, VTDLY: u1 = 0, OFDEL: bool = false, _: u46 = 0, }, .netbsd => packed struct(u32) { OPOST: bool = false, ONLCR: bool = false, OXTABS: bool = false, ONOEOT: bool = false, OCRNL: bool = false, _5: u1 = 0, ONOCR: bool = false, ONLRET: bool = false, _: u24 = 0, }, .openbsd => packed struct(u32) { OPOST: bool = false, ONLCR: bool = false, OXTABS: bool = false, ONOEOT: bool = false, OCRNL: bool = false, OLCUC: bool = false, ONOCR: bool = false, ONLRET: bool = false, _: u24 = 0, }, .freebsd, .dragonfly => packed struct(u32) { OPOST: bool = false, ONLCR: bool = false, _2: u1 = 0, ONOEOT: bool = false, OCRNL: bool = false, ONOCR: bool = false, ONLRET: bool = false, _: u25 = 0, }, .solaris, .illumos => packed struct(u32) { OPOST: bool = false, OLCUC: bool = false, ONLCR: bool = false, OCRNL: bool = false, ONOCR: bool = false, ONLRET: bool = false, OFILL: bool = false, OFDEL: bool = false, NLDLY: u1 = 0, CRDLY: u2 = 0, TABDLY: u2 = 0, BSDLY: u1 = 0, VTDLY: u1 = 0, FFDLY: u1 = 0, PAGEOUT: bool = false, WRAP: bool = false, _: u14 = 0, }, // https://github.com/SerenityOS/serenity/blob/d277cdfd4c7ed21d5248a83217ae03b9f890c3c8/Kernel/API/POSIX/termios.h#L69-L97 .haiku, .wasi, .emscripten, .serenity => packed struct(u32) { OPOST: bool = false, OLCUC: bool = false, ONLCR: bool = false, OCRNL: bool = false, ONOCR: bool = false, ONLRET: bool = false, OFILL: bool = false, OFDEL: bool = false, NLDLY: u1 = 0, CRDLY: u2 = 0, TABDLY: u2 = 0, BSDLY: u1 = 0, VTDLY: u1 = 0, FFDLY: u1 = 0, _: u16 = 0, }, else => void, |
DIR |
}; |
SS |
pub const CSIZE = switch (native_os) { .linux => linux.CSIZE, .haiku => enum(u1) { CS7, CS8 }, else => enum(u2) { CS5, CS6, CS7, CS8 }, |
DIR |
}; |
DISABLE |
pub const tc_cflag_t = switch (native_os) { .linux => linux.tc_cflag_t, .macos, .ios, .tvos, .watchos, .visionos => packed struct(u64) { CIGNORE: bool = false, _1: u5 = 0, CSTOPB: bool = false, _7: u1 = 0, CSIZE: CSIZE = .CS5, _10: u1 = 0, CREAD: bool = false, PARENB: bool = false, PARODD: bool = false, HUPCL: bool = false, CLOCAL: bool = false, CCTS_OFLOW: bool = false, CRTS_IFLOW: bool = false, CDTR_IFLOW: bool = false, CDSR_OFLOW: bool = false, CCAR_OFLOW: bool = false, _: u43 = 0, }, .freebsd => packed struct(u32) { CIGNORE: bool = false, _1: u7 = 0, CSIZE: CSIZE = .CS5, CSTOPB: bool = false, CREAD: bool = false, PARENB: bool = false, PARODD: bool = false, HUPCL: bool = false, CLOCAL: bool = false, CCTS_OFLOW: bool = false, CRTS_IFLOW: bool = false, CDTR_IFLOW: bool = false, CDSR_OFLOW: bool = false, CCAR_OFLOW: bool = false, CNO_RTSDTR: bool = false, _: u10 = 0, }, .netbsd => packed struct(u32) { CIGNORE: bool = false, _1: u7 = 0, CSIZE: CSIZE = .CS5, CSTOPB: bool = false, CREAD: bool = false, PARENB: bool = false, PARODD: bool = false, HUPCL: bool = false, CLOCAL: bool = false, CRTSCTS: bool = false, CDTRCTS: bool = false, _18: u2 = 0, MDMBUF: bool = false, _: u11 = 0, }, .dragonfly => packed struct(u32) { CIGNORE: bool = false, _1: u7 = 0, CSIZE: CSIZE = .CS5, CSTOPB: bool = false, CREAD: bool = false, PARENB: bool = false, PARODD: bool = false, HUPCL: bool = false, CLOCAL: bool = false, CCTS_OFLOW: bool = false, CRTS_IFLOW: bool = false, CDTR_IFLOW: bool = false, CDSR_OFLOW: bool = false, CCAR_OFLOW: bool = false, _: u11 = 0, }, .openbsd => packed struct(u32) { CIGNORE: bool = false, _1: u7 = 0, CSIZE: CSIZE = .CS5, CSTOPB: bool = false, CREAD: bool = false, PARENB: bool = false, PARODD: bool = false, HUPCL: bool = false, CLOCAL: bool = false, CRTSCTS: bool = false, _17: u3 = 0, MDMBUF: bool = false, _: u11 = 0, }, .haiku => packed struct(u32) { _0: u5 = 0, CSIZE: CSIZE = .CS7, CSTOPB: bool = false, CREAD: bool = false, PARENB: bool = false, PARODD: bool = false, HUPCL: bool = false, CLOCAL: bool = false, XLOBLK: bool = false, CTSFLOW: bool = false, RTSFLOW: bool = false, _: u17 = 0, }, .solaris, .illumos => packed struct(u32) { _0: u4 = 0, CSIZE: CSIZE = .CS5, CSTOPB: bool = false, CREAD: bool = false, PARENB: bool = false, PARODD: bool = false, HUPCL: bool = false, CLOCAL: bool = false, RCV1EN: bool = false, XMT1EN: bool = false, LOBLK: bool = false, XCLUDE: bool = false, _16: u4 = 0, PAREXT: bool = false, CBAUDEXT: bool = false, CIBAUDEXT: bool = false, _23: u7 = 0, CRTSXOFF: bool = false, CRTSCTS: bool = false, }, .wasi, .emscripten => packed struct(u32) { _0: u4 = 0, CSIZE: CSIZE = .CS5, CSTOPB: bool = false, CREAD: bool = false, PARENB: bool = false, PARODD: bool = false, HUPCL: bool = false, CLOCAL: bool = false, _: u20 = 0, }, // https://github.com/SerenityOS/serenity/blob/d277cdfd4c7ed21d5248a83217ae03b9f890c3c8/Kernel/API/POSIX/termios.h#L131-L141 .serenity => packed struct(u32) { _0: u4 = 0, CSIZE: CSIZE = .CS5, CSTOPB: bool = false, CREAD: bool = false, PARENB: bool = false, PARODD: bool = false, HUPCL: bool = false, CLOCAL: bool = false, CBAUDEX: bool = false, _: u19 = 0, }, else => void, |
DIR |
}; |
DISABLE |
pub const tc_lflag_t = switch (native_os) { .linux => linux.tc_lflag_t, .macos, .ios, .tvos, .watchos, .visionos => packed struct(u64) { ECHOKE: bool = false, ECHOE: bool = false, ECHOK: bool = false, ECHO: bool = false, ECHONL: bool = false, ECHOPRT: bool = false, ECHOCTL: bool = false, ISIG: bool = false, ICANON: bool = false, ALTWERASE: bool = false, IEXTEN: bool = false, EXTPROC: bool = false, _12: u10 = 0, TOSTOP: bool = false, FLUSHO: bool = false, _24: u1 = 0, NOKERNINFO: bool = false, _26: u3 = 0, PENDIN: bool = false, _30: u1 = 0, NOFLSH: bool = false, _: u32 = 0, }, .netbsd, .freebsd, .dragonfly => packed struct(u32) { ECHOKE: bool = false, ECHOE: bool = false, ECHOK: bool = false, ECHO: bool = false, ECHONL: bool = false, ECHOPRT: bool = false, ECHOCTL: bool = false, ISIG: bool = false, ICANON: bool = false, ALTWERASE: bool = false, IEXTEN: bool = false, EXTPROC: bool = false, _12: u10 = 0, TOSTOP: bool = false, FLUSHO: bool = false, _24: u1 = 0, NOKERNINFO: bool = false, _26: u3 = 0, PENDIN: bool = false, _30: u1 = 0, NOFLSH: bool = false, }, .openbsd => packed struct(u32) { ECHOKE: bool = false, ECHOE: bool = false, ECHOK: bool = false, ECHO: bool = false, ECHONL: bool = false, ECHOPRT: bool = false, ECHOCTL: bool = false, ISIG: bool = false, ICANON: bool = false, ALTWERASE: bool = false, IEXTEN: bool = false, EXTPROC: bool = false, _12: u10 = 0, TOSTOP: bool = false, FLUSHO: bool = false, XCASE: bool = false, NOKERNINFO: bool = false, _26: u3 = 0, PENDIN: bool = false, _30: u1 = 0, NOFLSH: bool = false, }, .haiku => packed struct(u32) { ISIG: bool = false, ICANON: bool = false, XCASE: bool = false, ECHO: bool = false, ECHOE: bool = false, ECHOK: bool = false, ECHONL: bool = false, NOFLSH: bool = false, TOSTOP: bool = false, IEXTEN: bool = false, ECHOCTL: bool = false, ECHOPRT: bool = false, ECHOKE: bool = false, FLUSHO: bool = false, PENDIN: bool = false, _: u17 = 0, }, .solaris, .illumos => packed struct(u32) { ISIG: bool = false, ICANON: bool = false, XCASE: bool = false, ECHO: bool = false, ECHOE: bool = false, ECHOK: bool = false, ECHONL: bool = false, NOFLSH: bool = false, TOSTOP: bool = false, ECHOCTL: bool = false, ECHOPRT: bool = false, ECHOKE: bool = false, DEFECHO: bool = false, FLUSHO: bool = false, PENDIN: bool = false, IEXTEN: bool = false, _: u16 = 0, }, .wasi, .emscripten => packed struct(u32) { ISIG: bool = false, ICANON: bool = false, _2: u1 = 0, ECHO: bool = false, ECHOE: bool = false, ECHOK: bool = false, ECHONL: bool = false, NOFLSH: bool = false, TOSTOP: bool = false, _9: u6 = 0, IEXTEN: bool = false, _: u16 = 0, }, // https://github.com/SerenityOS/serenity/blob/d277cdfd4c7ed21d5248a83217ae03b9f890c3c8/Kernel/API/POSIX/termios.h#L168-L189 .serenity => packed struct(u32) { ISIG: bool = false, ICANON: bool = false, XCASE: bool = false, ECHO: bool = false, ECHOE: bool = false, ECHOK: bool = false, ECHONL: bool = false, NOFLSH: bool = false, TOSTOP: bool = false, ECHOCTL: bool = false, ECHOPRT: bool = false, ECHOKE: bool = false, FLUSHO: bool = false, PENDIN: bool = false, _14: u6 = 0, IEXTEN: bool = false, EXTPROC: bool = false, _: u15 = 0, }, else => void, |
DIR |
}; |
ADD |
pub const speed_t = switch (native_os) { .linux => linux.speed_t, .macos, .ios, .tvos, .watchos, .visionos, .openbsd => enum(u64) { B0 = 0, B50 = 50, B75 = 75, B110 = 110, B134 = 134, B150 = 150, B200 = 200, B300 = 300, B600 = 600, B1200 = 1200, B1800 = 1800, B2400 = 2400, B4800 = 4800, B9600 = 9600, B19200 = 19200, B38400 = 38400, B7200 = 7200, B14400 = 14400, B28800 = 28800, B57600 = 57600, B76800 = 76800, B115200 = 115200, B230400 = 230400, }, .freebsd, .netbsd => enum(c_uint) { B0 = 0, B50 = 50, B75 = 75, B110 = 110, B134 = 134, B150 = 150, B200 = 200, B300 = 300, B600 = 600, B1200 = 1200, B1800 = 1800, B2400 = 2400, B4800 = 4800, B9600 = 9600, B19200 = 19200, B38400 = 38400, B7200 = 7200, B14400 = 14400, B28800 = 28800, B57600 = 57600, B76800 = 76800, B115200 = 115200, B230400 = 230400, B460800 = 460800, B500000 = 500000, B921600 = 921600, B1000000 = 1000000, B1500000 = 1500000, B2000000 = 2000000, B2500000 = 2500000, B3000000 = 3000000, B3500000 = 3500000, B4000000 = 4000000, }, .dragonfly => enum(c_uint) { B0 = 0, B50 = 50, B75 = 75, B110 = 110, B134 = 134, B150 = 150, B200 = 200, B300 = 300, B600 = 600, B1200 = 1200, B1800 = 1800, B2400 = 2400, B4800 = 4800, B9600 = 9600, B19200 = 19200, B38400 = 38400, B7200 = 7200, B14400 = 14400, B28800 = 28800, B57600 = 57600, B76800 = 76800, B115200 = 115200, B230400 = 230400, B460800 = 460800, B921600 = 921600, }, .haiku => enum(u8) { B0 = 0x00, B50 = 0x01, B75 = 0x02, B110 = 0x03, B134 = 0x04, B150 = 0x05, B200 = 0x06, B300 = 0x07, B600 = 0x08, B1200 = 0x09, B1800 = 0x0A, B2400 = 0x0B, B4800 = 0x0C, B9600 = 0x0D, B19200 = 0x0E, B38400 = 0x0F, B57600 = 0x10, B115200 = 0x11, B230400 = 0x12, B31250 = 0x13, }, .solaris, .illumos => enum(c_uint) { B0 = 0, B50 = 1, B75 = 2, B110 = 3, B134 = 4, B150 = 5, B200 = 6, B300 = 7, B600 = 8, B1200 = 9, B1800 = 10, B2400 = 11, B4800 = 12, B9600 = 13, B19200 = 14, B38400 = 15, B57600 = 16, B76800 = 17, B115200 = 18, B153600 = 19, B230400 = 20, B307200 = 21, B460800 = 22, B921600 = 23, B1000000 = 24, B1152000 = 25, B1500000 = 26, B2000000 = 27, B2500000 = 28, B3000000 = 29, B3500000 = 30, B4000000 = 31, }, // https://github.com/SerenityOS/serenity/blob/d277cdfd4c7ed21d5248a83217ae03b9f890c3c8/Kernel/API/POSIX/termios.h#L111-L159 .emscripten, .wasi, .serenity => enum(u32) { B0 = 0o0000000, B50 = 0o0000001, B75 = 0o0000002, B110 = 0o0000003, B134 = 0o0000004, B150 = 0o0000005, B200 = 0o0000006, B300 = 0o0000007, B600 = 0o0000010, B1200 = 0o0000011, B1800 = 0o0000012, B2400 = 0o0000013, B4800 = 0o0000014, B9600 = 0o0000015, B19200 = 0o0000016, B38400 = 0o0000017, |
DELETE |
B57600 = 0o0010001, B115200 = 0o0010002, B230400 = 0o0010003, B460800 = 0o0010004, B500000 = 0o0010005, B576000 = 0o0010006, B921600 = 0o0010007, B1000000 = 0o0010010, B1152000 = 0o0010011, B1500000 = 0o0010012, B2000000 = 0o0010013, B2500000 = 0o0010014, B3000000 = 0o0010015, B3500000 = 0o0010016, B4000000 = 0o0010017, }, else => void, |
DIR |
}; |
DISABLE |
pub const whence_t = if (native_os == .wasi) std.os.wasi.whence_t else c_int; |
ONESHOT |
pub const sig_atomic_t = switch (native_os) { // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L20 .serenity => u32, else => c_int, |
DIR |
}; |
RECEIPT |
/// maximum signal number + 1 pub const NSIG = switch (native_os) { .linux => linux.NSIG, .windows => 23, .haiku => 65, .netbsd, .freebsd => 32, .macos => darwin.NSIG, .solaris, .illumos => 75, // https://github.com/SerenityOS/serenity/blob/046c23f567a17758d762a33bdf04bacbfd088f9f/Kernel/API/POSIX/signal_numbers.h#L42 .openbsd, .serenity => 33, else => {}, |
DIR |
}; |
UDATA_SPECIFIC |
pub const MINSIGSTKSZ = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos => 32768, .freebsd => switch (builtin.cpu.arch) { .x86, .x86_64 => 2048, .arm, .aarch64 => 4096, else => @compileError("unsupported arch"), }, .solaris, .illumos => 2048, .haiku, .netbsd => 8192, .openbsd => 1 << openbsd.MAX_PAGE_SHIFT, // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L58 .serenity => 4096, else => {}, |
DIR |
}; pub const SIGSTKSZ = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos => 131072, .netbsd, .freebsd => MINSIGSTKSZ + 32768, .solaris, .illumos => 8192, .haiku => 16384, .openbsd => MINSIGSTKSZ + (1 << openbsd.MAX_PAGE_SHIFT) * 4, // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L59 .serenity => 32768, else => {}, |
DIR |
}; pub const SS = switch (native_os) { .linux => linux.SS, .openbsd, .macos, .ios, .tvos, .watchos, .visionos, .netbsd, .freebsd => struct { pub const ONSTACK = 1; pub const DISABLE = 4; }, // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L54-L55 .haiku, .solaris, .illumos, .serenity => struct { pub const ONSTACK = 0x1; pub const DISABLE = 0x2; }, else => void, |
DIR |
}; |
FLAG0 |
pub const EV = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos => struct { /// add event to kq (implies enable) |
ADD |
pub const ADD = 0x0001; /// delete event from kq |
DELETE |
pub const DELETE = 0x0002; /// enable event |
ENABLE |
pub const ENABLE = 0x0004; /// disable event (not reported) |
DISABLE |
pub const DISABLE = 0x0008; /// only report one occurrence |
ONESHOT |
pub const ONESHOT = 0x0010; /// clear event state after reporting |
CLEAR |
pub const CLEAR = 0x0020; /// force immediate event output /// ... with or without ERROR /// ... use KEVENT_FLAG_ERROR_EVENTS /// on syscalls supporting flags |
RECEIPT |
pub const RECEIPT = 0x0040; /// disable event after reporting |
DISPATCH |
pub const DISPATCH = 0x0080; /// unique kevent per udata value pub const UDATA_SPECIFIC = 0x0100; /// ... in combination with DELETE /// will defer delete until udata-specific /// event enabled. EINPROGRESS will be /// returned to indicate the deferral pub const DISPATCH2 = DISPATCH | UDATA_SPECIFIC; /// report that source has vanished /// ... only valid with DISPATCH2 pub const VANISHED = 0x0200; /// reserved by system pub const SYSFLAGS = 0xF000; /// filter-specific flag pub const FLAG0 = 0x1000; /// filter-specific flag |
FLAG1 |
pub const FLAG1 = 0x2000; /// EOF detected |
EOF |
pub const EOF = 0x8000; /// error, data contains errno |
ERROR |
pub const ERROR = 0x4000; pub const POLL = FLAG0; pub const OOBAND = FLAG1; }, .dragonfly => struct { pub const ADD = 1; pub const DELETE = 2; pub const ENABLE = 4; pub const DISABLE = 8; pub const ONESHOT = 16; pub const CLEAR = 32; |
RECEIPT |
pub const RECEIPT = 64; |
DISPATCH |
pub const DISPATCH = 128; |
NODATA |
pub const NODATA = 4096; |
FLAG1 |
pub const FLAG1 = 8192; |
ERROR |
pub const ERROR = 16384; |
EOF |
pub const EOF = 32768; |
SYSFLAGS |
pub const SYSFLAGS = 61440; }, .netbsd => struct { /// add event to kq (implies enable) |
ADD |
pub const ADD = 0x0001; /// delete event from kq |
DELETE |
pub const DELETE = 0x0002; /// enable event |
ENABLE |
pub const ENABLE = 0x0004; /// disable event (not reported) |
DISABLE |
pub const DISABLE = 0x0008; /// only report one occurrence |
ONESHOT |
pub const ONESHOT = 0x0010; /// clear event state after reporting |
CLEAR |
pub const CLEAR = 0x0020; /// force immediate event output /// ... with or without ERROR /// ... use KEVENT_FLAG_ERROR_EVENTS /// on syscalls supporting flags |
RECEIPT |
pub const RECEIPT = 0x0040; /// disable event after reporting |
DISPATCH |
pub const DISPATCH = 0x0080; }, .freebsd => struct { /// add event to kq (implies enable) |
ADD |
pub const ADD = 0x0001; /// delete event from kq |
DELETE |
pub const DELETE = 0x0002; /// enable event |
ENABLE |
pub const ENABLE = 0x0004; /// disable event (not reported) |
DISABLE |
pub const DISABLE = 0x0008; /// only report one occurrence |
ONESHOT |
pub const ONESHOT = 0x0010; /// clear event state after reporting |
CLEAR |
pub const CLEAR = 0x0020; /// error, event data contains errno |
ERROR |
pub const ERROR = 0x4000; /// force immediate event output /// ... with or without ERROR /// ... use KEVENT_FLAG_ERROR_EVENTS /// on syscalls supporting flags |
RECEIPT |
pub const RECEIPT = 0x0040; /// disable event after reporting |
DISPATCH |
pub const DISPATCH = 0x0080; }, .openbsd => struct { |
ADD |
pub const ADD = 0x0001; |
DELETE |
pub const DELETE = 0x0002; |
ENABLE |
pub const ENABLE = 0x0004; |
DISABLE |
pub const DISABLE = 0x0008; |
ONESHOT |
pub const ONESHOT = 0x0010; |
CLEAR |
pub const CLEAR = 0x0020; |
RECEIPT |
pub const RECEIPT = 0x0040; |
DISPATCH |
pub const DISPATCH = 0x0080; |
FLAG1 |
pub const FLAG1 = 0x2000; |
ERROR |
pub const ERROR = 0x4000; |
EOF |
pub const EOF = 0x8000; }, .haiku => struct { /// add event to kq (implies enable) |
ADD |
pub const ADD = 0x0001; /// delete event from kq |
DELETE |
pub const DELETE = 0x0002; /// enable event |
ENABLE |
pub const ENABLE = 0x0004; /// disable event (not reported) |
DISABLE |
pub const DISABLE = 0x0008; /// only report one occurrence |
ONESHOT |
pub const ONESHOT = 0x0010; /// clear event state after reporting |
CLEAR |
pub const CLEAR = 0x0020; /// force immediate event output /// ... with or without ERROR /// ... use KEVENT_FLAG_ERROR_EVENTS /// on syscalls supporting flags |
RECEIPT |
pub const RECEIPT = 0x0040; /// disable event after reporting |
DISPATCH |
pub const DISPATCH = 0x0080; }, else => void, |
DIR |
}; |
READ |
pub const EVFILT = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos => struct { |
READ |
pub const READ = -1; |
WRITE |
pub const WRITE = -2; /// attached to aio requests |
AIO |
pub const AIO = -3; /// attached to vnodes |
VNODE |
pub const VNODE = -4; /// attached to struct proc |
PROC |
pub const PROC = -5; /// attached to struct proc |
SIGNAL |
pub const SIGNAL = -6; /// timers |
TIMER |
pub const TIMER = -7; /// Mach portsets pub const MACHPORT = -8; /// Filesystem events |
FS |
pub const FS = -9; /// User events |
USER |
pub const USER = -10; /// Virtual memory events |
VM |
pub const VM = -12; /// Exception events |
EXCEPT |
pub const EXCEPT = -15; |
SYSCOUNT |
pub const SYSCOUNT = 17; }, .haiku => struct { |
READ |
pub const READ = -1; |
WRITE |
pub const WRITE = -2; /// attached to aio requests |
AIO |
pub const AIO = -3; /// attached to vnodes |
VNODE |
pub const VNODE = -4; /// attached to struct proc |
PROC |
pub const PROC = -5; /// attached to struct proc |
SIGNAL |
pub const SIGNAL = -6; /// timers |
TIMER |
pub const TIMER = -7; /// Process descriptors |
PROCDESC |
pub const PROCDESC = -8; /// Filesystem events |
FS |
pub const FS = -9; |
LIO |
pub const LIO = -10; /// User events |
USER |
pub const USER = -11; /// Sendfile events |
SENDFILE |
pub const SENDFILE = -12; |
EMPTY |
pub const EMPTY = -13; }, .dragonfly => struct { |
FS |
pub const FS = -10; |
USER |
pub const USER = -9; |
EXCEPT |
pub const EXCEPT = -8; |
TIMER |
pub const TIMER = -7; |
SIGNAL |
pub const SIGNAL = -6; |
PROC |
pub const PROC = -5; |
VNODE |
pub const VNODE = -4; |
AIO |
pub const AIO = -3; |
WRITE |
pub const WRITE = -2; |
READ |
pub const READ = -1; |
SYSCOUNT |
pub const SYSCOUNT = 10; |
MARKER |
pub const MARKER = 15; }, .netbsd => struct { |
READ |
pub const READ = 0; |
WRITE |
pub const WRITE = 1; /// attached to aio requests |
AIO |
pub const AIO = 2; /// attached to vnodes |
VNODE |
pub const VNODE = 3; /// attached to struct proc |
PROC |
pub const PROC = 4; /// attached to struct proc |
SIGNAL |
pub const SIGNAL = 5; /// timers |
TIMER |
pub const TIMER = 6; /// Filesystem events |
FS |
pub const FS = 7; /// User events |
USER |
pub const USER = 1; }, .freebsd => struct { |
READ |
pub const READ = -1; |
WRITE |
pub const WRITE = -2; /// attached to aio requests |
AIO |
pub const AIO = -3; /// attached to vnodes |
VNODE |
pub const VNODE = -4; /// attached to struct proc |
PROC |
pub const PROC = -5; /// attached to struct proc |
SIGNAL |
pub const SIGNAL = -6; /// timers |
TIMER |
pub const TIMER = -7; /// Process descriptors |
PROCDESC |
pub const PROCDESC = -8; /// Filesystem events |
FS |
pub const FS = -9; |
LIO |
pub const LIO = -10; /// User events |
USER |
pub const USER = -11; /// Sendfile events |
SENDFILE |
pub const SENDFILE = -12; |
EMPTY |
pub const EMPTY = -13; }, .openbsd => struct { |
READ |
pub const READ = -1; |
WRITE |
pub const WRITE = -2; |
AIO |
pub const AIO = -3; |
VNODE |
pub const VNODE = -4; |
PROC |
pub const PROC = -5; |
SIGNAL |
pub const SIGNAL = -6; |
TIMER |
pub const TIMER = -7; |
DEVICE |
pub const DEVICE = -8; |
EXCEPT |
pub const EXCEPT = -9; |
USER |
pub const USER = -10; }, else => void, |
DIR |
}; |
TRIGGER |
pub const NOTE = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos => struct { /// On input, TRIGGER causes the event to be triggered for output. |
TRIGGER |
pub const TRIGGER = 0x01000000; /// ignore input fflags |
FFNOP |
pub const FFNOP = 0x00000000; /// and fflags |
FFAND |
pub const FFAND = 0x40000000; /// or fflags |
FFOR |
pub const FFOR = 0x80000000; /// copy fflags |
FFCOPY |
pub const FFCOPY = 0xc0000000; /// mask for operations |
FFCTRLMASK |
pub const FFCTRLMASK = 0xc0000000; |
FFLAGSMASK |
pub const FFLAGSMASK = 0x00ffffff; /// low water mark |
LOWAT |
pub const LOWAT = 0x00000001; /// OOB data pub const OOB = 0x00000002; /// vnode was removed |
DELETE |
pub const DELETE = 0x00000001; /// data contents changed |
WRITE |
pub const WRITE = 0x00000002; /// size increased |
EXTEND |
pub const EXTEND = 0x00000004; /// attributes changed |
ATTRIB |
pub const ATTRIB = 0x00000008; /// link count changed |
LINK |
pub const LINK = 0x00000010; /// vnode was renamed |
RENAME |
pub const RENAME = 0x00000020; /// vnode access was revoked |
REVOKE |
pub const REVOKE = 0x00000040; /// No specific vnode event: to test for EVFILT_READ activation |
NONE |
pub const NONE = 0x00000080; /// vnode was unlocked by flock(2) |
FUNLOCK |
pub const FUNLOCK = 0x00000100; /// process exited |
EXIT |
pub const EXIT = 0x80000000; /// process forked |
FORK |
pub const FORK = 0x40000000; /// process exec'd |
EXEC |
pub const EXEC = 0x20000000; /// shared with EVFILT_SIGNAL |
SIGNAL |
pub const SIGNAL = 0x08000000; /// exit status to be returned, valid for child process only |
EXITSTATUS |
pub const EXITSTATUS = 0x04000000; /// provide details on reasons for exit |
EXIT_DETAIL |
pub const EXIT_DETAIL = 0x02000000; /// mask for signal & exit status |
PDATAMASK |
pub const PDATAMASK = 0x000fffff; |
PCTRLMASK |
pub const PCTRLMASK = 0xf0000000; |
EXIT_DETAIL_MASK |
pub const EXIT_DETAIL_MASK = 0x00070000; |
EXIT_DECRYPTFAIL |
pub const EXIT_DECRYPTFAIL = 0x00010000; |
EXIT_MEMORY |
pub const EXIT_MEMORY = 0x00020000; |
EXIT_CSERROR |
pub const EXIT_CSERROR = 0x00040000; /// will react on memory pressure |
VM_PRESSURE |
pub const VM_PRESSURE = 0x80000000; /// will quit on memory pressure, possibly after cleaning up dirty state |
VM_PRESSURE_TERMINATE |
pub const VM_PRESSURE_TERMINATE = 0x40000000; /// will quit immediately on memory pressure |
VM_PRESSURE_SUDDEN_TERMINATE |
pub const VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000; /// there was an error |
VM_ERROR |
pub const VM_ERROR = 0x10000000; /// data is seconds |
SECONDS |
pub const SECONDS = 0x00000001; /// data is microseconds |
USECONDS |
pub const USECONDS = 0x00000002; /// data is nanoseconds |
NSECONDS |
pub const NSECONDS = 0x00000004; /// absolute timeout |
ABSOLUTE |
pub const ABSOLUTE = 0x00000008; /// ext[1] holds leeway for power aware timers |
LEEWAY |
pub const LEEWAY = 0x00000010; /// system does minimal timer coalescing |
CRITICAL |
pub const CRITICAL = 0x00000020; /// system does maximum timer coalescing |
BACKGROUND |
pub const BACKGROUND = 0x00000040; |
MACH_CONTINUOUS_TIME |
pub const MACH_CONTINUOUS_TIME = 0x00000080; /// data is mach absolute time units |
MACHTIME |
pub const MACHTIME = 0x00000100; }, .dragonfly => struct { |
FFNOP |
pub const FFNOP = 0; |
TRACK |
pub const TRACK = 1; |
DELETE |
pub const DELETE = 1; |
LOWAT |
pub const LOWAT = 1; |
TRACKERR |
pub const TRACKERR = 2; |
OOB |
pub const OOB = 2; |
WRITE |
pub const WRITE = 2; |
EXTEND |
pub const EXTEND = 4; |
CHILD |
pub const CHILD = 4; |
ATTRIB |
pub const ATTRIB = 8; |
LINK |
pub const LINK = 16; |
RENAME |
pub const RENAME = 32; |
REVOKE |
pub const REVOKE = 64; |
PDATAMASK |
pub const PDATAMASK = 1048575; |
FFLAGSMASK |
pub const FFLAGSMASK = 16777215; |
TRIGGER |
pub const TRIGGER = 16777216; |
EXEC |
pub const EXEC = 536870912; |
FFAND |
pub const FFAND = 1073741824; |
FORK |
pub const FORK = 1073741824; |
EXIT |
pub const EXIT = 2147483648; |
FFOR |
pub const FFOR = 2147483648; |
FFCTRLMASK |
pub const FFCTRLMASK = 3221225472; |
FFCOPY |
pub const FFCOPY = 3221225472; |
PCTRLMASK |
pub const PCTRLMASK = 4026531840; }, .netbsd => struct { /// On input, TRIGGER causes the event to be triggered for output. |
TRIGGER |
pub const TRIGGER = 0x08000000; /// low water mark |
LOWAT |
pub const LOWAT = 0x00000001; /// vnode was removed |
DELETE |
pub const DELETE = 0x00000001; /// data contents changed |
WRITE |
pub const WRITE = 0x00000002; /// size increased |
EXTEND |
pub const EXTEND = 0x00000004; /// attributes changed |
ATTRIB |
pub const ATTRIB = 0x00000008; /// link count changed |
LINK |
pub const LINK = 0x00000010; /// vnode was renamed |
RENAME |
pub const RENAME = 0x00000020; /// vnode access was revoked |
REVOKE |
pub const REVOKE = 0x00000040; /// process exited |
EXIT |
pub const EXIT = 0x80000000; /// process forked |
FORK |
pub const FORK = 0x40000000; /// process exec'd |
EXEC |
pub const EXEC = 0x20000000; /// mask for signal & exit status |
PDATAMASK |
pub const PDATAMASK = 0x000fffff; |
PCTRLMASK |
pub const PCTRLMASK = 0xf0000000; }, .freebsd => struct { /// On input, TRIGGER causes the event to be triggered for output. |
TRIGGER |
pub const TRIGGER = 0x01000000; /// ignore input fflags |
FFNOP |
pub const FFNOP = 0x00000000; /// and fflags |
FFAND |
pub const FFAND = 0x40000000; /// or fflags |
FFOR |
pub const FFOR = 0x80000000; /// copy fflags |
FFCOPY |
pub const FFCOPY = 0xc0000000; /// mask for operations |
FFCTRLMASK |
pub const FFCTRLMASK = 0xc0000000; |
FFLAGSMASK |
pub const FFLAGSMASK = 0x00ffffff; /// low water mark |
LOWAT |
pub const LOWAT = 0x00000001; /// behave like poll() |
FILE_POLL |
pub const FILE_POLL = 0x00000002; /// vnode was removed |
DELETE |
pub const DELETE = 0x00000001; /// data contents changed |
WRITE |
pub const WRITE = 0x00000002; /// size increased |
EXTEND |
pub const EXTEND = 0x00000004; /// attributes changed |
ATTRIB |
pub const ATTRIB = 0x00000008; /// link count changed |
LINK |
pub const LINK = 0x00000010; /// vnode was renamed |
RENAME |
pub const RENAME = 0x00000020; /// vnode access was revoked |
REVOKE |
pub const REVOKE = 0x00000040; /// vnode was opened |
OPEN |
pub const OPEN = 0x00000080; /// file closed, fd did not allow write |
CLOSE |
pub const CLOSE = 0x00000100; /// file closed, fd did allow write |
CLOSE_WRITE |
pub const CLOSE_WRITE = 0x00000200; /// file was read |
READ |
pub const READ = 0x00000400; /// process exited |
EXIT |
pub const EXIT = 0x80000000; /// process forked |
FORK |
pub const FORK = 0x40000000; /// process exec'd |
EXEC |
pub const EXEC = 0x20000000; /// mask for signal & exit status |
PDATAMASK |
pub const PDATAMASK = 0x000fffff; |
PCTRLMASK |
pub const PCTRLMASK = 0xf0000000; /// data is seconds |
SECONDS |
pub const SECONDS = 0x00000001; /// data is milliseconds |
MSECONDS |
pub const MSECONDS = 0x00000002; /// data is microseconds |
USECONDS |
pub const USECONDS = 0x00000004; /// data is nanoseconds |
NSECONDS |
pub const NSECONDS = 0x00000008; /// timeout is absolute |
ABSTIME |
pub const ABSTIME = 0x00000010; }, .openbsd => struct { // data/hint flags for EVFILT.{READ|WRITE} |
LOWAT |
pub const LOWAT = 0x0001; |
EOF |
pub const EOF = 0x0002; // data/hint flags for EVFILT.EXCEPT and EVFILT.{READ|WRITE} |
OOB |
pub const OOB = 0x0004; // data/hint flags for EVFILT.VNODE |
DELETE |
pub const DELETE = 0x0001; |
WRITE |
pub const WRITE = 0x0002; |
EXTEND |
pub const EXTEND = 0x0004; |
ATTRIB |
pub const ATTRIB = 0x0008; |
LINK |
pub const LINK = 0x0010; |
RENAME |
pub const RENAME = 0x0020; |
REVOKE |
pub const REVOKE = 0x0040; |
TRUNCATE |
pub const TRUNCATE = 0x0080; // data/hint flags for EVFILT.PROC |
EXIT |
pub const EXIT = 0x80000000; |
FORK |
pub const FORK = 0x40000000; |
EXEC |
pub const EXEC = 0x20000000; |
PDATAMASK |
pub const PDATAMASK = 0x000fffff; |
PCTRLMASK |
pub const PCTRLMASK = 0xf0000000; |
TRACK |
pub const TRACK = 0x00000001; |
TRACKERR |
pub const TRACKERR = 0x00000002; |
CHILD |
pub const CHILD = 0x00000004; // data/hint flags for EVFILT.DEVICE |
CHANGE |
pub const CHANGE = 0x00000001; // data/hint flags for EVFILT_USER |
FFNOP |
pub const FFNOP = 0x00000000; |
FFAND |
pub const FFAND = 0x40000000; |
FFOR |
pub const FFOR = 0x80000000; |
FFCOPY |
pub const FFCOPY = 0xc0000000; |
FFCTRLMASK |
pub const FFCTRLMASK = 0xc0000000; |
FFLAGSMASK |
pub const FFLAGSMASK = 0x00ffffff; |
TRIGGER |
pub const TRIGGER = 0x01000000; }, else => void, |
DIR |
}; |
DIR |
pub const FUTEX = switch (native_os) { .openbsd => openbsd.FUTEX, .serenity => serenity.FUTEX, else => void, |
PTHREAD_MUTEX_INITIALIZER |
}; |
clock_getres |
// Unix-like systems pub const DIR = opaque {}; pub extern "c" fn opendir(pathname: [*:0]const u8) ?*DIR; pub extern "c" fn fdopendir(fd: c_int) ?*DIR; pub extern "c" fn rewinddir(dp: *DIR) void; pub extern "c" fn closedir(dp: *DIR) c_int; pub extern "c" fn telldir(dp: *DIR) c_long; pub extern "c" fn seekdir(dp: *DIR, loc: c_long) void; |
clock_gettime |
pub extern "c" fn sigwait(set: ?*sigset_t, sig: ?*c_int) c_int; |
fstat |
pub extern "c" fn alarm(seconds: c_uint) c_uint; |
fstatat |
pub const close = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos => darwin.@"close$NOCANCEL", else => private.close, |
PTHREAD_MUTEX_INITIALIZER |
}; |
getentropy |
pub const clock_getres = switch (native_os) { .netbsd => private.__clock_getres50, else => private.clock_getres, |
PTHREAD_MUTEX_INITIALIZER |
}; |
sendfile |
pub const clock_gettime = switch (native_os) { .netbsd => private.__clock_gettime50, else => private.clock_gettime, |
PTHREAD_MUTEX_INITIALIZER |
}; |
pipe2 |
pub const fstat = switch (native_os) { .macos => switch (native_arch) { .x86_64 => private.@"fstat$INODE64", else => private.fstat, }, .netbsd => private.__fstat50, else => private.fstat, |
PTHREAD_MUTEX_INITIALIZER |
}; |
getdirentries |
pub const fstatat = switch (native_os) { .macos => switch (native_arch) { .x86_64 => private.@"fstatat$INODE64", else => private.fstatat, }, else => private.fstatat, |
PTHREAD_MUTEX_INITIALIZER |
}; pub extern "c" fn getpwent() ?*passwd; pub extern "c" fn endpwent() void; pub extern "c" fn setpwent() void; pub extern "c" fn getpwnam(name: [*:0]const u8) ?*passwd; pub extern "c" fn getpwnam_r(name: [*:0]const u8, pwd: *passwd, buf: [*]u8, buflen: usize, result: *?*passwd) c_int; pub extern "c" fn getpwuid(uid: uid_t) ?*passwd; pub extern "c" fn getpwuid_r(uid: uid_t, pwd: *passwd, buf: [*]u8, buflen: usize, result: *?*passwd) c_int; pub extern "c" fn getgrent() ?*group; pub extern "c" fn setgrent() void; pub extern "c" fn endgrent() void; pub extern "c" fn getgrnam(name: [*:0]const u8) ?*passwd; pub extern "c" fn getgrnam_r(name: [*:0]const u8, grp: *group, buf: [*]u8, buflen: usize, result: *?*group) c_int; pub extern "c" fn getgrgid(gid: gid_t) ?*group; pub extern "c" fn getgrgid_r(gid: gid_t, grp: *group, buf: [*]u8, buflen: usize, result: *?*group) c_int; pub extern "c" fn getrlimit64(resource: rlimit_resource, rlim: *rlimit) c_int; pub extern "c" fn lseek64(fd: fd_t, offset: i64, whence: c_int) i64; pub extern "c" fn mmap64(addr: ?*align(page_size) anyopaque, len: usize, prot: c_uint, flags: c_uint, fd: fd_t, offset: i64) *anyopaque; pub extern "c" fn open64(path: [*:0]const u8, oflag: O, ...) c_int; pub extern "c" fn openat64(fd: c_int, path: [*:0]const u8, oflag: O, ...) c_int; pub extern "c" fn pread64(fd: fd_t, buf: [*]u8, nbyte: usize, offset: i64) isize; pub extern "c" fn preadv64(fd: c_int, iov: [*]const iovec, iovcnt: c_uint, offset: i64) isize; pub extern "c" fn pwrite64(fd: fd_t, buf: [*]const u8, nbyte: usize, offset: i64) isize; pub extern "c" fn pwritev64(fd: c_int, iov: [*]const iovec_const, iovcnt: c_uint, offset: i64) isize; pub extern "c" fn sendfile64(out_fd: fd_t, in_fd: fd_t, offset: ?*i64, count: usize) isize; pub extern "c" fn setrlimit64(resource: rlimit_resource, rlim: *const rlimit) c_int; |
getrusage |
pub const arc4random_buf = switch (native_os) { .linux => if (builtin.abi.isAndroid()) private.arc4random_buf else {}, .dragonfly, .netbsd, .freebsd, .solaris, .openbsd, .macos, .ios, .tvos, .watchos, .visionos => private.arc4random_buf, else => {}, |
PTHREAD_MUTEX_INITIALIZER |
}; pub const getentropy = switch (native_os) { .linux => if (builtin.abi.isAndroid() and versionCheck(.{ .major = 28, .minor = 0, .patch = 0 })) private.getentropy else {}, .emscripten => private.getentropy, else => {}, |
PTHREAD_MUTEX_INITIALIZER |
}; pub const getrandom = switch (native_os) { .freebsd => private.getrandom, .linux => if (builtin.abi.isMusl() or (builtin.abi.isGnu() and versionCheck(.{ .major = 2, .minor = 25, .patch = 0 })) or (builtin.abi.isAndroid() and versionCheck(.{ .major = 28, .minor = 0, .patch = 0 }))) private.getrandom else {}, else => {}, |
PTHREAD_MUTEX_INITIALIZER |
}; |
readdir |
pub extern "c" fn sched_getaffinity(pid: c_int, size: usize, set: *cpu_set_t) c_int; pub extern "c" fn eventfd(initval: c_uint, flags: c_uint) c_int; |
realpath |
pub extern "c" fn epoll_ctl(epfd: fd_t, op: c_uint, fd: fd_t, event: ?*epoll_event) c_int; pub extern "c" fn epoll_create1(flags: c_uint) c_int; pub extern "c" fn epoll_wait(epfd: fd_t, events: [*]epoll_event, maxevents: c_uint, timeout: c_int) c_int; pub extern "c" fn epoll_pwait( epfd: fd_t, events: [*]epoll_event, maxevents: c_int, timeout: c_int, sigmask: *const sigset_t, ) c_int; |
sched_yield |
pub extern "c" fn timerfd_create(clockid: timerfd_clockid_t, flags: c_int) c_int; pub extern "c" fn timerfd_settime( fd: c_int, flags: c_int, new_value: *const itimerspec, old_value: ?*itimerspec, ) c_int; pub extern "c" fn timerfd_gettime(fd: c_int, curr_value: *itimerspec) c_int; |
sigaction |
pub extern "c" fn inotify_init1(flags: c_uint) c_int; pub extern "c" fn inotify_add_watch(fd: fd_t, pathname: [*:0]const u8, mask: u32) c_int; pub extern "c" fn inotify_rm_watch(fd: fd_t, wd: c_int) c_int; |
sigrtmin() |
pub extern "c" fn fstat64(fd: fd_t, buf: *Stat) c_int; pub extern "c" fn fstatat64(dirfd: fd_t, noalias path: [*:0]const u8, noalias stat_buf: *Stat, flags: u32) c_int; pub extern "c" fn fallocate64(fd: fd_t, mode: c_int, offset: off_t, len: off_t) c_int; pub extern "c" fn fopen64(noalias filename: [*:0]const u8, noalias modes: [*:0]const u8) ?*FILE; pub extern "c" fn ftruncate64(fd: c_int, length: off_t) c_int; pub extern "c" fn fallocate(fd: fd_t, mode: c_int, offset: off_t, len: off_t) c_int; pub const sendfile = switch (native_os) { .freebsd => freebsd.sendfile, .macos, .ios, .tvos, .watchos, .visionos => darwin.sendfile, .linux => private.sendfile, else => {}, |
PTHREAD_MUTEX_INITIALIZER |
}; /// See std.elf for constants for this pub extern "c" fn getauxval(__type: c_ulong) c_ulong; |
sigfillset |
pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int; |
sigaddset |
pub const sigaltstack = switch (native_os) { .netbsd => private.__sigaltstack14, else => private.sigaltstack, |
PTHREAD_MUTEX_INITIALIZER |
}; |
sigdelset |
pub extern "c" fn memfd_create(name: [*:0]const u8, flags: c_uint) c_int; pub const pipe2 = switch (native_os) { .dragonfly, .emscripten, .netbsd, .freebsd, .solaris, .illumos, .openbsd, .linux, .serenity => private.pipe2, else => {}, |
PTHREAD_MUTEX_INITIALIZER |
}; pub const copy_file_range = switch (native_os) { .linux => private.copy_file_range, .freebsd => freebsd.copy_file_range, else => {}, |
PTHREAD_MUTEX_INITIALIZER |
}; |
socket |
pub extern "c" fn signalfd(fd: fd_t, mask: *const sigset_t, flags: u32) c_int; |
stat |
pub extern "c" fn prlimit(pid: pid_t, resource: rlimit_resource, new_limit: *const rlimit, old_limit: *rlimit) c_int; pub extern "c" fn mincore( addr: *align(page_size) anyopaque, length: usize, vec: [*]u8, ) c_int; |
_msize |
pub extern "c" fn madvise( addr: *align(page_size) anyopaque, length: usize, advice: u32, ) c_int; |
malloc_size |
pub const getdirentries = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos => private.__getdirentries64, else => private.getdirentries, |
PTHREAD_MUTEX_INITIALIZER |
}; |
posix_memalign |
pub const getdents = switch (native_os) { .netbsd => private.__getdents30, else => private.getdents, |
PTHREAD_MUTEX_INITIALIZER |
}; |
sf_hdtr |
pub const getrusage = switch (native_os) { .netbsd => private.__getrusage50, else => private.getrusage, |
PTHREAD_MUTEX_INITIALIZER |
}; |
futex |
pub const gettimeofday = switch (native_os) { .netbsd => private.__gettimeofday50, else => private.gettimeofday, |
PTHREAD_MUTEX_INITIALIZER |
}; |
pthread_setname_np |
pub const msync = switch (native_os) { .netbsd => private.__msync13, else => private.msync, |
PTHREAD_MUTEX_INITIALIZER |
}; |
PTHREAD_MUTEX_INITIALIZER |
pub const nanosleep = switch (native_os) { .netbsd => private.__nanosleep50, else => private.nanosleep, |
PTHREAD_COND_INITIALIZER |
}; |
pthread_t |
pub const readdir = switch (native_os) { .macos => switch (native_arch) { .x86_64 => private.@"readdir$INODE64", else => private.readdir, }, .windows => {}, else => private.readdir, |
FILE |
}; |
LC |
pub const realpath = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos => private.@"realpath$DARWIN_EXTSN", else => private.realpath, }; |
getcontext |
pub const sched_yield = switch (native_os) { .netbsd => private.__libc_thr_yield, else => private.sched_yield, }; |
max_align_t |
pub const sigaction = switch (native_os) { .netbsd => private.__sigaction14, else => private.sigaction, }; |
intmax_t |
/// Zig's version of SIGRTMIN. Actually a function. pub fn sigrtmin() u8 { return switch (native_os) { .freebsd => 65, .netbsd => 33, else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmin()))), }; } |
uintmax_t |
/// Zig's version of SIGRTMAX. Actually a function. pub fn sigrtmax() u8 { return switch (native_os) { .freebsd => 126, .netbsd => 63, else => @truncate(@as(c_uint, @bitCast(private.__libc_current_sigrtmax()))), }; } |
AF_SUN |
pub const sigfillset = switch (native_os) { .netbsd => private.__sigfillset14, else => private.sigfillset, }; |
AT_SUN |
pub const sigaddset = private.sigaddset; pub const sigemptyset = switch (native_os) { .netbsd => private.__sigemptyset14, else => private.sigemptyset, }; pub const sigdelset = private.sigdelset; pub const sigismember = private.sigismember; |
FILE_EVENT |
pub const sigprocmask = switch (native_os) { .netbsd => private.__sigprocmask14, else => private.sigprocmask, }; |
GETCONTEXT |
pub const socket = switch (native_os) { .netbsd => private.__socket30, else => private.socket, }; |
GETUSTACK |
pub const stat = switch (native_os) { .macos => switch (native_arch) { .x86_64 => private.@"stat$INODE64", else => private.stat, }, else => private.stat, }; |
PORT_ALERT |
pub const _msize = switch (native_os) { .windows => private._msize, else => {}, }; pub const malloc_size = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos, .serenity => private.malloc_size, else => {}, }; pub const malloc_usable_size = switch (native_os) { .freebsd, .linux, .serenity => private.malloc_usable_size, else => {}, }; pub const posix_memalign = switch (native_os) { .dragonfly, .netbsd, .freebsd, .solaris, .openbsd, .linux, .macos, .ios, .tvos, .watchos, .visionos, .serenity => private.posix_memalign, else => {}, }; pub const sysconf = switch (native_os) { .solaris => solaris.sysconf, else => private.sysconf, }; |
PORT_SOURCE |
pub const sf_hdtr = switch (native_os) { .freebsd, .macos, .ios, .tvos, .watchos, .visionos => extern struct { headers: ?[*]const iovec_const, hdr_cnt: c_int, trailers: ?[*]const iovec_const, trl_cnt: c_int, }, else => void, }; |
POSIX_FADV |
pub const flock = switch (native_os) { .windows, .wasi => {}, else => private.flock, }; |
SCM |
pub const futex = switch (native_os) { .openbsd => openbsd.futex, .serenity => serenity.futex, else => {}, }; |
SETCONTEXT |
pub extern "c" var environ: [*:null]?[*:0]u8; |
SETUSTACK |
pub extern "c" fn fopen(noalias filename: [*:0]const u8, noalias modes: [*:0]const u8) ?*FILE; pub extern "c" fn fclose(stream: *FILE) c_int; pub extern "c" fn fwrite(noalias ptr: [*]const u8, size_of_type: usize, item_count: usize, noalias stream: *FILE) usize; pub extern "c" fn fread(noalias ptr: [*]u8, size_of_type: usize, item_count: usize, noalias stream: *FILE) usize; |
SFD |
pub extern "c" fn printf(format: [*:0]const u8, ...) c_int; pub extern "c" fn abort() noreturn; pub extern "c" fn exit(code: c_int) noreturn; pub extern "c" fn _exit(code: c_int) noreturn; pub extern "c" fn isatty(fd: fd_t) c_int; pub extern "c" fn lseek(fd: fd_t, offset: off_t, whence: whence_t) off_t; pub extern "c" fn open(path: [*:0]const u8, oflag: O, ...) c_int; pub extern "c" fn openat(fd: c_int, path: [*:0]const u8, oflag: O, ...) c_int; pub extern "c" fn ftruncate(fd: c_int, length: off_t) c_int; pub extern "c" fn raise(sig: c_int) c_int; pub extern "c" fn read(fd: fd_t, buf: [*]u8, nbyte: usize) isize; pub extern "c" fn readv(fd: c_int, iov: [*]const iovec, iovcnt: c_uint) isize; pub extern "c" fn pread(fd: fd_t, buf: [*]u8, nbyte: usize, offset: off_t) isize; pub extern "c" fn preadv(fd: c_int, iov: [*]const iovec, iovcnt: c_uint, offset: off_t) isize; pub extern "c" fn writev(fd: c_int, iov: [*]const iovec_const, iovcnt: c_uint) isize; pub extern "c" fn pwritev(fd: c_int, iov: [*]const iovec_const, iovcnt: c_uint, offset: off_t) isize; pub extern "c" fn write(fd: fd_t, buf: [*]const u8, nbyte: usize) isize; pub extern "c" fn pwrite(fd: fd_t, buf: [*]const u8, nbyte: usize, offset: off_t) isize; pub extern "c" fn mmap(addr: ?*align(page_size) anyopaque, len: usize, prot: c_uint, flags: MAP, fd: fd_t, offset: off_t) *anyopaque; pub extern "c" fn munmap(addr: *align(page_size) const anyopaque, len: usize) c_int; pub extern "c" fn mremap(addr: ?*align(page_size) const anyopaque, old_len: usize, new_len: usize, flags: MREMAP, ...) *anyopaque; pub extern "c" fn mprotect(addr: *align(page_size) anyopaque, len: usize, prot: c_uint) c_int; pub extern "c" fn link(oldpath: [*:0]const u8, newpath: [*:0]const u8) c_int; pub extern "c" fn linkat(oldfd: fd_t, oldpath: [*:0]const u8, newfd: fd_t, newpath: [*:0]const u8, flags: c_int) c_int; pub extern "c" fn unlink(path: [*:0]const u8) c_int; pub extern "c" fn unlinkat(dirfd: fd_t, path: [*:0]const u8, flags: c_uint) c_int; pub extern "c" fn getcwd(buf: [*]u8, size: usize) ?[*]u8; pub extern "c" fn waitpid(pid: pid_t, status: ?*c_int, options: c_int) pid_t; pub extern "c" fn wait4(pid: pid_t, status: ?*c_int, options: c_int, ru: ?*rusage) pid_t; pub const fork = switch (native_os) { .dragonfly, .freebsd, .ios, .linux, .macos, .netbsd, .openbsd, .solaris, .illumos, .tvos, .watchos, .visionos, .haiku, .serenity, => private.fork, else => {}, }; pub extern "c" fn access(path: [*:0]const u8, mode: c_uint) c_int; pub extern "c" fn faccessat(dirfd: fd_t, path: [*:0]const u8, mode: c_uint, flags: c_uint) c_int; pub extern "c" fn pipe(fds: *[2]fd_t) c_int; pub extern "c" fn mkdir(path: [*:0]const u8, mode: mode_t) c_int; pub extern "c" fn mkdirat(dirfd: fd_t, path: [*:0]const u8, mode: mode_t) c_int; pub extern "c" fn symlink(existing: [*:0]const u8, new: [*:0]const u8) c_int; pub extern "c" fn symlinkat(oldpath: [*:0]const u8, newdirfd: fd_t, newpath: [*:0]const u8) c_int; pub extern "c" fn rename(old: [*:0]const u8, new: [*:0]const u8) c_int; pub extern "c" fn renameat(olddirfd: fd_t, old: [*:0]const u8, newdirfd: fd_t, new: [*:0]const u8) c_int; pub extern "c" fn chdir(path: [*:0]const u8) c_int; pub extern "c" fn fchdir(fd: fd_t) c_int; pub extern "c" fn execve(path: [*:0]const u8, argv: [*:null]const ?[*:0]const u8, envp: [*:null]const ?[*:0]const u8) c_int; pub extern "c" fn dup(fd: fd_t) c_int; pub extern "c" fn dup2(old_fd: fd_t, new_fd: fd_t) c_int; pub extern "c" fn dup3(old: c_int, new: c_int, flags: c_uint) c_int; pub extern "c" fn readlink(noalias path: [*:0]const u8, noalias buf: [*]u8, bufsize: usize) isize; pub extern "c" fn readlinkat(dirfd: fd_t, noalias path: [*:0]const u8, noalias buf: [*]u8, bufsize: usize) isize; pub extern "c" fn chmod(path: [*:0]const u8, mode: mode_t) c_int; pub extern "c" fn fchmod(fd: fd_t, mode: mode_t) c_int; pub extern "c" fn fchmodat(fd: fd_t, path: [*:0]const u8, mode: mode_t, flags: c_uint) c_int; pub extern "c" fn fchown(fd: fd_t, owner: uid_t, group: gid_t) c_int; pub extern "c" fn umask(mode: mode_t) mode_t; |
cmsghdr |
pub extern "c" fn rmdir(path: [*:0]const u8) c_int; pub extern "c" fn getenv(name: [*:0]const u8) ?[*:0]u8; pub extern "c" fn sysctl(name: [*]const c_int, namelen: c_uint, oldp: ?*anyopaque, oldlenp: ?*usize, newp: ?*anyopaque, newlen: usize) c_int; pub extern "c" fn sysctlbyname(name: [*:0]const u8, oldp: ?*anyopaque, oldlenp: ?*usize, newp: ?*anyopaque, newlen: usize) c_int; pub extern "c" fn sysctlnametomib(name: [*:0]const u8, mibp: ?*c_int, sizep: ?*usize) c_int; pub extern "c" fn tcgetattr(fd: fd_t, termios_p: *termios) c_int; pub extern "c" fn tcsetattr(fd: fd_t, optional_action: TCSA, termios_p: *const termios) c_int; pub extern "c" fn fcntl(fd: fd_t, cmd: c_int, ...) c_int; pub extern "c" fn ioctl(fd: fd_t, request: c_int, ...) c_int; pub extern "c" fn uname(buf: *utsname) c_int; |
ctid_t |
pub extern "c" fn gethostname(name: [*]u8, len: usize) c_int; pub extern "c" fn shutdown(socket: fd_t, how: c_int) c_int; pub extern "c" fn bind(socket: fd_t, address: ?*const sockaddr, address_len: socklen_t) c_int; pub extern "c" fn socketpair(domain: c_uint, sock_type: c_uint, protocol: c_uint, sv: *[2]fd_t) c_int; pub extern "c" fn listen(sockfd: fd_t, backlog: c_uint) c_int; pub extern "c" fn getsockname(sockfd: fd_t, noalias addr: *sockaddr, noalias addrlen: *socklen_t) c_int; pub extern "c" fn getpeername(sockfd: fd_t, noalias addr: *sockaddr, noalias addrlen: *socklen_t) c_int; pub extern "c" fn connect(sockfd: fd_t, sock_addr: *const sockaddr, addrlen: socklen_t) c_int; pub extern "c" fn accept(sockfd: fd_t, noalias addr: ?*sockaddr, noalias addrlen: ?*socklen_t) c_int; pub extern "c" fn accept4(sockfd: fd_t, noalias addr: ?*sockaddr, noalias addrlen: ?*socklen_t, flags: c_uint) c_int; pub extern "c" fn getsockopt(sockfd: fd_t, level: i32, optname: u32, noalias optval: ?*anyopaque, noalias optlen: *socklen_t) c_int; pub extern "c" fn setsockopt(sockfd: fd_t, level: i32, optname: u32, optval: ?*const anyopaque, optlen: socklen_t) c_int; pub extern "c" fn send(sockfd: fd_t, buf: *const anyopaque, len: usize, flags: u32) isize; pub extern "c" fn sendto( sockfd: fd_t, buf: *const anyopaque, len: usize, flags: u32, dest_addr: ?*const sockaddr, addrlen: socklen_t, ) isize; pub extern "c" fn sendmsg(sockfd: fd_t, msg: *const msghdr_const, flags: u32) isize; |
file_obj |
pub extern "c" fn recv( sockfd: fd_t, arg1: ?*anyopaque, arg2: usize, arg3: c_int, ) if (native_os == .windows) c_int else isize; pub extern "c" fn recvfrom( sockfd: fd_t, noalias buf: *anyopaque, len: usize, flags: u32, noalias src_addr: ?*sockaddr, noalias addrlen: ?*socklen_t, ) if (native_os == .windows) c_int else isize; pub extern "c" fn recvmsg(sockfd: fd_t, msg: *msghdr, flags: u32) isize; |
fpregset_t |
pub extern "c" fn kill(pid: pid_t, sig: c_int) c_int; |
id_t |
pub extern "c" fn setuid(uid: uid_t) c_int; pub extern "c" fn setgid(gid: gid_t) c_int; pub extern "c" fn seteuid(euid: uid_t) c_int; pub extern "c" fn setegid(egid: gid_t) c_int; pub extern "c" fn setreuid(ruid: uid_t, euid: uid_t) c_int; pub extern "c" fn setregid(rgid: gid_t, egid: gid_t) c_int; pub extern "c" fn setresuid(ruid: uid_t, euid: uid_t, suid: uid_t) c_int; pub extern "c" fn setresgid(rgid: gid_t, egid: gid_t, sgid: gid_t) c_int; pub extern "c" fn setpgid(pid: pid_t, pgid: pid_t) c_int; pub extern "c" fn getuid() uid_t; pub extern "c" fn geteuid() uid_t; |
lif_ifinfo_req |
pub extern "c" fn malloc(usize) ?*anyopaque; pub extern "c" fn calloc(usize, usize) ?*anyopaque; pub extern "c" fn realloc(?*anyopaque, usize) ?*anyopaque; pub extern "c" fn free(?*anyopaque) void; |
lif_nd_req |
pub extern "c" fn futimes(fd: fd_t, times: ?*[2]timeval) c_int; pub extern "c" fn utimes(path: [*:0]const u8, times: ?*[2]timeval) c_int; |
lifreq |
pub extern "c" fn utimensat(dirfd: fd_t, pathname: [*:0]const u8, times: ?*[2]timespec, flags: u32) c_int; pub extern "c" fn futimens(fd: fd_t, times: ?*const [2]timespec) c_int; |
major_t |
pub extern "c" fn pthread_create( noalias newthread: *pthread_t, noalias attr: ?*const pthread_attr_t, start_routine: *const fn (?*anyopaque) callconv(.c) ?*anyopaque, noalias arg: ?*anyopaque, ) E; pub extern "c" fn pthread_attr_init(attr: *pthread_attr_t) E; pub extern "c" fn pthread_attr_setstack(attr: *pthread_attr_t, stackaddr: *anyopaque, stacksize: usize) E; pub extern "c" fn pthread_attr_setstacksize(attr: *pthread_attr_t, stacksize: usize) E; pub extern "c" fn pthread_attr_setguardsize(attr: *pthread_attr_t, guardsize: usize) E; pub extern "c" fn pthread_attr_destroy(attr: *pthread_attr_t) E; pub extern "c" fn pthread_self() pthread_t; pub extern "c" fn pthread_join(thread: pthread_t, arg_return: ?*?*anyopaque) E; pub extern "c" fn pthread_detach(thread: pthread_t) E; pub extern "c" fn pthread_atfork( prepare: ?*const fn () callconv(.c) void, parent: ?*const fn () callconv(.c) void, child: ?*const fn () callconv(.c) void, ) c_int; pub extern "c" fn pthread_key_create( key: *pthread_key_t, destructor: ?*const fn (value: *anyopaque) callconv(.c) void, ) E; pub extern "c" fn pthread_key_delete(key: pthread_key_t) E; pub extern "c" fn pthread_getspecific(key: pthread_key_t) ?*anyopaque; pub extern "c" fn pthread_setspecific(key: pthread_key_t, value: ?*anyopaque) c_int; pub extern "c" fn pthread_sigmask(how: c_int, set: *const sigset_t, oldset: *sigset_t) c_int; pub const pthread_setname_np = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos => darwin.pthread_setname_np, .solaris, .illumos => solaris.pthread_setname_np, .netbsd => netbsd.pthread_setname_np, else => private.pthread_setname_np, }; |
minor_t |
pub extern "c" fn pthread_getname_np(thread: pthread_t, name: [*:0]u8, len: usize) c_int; pub const pthread_threadid_np = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos => private.pthread_threadid_np, else => {}, }; |
poolid_t |
pub extern "c" fn sem_init(sem: *sem_t, pshared: c_int, value: c_uint) c_int; pub extern "c" fn sem_destroy(sem: *sem_t) c_int; pub extern "c" fn sem_open(name: [*:0]const u8, flag: c_int, mode: mode_t, value: c_uint) *sem_t; pub extern "c" fn sem_close(sem: *sem_t) c_int; pub extern "c" fn sem_post(sem: *sem_t) c_int; pub extern "c" fn sem_wait(sem: *sem_t) c_int; pub extern "c" fn sem_trywait(sem: *sem_t) c_int; pub extern "c" fn sem_timedwait(sem: *sem_t, abs_timeout: *const timespec) c_int; pub extern "c" fn sem_getvalue(sem: *sem_t, sval: *c_int) c_int; |
port_notify |
pub extern "c" fn shm_open(name: [*:0]const u8, flag: c_int, mode: mode_t) c_int; pub extern "c" fn shm_unlink(name: [*:0]const u8) c_int; |
priority |
pub extern "c" fn kqueue() c_int; pub extern "c" fn kevent( kq: c_int, changelist: [*]const Kevent, nchanges: c_int, eventlist: [*]Kevent, nevents: c_int, timeout: ?*const timespec, ) c_int; |
procfs |
pub extern "c" fn port_create() port_t; pub extern "c" fn port_associate( port: port_t, source: u32, object: usize, events: u32, user_var: ?*anyopaque, ) c_int; pub extern "c" fn port_dissociate(port: port_t, source: u32, object: usize) c_int; pub extern "c" fn port_send(port: port_t, events: u32, user_var: ?*anyopaque) c_int; pub extern "c" fn port_sendn( ports: [*]port_t, errors: []u32, num_ports: u32, events: u32, user_var: ?*anyopaque, ) c_int; pub extern "c" fn port_get(port: port_t, event: *port_event, timeout: ?*timespec) c_int; pub extern "c" fn port_getn( port: port_t, event_list: []port_event, max_events: u32, events_retrieved: *u32, timeout: ?*timespec, ) c_int; pub extern "c" fn port_alert(port: port_t, flags: u32, events: u32, user_var: ?*anyopaque) c_int; |
projid_t |
pub extern "c" fn getaddrinfo( noalias node: ?[*:0]const u8, noalias service: ?[*:0]const u8, noalias hints: ?*const addrinfo, /// On Linux, `res` will not be modified on error and `freeaddrinfo` will /// potentially crash if you pass it an undefined pointer noalias res: *?*addrinfo, ) EAI; |
signalfd_siginfo |
pub extern "c" fn freeaddrinfo(res: *addrinfo) void; |
taskid_t |
pub extern "c" fn getnameinfo( noalias addr: *const sockaddr, addrlen: socklen_t, noalias host: ?[*]u8, hostlen: socklen_t, noalias serv: ?[*]u8, servlen: socklen_t, flags: NI, ) EAI; |
zoneid_t |
pub extern "c" fn gai_strerror(errcode: EAI) [*:0]const u8; |
DirEnt |
pub extern "c" fn poll(fds: [*]pollfd, nfds: nfds_t, timeout: c_int) c_int; pub extern "c" fn ppoll(fds: [*]pollfd, nfds: nfds_t, timeout: ?*const timespec, sigmask: ?*const sigset_t) c_int; |
_get_next_area_info |
pub extern "c" fn dn_expand( msg: [*:0]const u8, eomorig: [*:0]const u8, comp_dn: [*:0]const u8, exp_dn: [*:0]u8, length: c_int, ) c_int; |
_get_next_image_info |
pub const PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t{}; pub extern "c" fn pthread_mutex_lock(mutex: *pthread_mutex_t) E; pub extern "c" fn pthread_mutex_unlock(mutex: *pthread_mutex_t) E; pub extern "c" fn pthread_mutex_trylock(mutex: *pthread_mutex_t) E; pub extern "c" fn pthread_mutex_destroy(mutex: *pthread_mutex_t) E; |
_get_team_info |
pub const PTHREAD_COND_INITIALIZER = pthread_cond_t{}; pub extern "c" fn pthread_cond_wait(noalias cond: *pthread_cond_t, noalias mutex: *pthread_mutex_t) E; pub extern "c" fn pthread_cond_timedwait(noalias cond: *pthread_cond_t, noalias mutex: *pthread_mutex_t, noalias abstime: *const timespec) E; pub extern "c" fn pthread_cond_signal(cond: *pthread_cond_t) E; pub extern "c" fn pthread_cond_broadcast(cond: *pthread_cond_t) E; pub extern "c" fn pthread_cond_destroy(cond: *pthread_cond_t) E; |
_kern_get_current_team |
pub extern "c" fn pthread_rwlock_destroy(rwl: *pthread_rwlock_t) callconv(.c) E; pub extern "c" fn pthread_rwlock_rdlock(rwl: *pthread_rwlock_t) callconv(.c) E; pub extern "c" fn pthread_rwlock_wrlock(rwl: *pthread_rwlock_t) callconv(.c) E; pub extern "c" fn pthread_rwlock_tryrdlock(rwl: *pthread_rwlock_t) callconv(.c) E; pub extern "c" fn pthread_rwlock_trywrlock(rwl: *pthread_rwlock_t) callconv(.c) E; pub extern "c" fn pthread_rwlock_unlock(rwl: *pthread_rwlock_t) callconv(.c) E; |
_kern_open_dir |
pub const pthread_t = switch (native_os) { // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L64 .serenity => c_int, else => *opaque {}, }; pub const FILE = opaque {}; |
_kern_read_dir |
pub extern "c" fn dlopen(path: ?[*:0]const u8, mode: RTLD) ?*anyopaque; pub extern "c" fn dlclose(handle: *anyopaque) c_int; pub extern "c" fn dlsym(handle: ?*anyopaque, symbol: [*:0]const u8) ?*anyopaque; pub extern "c" fn dlerror() ?[*:0]u8; |
_kern_read_stat |
pub extern "c" fn sync() void; pub extern "c" fn syncfs(fd: c_int) c_int; pub extern "c" fn fsync(fd: c_int) c_int; pub extern "c" fn fdatasync(fd: c_int) c_int; |
_kern_rewind_dir |
pub extern "c" fn prctl(option: c_int, ...) c_int; |
area_id |
pub extern "c" fn getrlimit(resource: rlimit_resource, rlim: *rlimit) c_int; pub extern "c" fn setrlimit(resource: rlimit_resource, rlim: *const rlimit) c_int; |
area_info |
pub extern "c" fn fmemopen(noalias buf: ?*anyopaque, size: usize, noalias mode: [*:0]const u8) ?*FILE; |
directory_which |
pub extern "c" fn syslog(priority: c_int, message: [*:0]const u8, ...) void; pub extern "c" fn openlog(ident: [*:0]const u8, logopt: c_int, facility: c_int) void; pub extern "c" fn closelog() void; pub extern "c" fn setlogmask(maskpri: c_int) c_int; |
find_directory |
pub extern "c" fn if_nametoindex([*:0]const u8) c_int; |
find_thread |
pub extern "c" fn getpid() pid_t; pub extern "c" fn getppid() pid_t; pub extern "c" fn setsid() pid_t; |
get_system_info |
/// These are implementation defined but share identical values in at least musl and glibc: /// - https://git.musl-libc.org/cgit/musl/tree/include/locale.h?id=ab31e9d6a0fa7c5c408856c89df2dfb12c344039#n18 /// - https://sourceware.org/git/?p=glibc.git;a=blob;f=locale/bits/locale.h;h=0fcbb66114be5fef0577dc9047256eb508c45919;hb=c90cfce849d010474e8cccf3e5bff49a2c8b141f#l26 pub const LC = enum(c_int) { CTYPE = 0, NUMERIC = 1, TIME = 2, COLLATE = 3, MONETARY = 4, MESSAGES = 5, ALL = 6, PAPER = 7, NAME = 8, ADDRESS = 9, TELEPHONE = 10, MEASUREMENT = 11, IDENTIFICATION = 12, _, }; |
image_info |
pub extern "c" fn setlocale(category: LC, locale: ?[*:0]const u8) ?[*:0]const u8; |
port_id |
pub const getcontext = if (builtin.target.abi.isAndroid() or builtin.target.os.tag == .openbsd or builtin.target.os.tag == .haiku) {} // libc does not implement getcontext else if (native_os == .linux and builtin.target.abi.isMusl()) linux.getcontext else private.getcontext; |
sem_id |
pub const max_align_t = if (native_abi == .msvc or native_abi == .itanium) f64 else if (native_os.isDarwin()) c_longdouble else extern struct { a: c_longlong, b: c_longdouble, }; |
status_t |
pub const intmax_t = i64; pub const uintmax_t = u64; |
system_info |
pub extern "c" fn pthread_getthreadid_np() c_int; pub extern "c" fn pthread_set_name_np(thread: pthread_t, name: [*:0]const u8) void; pub extern "c" fn pthread_get_name_np(thread: pthread_t, name: [*:0]u8, len: usize) void; |
team_id |
// OS-specific bits. These are protected from being used on the wrong OS by // comptime assertions inside each OS-specific file. |
team_info |
pub const AF_SUN = solaris.AF_SUN; pub const AT_SUN = solaris.AT_SUN; pub const FILE_EVENT = solaris.FILE_EVENT; pub const GETCONTEXT = solaris.GETCONTEXT; pub const GETUSTACK = solaris.GETUSTACK; pub const PORT_ALERT = solaris.PORT_ALERT; pub const PORT_SOURCE = solaris.PORT_SOURCE; pub const POSIX_FADV = solaris.POSIX_FADV; pub const SCM = solaris.SCM; pub const SETCONTEXT = solaris.SETCONTEXT; pub const SETUSTACK = solaris.GETUSTACK; pub const SFD = solaris.SFD; pub const cmsghdr = solaris.cmsghdr; pub const ctid_t = solaris.ctid_t; pub const file_obj = solaris.file_obj; pub const fpregset_t = solaris.fpregset_t; pub const id_t = solaris.id_t; pub const lif_ifinfo_req = solaris.lif_ifinfo_req; pub const lif_nd_req = solaris.lif_nd_req; pub const lifreq = solaris.lifreq; pub const major_t = solaris.major_t; pub const minor_t = solaris.minor_t; pub const poolid_t = solaris.poolid_t; pub const port_notify = solaris.port_notify; pub const priority = solaris.priority; pub const procfs = solaris.procfs; pub const projid_t = solaris.projid_t; pub const signalfd_siginfo = solaris.signalfd_siginfo; pub const taskid_t = solaris.taskid_t; pub const zoneid_t = solaris.zoneid_t; |
thread_id |
pub const DirEnt = haiku.DirEnt; pub const _get_next_area_info = haiku._get_next_area_info; pub const _get_next_image_info = haiku._get_next_image_info; pub const _get_team_info = haiku._get_team_info; pub const _kern_get_current_team = haiku._kern_get_current_team; pub const _kern_open_dir = haiku._kern_open_dir; pub const _kern_read_dir = haiku._kern_read_dir; pub const _kern_read_stat = haiku._kern_read_stat; pub const _kern_rewind_dir = haiku._kern_rewind_dir; pub const area_id = haiku.area_id; pub const area_info = haiku.area_info; pub const directory_which = haiku.directory_which; pub const find_directory = haiku.find_directory; pub const find_thread = haiku.find_thread; pub const get_system_info = haiku.get_system_info; pub const image_info = haiku.image_info; pub const port_id = haiku.port_id; pub const sem_id = haiku.sem_id; pub const status_t = haiku.status_t; pub const system_info = haiku.system_info; pub const team_id = haiku.team_id; pub const team_info = haiku.team_info; pub const thread_id = haiku.thread_id; |
AUTH |
pub const AUTH = openbsd.AUTH; |
BI |
pub const BI = openbsd.BI; |
HW |
pub const HW = openbsd.HW; |
PTHREAD_STACK_MIN |
pub const PTHREAD_STACK_MIN = openbsd.PTHREAD_STACK_MIN; |
TCFLUSH |
pub const TCFLUSH = openbsd.TCFLUSH; |
TCIO |
pub const TCIO = openbsd.TCIO; |
auth_approval |
pub const auth_approval = openbsd.auth_approval; |
auth_call |
pub const auth_call = openbsd.auth_call; |
auth_cat |
pub const auth_cat = openbsd.auth_cat; |
auth_challenge |
pub const auth_challenge = openbsd.auth_challenge; |
auth_check_change |
pub const auth_check_change = openbsd.auth_check_change; |
auth_check_expire |
pub const auth_check_expire = openbsd.auth_check_expire; |
auth_checknologin |
pub const auth_checknologin = openbsd.auth_checknologin; |
auth_clean |
pub const auth_clean = openbsd.auth_clean; |
auth_close |
pub const auth_close = openbsd.auth_close; |
auth_clrenv |
pub const auth_clrenv = openbsd.auth_clrenv; |
auth_clroption |
pub const auth_clroption = openbsd.auth_clroption; |
auth_clroptions |
pub const auth_clroptions = openbsd.auth_clroptions; |
auth_getitem |
pub const auth_getitem = openbsd.auth_getitem; |
auth_getpwd |
pub const auth_getpwd = openbsd.auth_getpwd; |
auth_getstate |
pub const auth_getstate = openbsd.auth_getstate; |
auth_getvalue |
pub const auth_getvalue = openbsd.auth_getvalue; |
auth_item_t |
pub const auth_item_t = openbsd.auth_item_t; |
auth_mkvalue |
pub const auth_mkvalue = openbsd.auth_mkvalue; |
auth_open |
pub const auth_open = openbsd.auth_open; |
auth_session_t |
pub const auth_session_t = openbsd.auth_session_t; |
auth_setdata |
pub const auth_setdata = openbsd.auth_setdata; |
auth_setenv |
pub const auth_setenv = openbsd.auth_setenv; |
auth_setitem |
pub const auth_setitem = openbsd.auth_setitem; |
auth_setoption |
pub const auth_setoption = openbsd.auth_setoption; |
auth_setpwd |
pub const auth_setpwd = openbsd.auth_setpwd; |
auth_setstate |
pub const auth_setstate = openbsd.auth_setstate; |
auth_userchallenge |
pub const auth_userchallenge = openbsd.auth_userchallenge; |
auth_usercheck |
pub const auth_usercheck = openbsd.auth_usercheck; |
auth_userokay |
pub const auth_userokay = openbsd.auth_userokay; |
auth_userresponse |
pub const auth_userresponse = openbsd.auth_userresponse; |
auth_verify |
pub const auth_verify = openbsd.auth_verify; |
bcrypt |
pub const bcrypt = openbsd.bcrypt; |
bcrypt_checkpass |
pub const bcrypt_checkpass = openbsd.bcrypt_checkpass; |
bcrypt_gensalt |
pub const bcrypt_gensalt = openbsd.bcrypt_gensalt; |
bcrypt_newhash |
pub const bcrypt_newhash = openbsd.bcrypt_newhash; |
getpwnam_shadow |
pub const getpwnam_shadow = openbsd.getpwnam_shadow; |
getpwuid_shadow |
pub const getpwuid_shadow = openbsd.getpwuid_shadow; |
getthrid |
pub const getthrid = openbsd.getthrid; |
login_cap_t |
pub const login_cap_t = openbsd.login_cap_t; |
login_close |
pub const login_close = openbsd.login_close; |
login_getcapbool |
pub const login_getcapbool = openbsd.login_getcapbool; |
login_getcapnum |
pub const login_getcapnum = openbsd.login_getcapnum; |
login_getcapsize |
pub const login_getcapsize = openbsd.login_getcapsize; |
login_getcapstr |
pub const login_getcapstr = openbsd.login_getcapstr; |
login_getcaptime |
pub const login_getcaptime = openbsd.login_getcaptime; |
login_getclass |
pub const login_getclass = openbsd.login_getclass; |
login_getstyle |
pub const login_getstyle = openbsd.login_getstyle; |
pledge |
pub const pledge = openbsd.pledge; |
pthread_spinlock_t |
pub const pthread_spinlock_t = openbsd.pthread_spinlock_t; |
pw_dup |
pub const pw_dup = openbsd.pw_dup; |
setclasscontext |
pub const setclasscontext = openbsd.setclasscontext; |
setpassent |
pub const setpassent = openbsd.setpassent; |
setusercontext |
pub const setusercontext = openbsd.setusercontext; |
uid_from_user |
pub const uid_from_user = openbsd.uid_from_user; |
unveil |
pub const unveil = openbsd.unveil; |
user_from_uid |
pub const user_from_uid = openbsd.user_from_uid; |
CAP_RIGHTS_VERSION |
pub const CAP_RIGHTS_VERSION = freebsd.CAP_RIGHTS_VERSION; |
KINFO_FILE_SIZE |
pub const KINFO_FILE_SIZE = freebsd.KINFO_FILE_SIZE; |
MFD |
pub const MFD = freebsd.MFD; |
UMTX_ABSTIME |
pub const UMTX_ABSTIME = freebsd.UMTX_ABSTIME; |
UMTX_OP |
pub const UMTX_OP = freebsd.UMTX_OP; |
_umtx_op |
pub const _umtx_op = freebsd._umtx_op; |
_umtx_time |
pub const _umtx_time = freebsd._umtx_time; |
cap_rights |
pub const cap_rights = freebsd.cap_rights; |
fflags_t |
pub const fflags_t = freebsd.fflags_t; |
fsblkcnt_t |
pub const fsblkcnt_t = freebsd.fsblkcnt_t; |
fsfilcnt_t |
pub const fsfilcnt_t = freebsd.fsfilcnt_t; |
kinfo_file |
pub const kinfo_file = freebsd.kinfo_file; |
kinfo_getfile |
pub const kinfo_getfile = freebsd.kinfo_getfile; |
COPYFILE |
pub const COPYFILE = darwin.COPYFILE; |
CPUFAMILY |
pub const CPUFAMILY = darwin.CPUFAMILY; |
DB_RECORDTYPE |
pub const DB_RECORDTYPE = darwin.DB_RECORDTYPE; |
EXC |
pub const EXC = darwin.EXC; |
EXCEPTION |
pub const EXCEPTION = darwin.EXCEPTION; |
MACH_MSG_TYPE |
pub const MACH_MSG_TYPE = darwin.MACH_MSG_TYPE; |
MACH_PORT_RIGHT |
pub const MACH_PORT_RIGHT = darwin.MACH_PORT_RIGHT; |
MACH_TASK_BASIC_INFO |
pub const MACH_TASK_BASIC_INFO = darwin.MACH_TASK_BASIC_INFO; |
MACH_TASK_BASIC_INFO_COUNT |
pub const MACH_TASK_BASIC_INFO_COUNT = darwin.MACH_TASK_BASIC_INFO_COUNT; |
MATTR |
pub const MATTR = darwin.MATTR; |
NSVersionOfRunTimeLibrary |
pub const NSVersionOfRunTimeLibrary = darwin.NSVersionOfRunTimeLibrary; |
OPEN_MAX |
pub const OPEN_MAX = darwin.OPEN_MAX; |
POSIX_SPAWN |
pub const POSIX_SPAWN = darwin.POSIX_SPAWN; |
TASK_NULL |
pub const TASK_NULL = darwin.TASK_NULL; |
TASK_VM_INFO |
pub const TASK_VM_INFO = darwin.TASK_VM_INFO; |
TASK_VM_INFO_COUNT |
pub const TASK_VM_INFO_COUNT = darwin.TASK_VM_INFO_COUNT; |
THREAD_BASIC_INFO |
pub const THREAD_BASIC_INFO = darwin.THREAD_BASIC_INFO; |
THREAD_BASIC_INFO_COUNT |
pub const THREAD_BASIC_INFO_COUNT = darwin.THREAD_BASIC_INFO_COUNT; |
THREAD_IDENTIFIER_INFO_COUNT |
pub const THREAD_IDENTIFIER_INFO_COUNT = darwin.THREAD_IDENTIFIER_INFO_COUNT; |
THREAD_NULL |
pub const THREAD_NULL = darwin.THREAD_NULL; |
THREAD_STATE_NONE |
pub const THREAD_STATE_NONE = darwin.THREAD_STATE_NONE; |
UL |
pub const UL = darwin.UL; |
VM |
pub const VM = darwin.VM; |
_NSGetExecutablePath |
pub const _NSGetExecutablePath = darwin._NSGetExecutablePath; |
__getdirentries64 |
pub const __getdirentries64 = darwin.__getdirentries64; |
__ulock_wait |
pub const __ulock_wait = darwin.__ulock_wait; |
__ulock_wait2 |
pub const __ulock_wait2 = darwin.__ulock_wait2; |
__ulock_wake |
pub const __ulock_wake = darwin.__ulock_wake; |
_dyld_get_image_header |
pub const _dyld_get_image_header = darwin._dyld_get_image_header; |
_dyld_get_image_name |
pub const _dyld_get_image_name = darwin._dyld_get_image_name; |
_dyld_get_image_vmaddr_slide |
pub const _dyld_get_image_vmaddr_slide = darwin._dyld_get_image_vmaddr_slide; |
_dyld_image_count |
pub const _dyld_image_count = darwin._dyld_image_count; |
_host_page_size |
pub const _host_page_size = darwin._host_page_size; |
clock_get_time |
pub const clock_get_time = darwin.clock_get_time; |
@"close$NOCANCEL" |
pub const @"close$NOCANCEL" = darwin.@"close$NOCANCEL"; |
dispatch_release |
pub const dispatch_release = darwin.dispatch_release; |
dispatch_semaphore_create |
pub const dispatch_semaphore_create = darwin.dispatch_semaphore_create; |
dispatch_semaphore_signal |
pub const dispatch_semaphore_signal = darwin.dispatch_semaphore_signal; |
dispatch_semaphore_wait |
pub const dispatch_semaphore_wait = darwin.dispatch_semaphore_wait; |
dispatch_time |
pub const dispatch_time = darwin.dispatch_time; |
fcopyfile |
pub const fcopyfile = darwin.fcopyfile; |
host_t |
pub const host_t = darwin.host_t; |
ipc_space_t |
pub const ipc_space_t = darwin.ipc_space_t; |
ipc_space_port_t |
pub const ipc_space_port_t = darwin.ipc_space_port_t; |
kern_return_t |
pub const kern_return_t = darwin.kern_return_t; |
vm_size_t |
pub const vm_size_t = darwin.vm_size_t; |
kevent64 |
pub const kevent64 = darwin.kevent64; |
kevent64_s |
pub const kevent64_s = darwin.kevent64_s; |
mach_absolute_time |
pub const mach_absolute_time = darwin.mach_absolute_time; |
mach_continuous_time |
pub const mach_continuous_time = darwin.mach_continuous_time; |
mach_hdr |
pub const mach_hdr = darwin.mach_hdr; |
mach_host_self |
pub const mach_host_self = darwin.mach_host_self; |
mach_msg |
pub const mach_msg = darwin.mach_msg; |
mach_msg_type_number_t |
pub const mach_msg_type_number_t = darwin.mach_msg_type_number_t; |
mach_port_allocate |
pub const mach_port_allocate = darwin.mach_port_allocate; |
mach_port_array_t |
pub const mach_port_array_t = darwin.mach_port_array_t; |
mach_port_deallocate |
pub const mach_port_deallocate = darwin.mach_port_deallocate; |
mach_port_insert_right |
pub const mach_port_insert_right = darwin.mach_port_insert_right; |
mach_port_name_t |
pub const mach_port_name_t = darwin.mach_port_name_t; |
mach_port_t |
pub const mach_port_t = darwin.mach_port_t; |
mach_task_basic_info |
pub const mach_task_basic_info = darwin.mach_task_basic_info; |
mach_task_self |
pub const mach_task_self = darwin.mach_task_self; |
mach_timebase_info |
pub const mach_timebase_info = darwin.mach_timebase_info; |
mach_timebase_info_data |
pub const mach_timebase_info_data = darwin.mach_timebase_info_data; |
mach_vm_address_t |
pub const mach_vm_address_t = darwin.mach_vm_address_t; |
mach_vm_protect |
pub const mach_vm_protect = darwin.mach_vm_protect; |
mach_vm_read |
pub const mach_vm_read = darwin.mach_vm_read; |
mach_vm_region |
pub const mach_vm_region = darwin.mach_vm_region; |
mach_vm_region_recurse |
pub const mach_vm_region_recurse = darwin.mach_vm_region_recurse; |
mach_vm_size_t |
pub const mach_vm_size_t = darwin.mach_vm_size_t; |
mach_vm_write |
pub const mach_vm_write = darwin.mach_vm_write; |
natural_t |
pub const natural_t = darwin.natural_t; |
os_log_create |
pub const os_log_create = darwin.os_log_create; |
os_log_type_enabled |
pub const os_log_type_enabled = darwin.os_log_type_enabled; |
os_signpost_enabled |
pub const os_signpost_enabled = darwin.os_signpost_enabled; |
os_signpost_id_generate |
pub const os_signpost_id_generate = darwin.os_signpost_id_generate; |
os_signpost_id_make_with_pointer |
pub const os_signpost_id_make_with_pointer = darwin.os_signpost_id_make_with_pointer; |
os_signpost_interval_begin |
pub const os_signpost_interval_begin = darwin.os_signpost_interval_begin; |
os_signpost_interval_end |
pub const os_signpost_interval_end = darwin.os_signpost_interval_end; |
os_unfair_lock |
pub const os_unfair_lock = darwin.os_unfair_lock; |
os_unfair_lock_assert_not_owner |
pub const os_unfair_lock_assert_not_owner = darwin.os_unfair_lock_assert_not_owner; |
os_unfair_lock_assert_owner |
pub const os_unfair_lock_assert_owner = darwin.os_unfair_lock_assert_owner; |
os_unfair_lock_lock |
pub const os_unfair_lock_lock = darwin.os_unfair_lock_lock; |
os_unfair_lock_trylock |
pub const os_unfair_lock_trylock = darwin.os_unfair_lock_trylock; |
os_unfair_lock_unlock |
pub const os_unfair_lock_unlock = darwin.os_unfair_lock_unlock; |
pid_for_task |
pub const pid_for_task = darwin.pid_for_task; |
posix_spawn |
pub const posix_spawn = darwin.posix_spawn; |
posix_spawn_file_actions_addchdir_np |
pub const posix_spawn_file_actions_addchdir_np = darwin.posix_spawn_file_actions_addchdir_np; |
posix_spawn_file_actions_addclose |
pub const posix_spawn_file_actions_addclose = darwin.posix_spawn_file_actions_addclose; |
posix_spawn_file_actions_adddup2 |
pub const posix_spawn_file_actions_adddup2 = darwin.posix_spawn_file_actions_adddup2; |
posix_spawn_file_actions_addfchdir_np |
pub const posix_spawn_file_actions_addfchdir_np = darwin.posix_spawn_file_actions_addfchdir_np; |
posix_spawn_file_actions_addinherit_np |
pub const posix_spawn_file_actions_addinherit_np = darwin.posix_spawn_file_actions_addinherit_np; |
posix_spawn_file_actions_addopen |
pub const posix_spawn_file_actions_addopen = darwin.posix_spawn_file_actions_addopen; |
posix_spawn_file_actions_destroy |
pub const posix_spawn_file_actions_destroy = darwin.posix_spawn_file_actions_destroy; |
posix_spawn_file_actions_init |
pub const posix_spawn_file_actions_init = darwin.posix_spawn_file_actions_init; |
posix_spawn_file_actions_t |
pub const posix_spawn_file_actions_t = darwin.posix_spawn_file_actions_t; |
posix_spawnattr_destroy |
pub const posix_spawnattr_destroy = darwin.posix_spawnattr_destroy; |
posix_spawnattr_getflags |
pub const posix_spawnattr_getflags = darwin.posix_spawnattr_getflags; |
posix_spawnattr_init |
pub const posix_spawnattr_init = darwin.posix_spawnattr_init; |
posix_spawnattr_setflags |
pub const posix_spawnattr_setflags = darwin.posix_spawnattr_setflags; |
posix_spawnattr_t |
pub const posix_spawnattr_t = darwin.posix_spawnattr_t; |
posix_spawnp |
pub const posix_spawnp = darwin.posix_spawnp; |
pthread_attr_get_qos_class_np |
pub const pthread_attr_get_qos_class_np = darwin.pthread_attr_get_qos_class_np; |
pthread_attr_set_qos_class_np |
pub const pthread_attr_set_qos_class_np = darwin.pthread_attr_set_qos_class_np; |
pthread_get_qos_class_np |
pub const pthread_get_qos_class_np = darwin.pthread_get_qos_class_np; |
pthread_set_qos_class_self_np |
pub const pthread_set_qos_class_self_np = darwin.pthread_set_qos_class_self_np; |
ptrace |
pub const ptrace = darwin.ptrace; |
task_for_pid |
pub const task_for_pid = darwin.task_for_pid; |
task_get_exception_ports |
pub const task_get_exception_ports = darwin.task_get_exception_ports; |
task_info |
pub const task_info = darwin.task_info; |
task_info_t |
pub const task_info_t = darwin.task_info_t; |
task_resume |
pub const task_resume = darwin.task_resume; |
task_set_exception_ports |
pub const task_set_exception_ports = darwin.task_set_exception_ports; |
task_suspend |
pub const task_suspend = darwin.task_suspend; |
task_threads |
pub const task_threads = darwin.task_threads; |
task_vm_info_data_t |
pub const task_vm_info_data_t = darwin.task_vm_info_data_t; |
thread_basic_info |
pub const thread_basic_info = darwin.thread_basic_info; |
thread_get_state |
pub const thread_get_state = darwin.thread_get_state; |
thread_identifier_info |
pub const thread_identifier_info = darwin.thread_identifier_info; |
thread_info |
pub const thread_info = darwin.thread_info; |
thread_info_t |
pub const thread_info_t = darwin.thread_info_t; |
thread_resume |
pub const thread_resume = darwin.thread_resume; |
thread_set_state |
pub const thread_set_state = darwin.thread_set_state; |
vm_deallocate |
pub const vm_deallocate = darwin.vm_deallocate; |
vm_machine_attribute |
pub const vm_machine_attribute = darwin.vm_machine_attribute; |
vm_machine_attribute_val_t |
pub const vm_machine_attribute_val_t = darwin.vm_machine_attribute_val_t; |
vm_map_t |
pub const vm_map_t = darwin.vm_map_t; |
vm_offset_t |
pub const vm_offset_t = darwin.vm_offset_t; |
vm_prot_t |
pub const vm_prot_t = darwin.vm_prot_t; |
vm_region_basic_info_64 |
pub const vm_region_basic_info_64 = darwin.vm_region_basic_info_64; |
vm_region_extended_info |
pub const vm_region_extended_info = darwin.vm_region_extended_info; |
vm_region_info_t |
pub const vm_region_info_t = darwin.vm_region_info_t; |
vm_region_recurse_info_t |
pub const vm_region_recurse_info_t = darwin.vm_region_recurse_info_t; |
vm_region_submap_info_64 |
pub const vm_region_submap_info_64 = darwin.vm_region_submap_info_64; |
vm_region_submap_short_info_64 |
pub const vm_region_submap_short_info_64 = darwin.vm_region_submap_short_info_64; |
vm_region_top_info |
pub const vm_region_top_info = darwin.vm_region_top_info; |
caddr_t |
pub const caddr_t = darwin.caddr_t; |
exception_behavior_array_t |
pub const exception_behavior_array_t = darwin.exception_behavior_array_t; |
exception_behavior_t |
pub const exception_behavior_t = darwin.exception_behavior_t; |
exception_data_t |
pub const exception_data_t = darwin.exception_data_t; |
exception_data_type_t |
pub const exception_data_type_t = darwin.exception_data_type_t; |
exception_flavor_array_t |
pub const exception_flavor_array_t = darwin.exception_flavor_array_t; |
exception_handler_array_t |
pub const exception_handler_array_t = darwin.exception_handler_array_t; |
exception_handler_t |
pub const exception_handler_t = darwin.exception_handler_t; |
exception_mask_array_t |
pub const exception_mask_array_t = darwin.exception_mask_array_t; |
exception_mask_t |
pub const exception_mask_t = darwin.exception_mask_t; |
exception_port_array_t |
pub const exception_port_array_t = darwin.exception_port_array_t; |
exception_port_t |
pub const exception_port_t = darwin.exception_port_t; |
mach_exception_data_t |
pub const mach_exception_data_t = darwin.mach_exception_data_t; |
mach_exception_data_type_t |
pub const mach_exception_data_type_t = darwin.mach_exception_data_type_t; |
mach_msg_bits_t |
pub const mach_msg_bits_t = darwin.mach_msg_bits_t; |
mach_msg_id_t |
pub const mach_msg_id_t = darwin.mach_msg_id_t; |
mach_msg_option_t |
pub const mach_msg_option_t = darwin.mach_msg_option_t; |
mach_msg_size_t |
pub const mach_msg_size_t = darwin.mach_msg_size_t; |
mach_msg_timeout_t |
pub const mach_msg_timeout_t = darwin.mach_msg_timeout_t; |
mach_msg_type_name_t |
pub const mach_msg_type_name_t = darwin.mach_msg_type_name_t; |
mach_port_right_t |
pub const mach_port_right_t = darwin.mach_port_right_t; |
memory_object_offset_t |
pub const memory_object_offset_t = darwin.memory_object_offset_t; |
policy_t |
pub const policy_t = darwin.policy_t; |
task_policy_flavor_t |
pub const task_policy_flavor_t = darwin.task_policy_flavor_t; |
task_policy_t |
pub const task_policy_t = darwin.task_policy_t; |
task_t |
pub const task_t = darwin.task_t; |
thread_act_t |
pub const thread_act_t = darwin.thread_act_t; |
thread_flavor_t |
pub const thread_flavor_t = darwin.thread_flavor_t; |
thread_port_t |
pub const thread_port_t = darwin.thread_port_t; |
thread_state_flavor_t |
pub const thread_state_flavor_t = darwin.thread_state_flavor_t; |
thread_state_t |
pub const thread_state_t = darwin.thread_state_t; |
thread_t |
pub const thread_t = darwin.thread_t; |
time_value_t |
pub const time_value_t = darwin.time_value_t; |
vm32_object_id_t |
pub const vm32_object_id_t = darwin.vm32_object_id_t; |
vm_behavior_t |
pub const vm_behavior_t = darwin.vm_behavior_t; |
vm_inherit_t |
pub const vm_inherit_t = darwin.vm_inherit_t; |
vm_map_read_t |
pub const vm_map_read_t = darwin.vm_map_read_t; |
vm_object_id_t |
pub const vm_object_id_t = darwin.vm_object_id_t; |
vm_region_flavor_t |
pub const vm_region_flavor_t = darwin.vm_region_flavor_t; |
_ksiginfo |
pub const _ksiginfo = netbsd._ksiginfo; |
_lwp_self |
pub const _lwp_self = netbsd._lwp_self; |
lwpid_t |
pub const lwpid_t = netbsd.lwpid_t; |
lwp_gettid |
pub const lwp_gettid = dragonfly.lwp_gettid; |
umtx_sleep |
pub const umtx_sleep = dragonfly.umtx_sleep; |
umtx_wakeup |
pub const umtx_wakeup = dragonfly.umtx_wakeup; |
PERF_EVENT |
pub const PERF_EVENT = serenity.PERF_EVENT; |
disown |
pub const disown = serenity.disown; |
profiling_enable |
pub const profiling_enable = serenity.profiling_enable; |
profiling_disable |
pub const profiling_disable = serenity.profiling_disable; |
profiling_free_buffer |
pub const profiling_free_buffer = serenity.profiling_free_buffer; |
futex_wait |
pub const futex_wait = serenity.futex_wait; |
futex_wake |
pub const futex_wake = serenity.futex_wake; |
purge |
pub const purge = serenity.purge; |
perf_event |
pub const perf_event = serenity.perf_event; |
perf_register_string |
pub const perf_register_string = serenity.perf_register_string; |
get_stack_bounds |
pub const get_stack_bounds = serenity.get_stack_bounds; |
anon_create |
pub const anon_create = serenity.anon_create; |
serenity_readlink |
pub const serenity_readlink = serenity.serenity_readlink; |
serenity_open |
pub const serenity_open = serenity.serenity_open; |
getkeymap |
pub const getkeymap = serenity.getkeymap; |
setkeymap |
pub const setkeymap = serenity.setkeymap; /// External definitions shared by two or more operating systems. const private = struct { extern "c" fn close(fd: fd_t) c_int; extern "c" fn clock_getres(clk_id: clockid_t, tp: *timespec) c_int; extern "c" fn clock_gettime(clk_id: clockid_t, tp: *timespec) c_int; extern "c" fn copy_file_range(fd_in: fd_t, off_in: ?*i64, fd_out: fd_t, off_out: ?*i64, len: usize, flags: c_uint) isize; extern "c" fn flock(fd: fd_t, operation: c_int) c_int; extern "c" fn fork() c_int; extern "c" fn fstat(fd: fd_t, buf: *Stat) c_int; extern "c" fn fstatat(dirfd: fd_t, path: [*:0]const u8, buf: *Stat, flag: u32) c_int; extern "c" fn getdirentries(fd: fd_t, buf_ptr: [*]u8, nbytes: usize, basep: *i64) isize; extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) switch (native_os) { .freebsd => isize, .solaris, .illumos => usize, else => c_int, }; extern "c" fn getrusage(who: c_int, usage: *rusage) c_int; extern "c" fn gettimeofday(noalias tv: ?*timeval, noalias tz: ?*timezone) c_int; extern "c" fn msync(addr: *align(page_size) const anyopaque, len: usize, flags: c_int) c_int; extern "c" fn nanosleep(rqtp: *const timespec, rmtp: ?*timespec) c_int; extern "c" fn pipe2(fds: *[2]fd_t, flags: O) c_int; extern "c" fn readdir(dir: *DIR) ?*dirent; extern "c" fn realpath(noalias file_name: [*:0]const u8, noalias resolved_name: [*]u8) ?[*:0]u8; extern "c" fn sched_yield() c_int; extern "c" fn sendfile(out_fd: fd_t, in_fd: fd_t, offset: ?*off_t, count: usize) isize; extern "c" fn sigaction(sig: c_int, noalias act: ?*const Sigaction, noalias oact: ?*Sigaction) c_int; extern "c" fn sigdelset(set: ?*sigset_t, signo: c_int) c_int; extern "c" fn sigaddset(set: ?*sigset_t, signo: c_int) c_int; extern "c" fn sigfillset(set: ?*sigset_t) c_int; extern "c" fn sigemptyset(set: ?*sigset_t) c_int; extern "c" fn sigismember(set: ?*const sigset_t, signo: c_int) c_int; extern "c" fn sigprocmask(how: c_int, noalias set: ?*const sigset_t, noalias oset: ?*sigset_t) c_int; extern "c" fn socket(domain: c_uint, sock_type: c_uint, protocol: c_uint) c_int; extern "c" fn stat(noalias path: [*:0]const u8, noalias buf: *Stat) c_int; extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int; extern "c" fn sysconf(sc: c_int) c_long; extern "c" fn pthread_setname_np(thread: pthread_t, name: [*:0]const u8) c_int; extern "c" fn getcontext(ucp: *ucontext_t) c_int; extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize; extern "c" fn getentropy(buffer: [*]u8, size: usize) c_int; extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void; extern "c" fn _msize(?*const anyopaque) usize; extern "c" fn malloc_size(?*const anyopaque) usize; extern "c" fn malloc_usable_size(?*const anyopaque) usize; extern "c" fn posix_memalign(memptr: *?*anyopaque, alignment: usize, size: usize) c_int; /// macos modernized symbols. /// x86_64 links to $INODE64 suffix for 64-bit support. /// Note these are not necessary on aarch64. extern "c" fn @"fstat$INODE64"(fd: fd_t, buf: *Stat) c_int; extern "c" fn @"fstatat$INODE64"(dirfd: fd_t, path: [*:0]const u8, buf: *Stat, flag: u32) c_int; extern "c" fn @"readdir$INODE64"(dir: *DIR) ?*dirent; extern "c" fn @"stat$INODE64"(noalias path: [*:0]const u8, noalias buf: *Stat) c_int; /// macos modernized symbols. extern "c" fn @"realpath$DARWIN_EXTSN"(noalias file_name: [*:0]const u8, noalias resolved_name: [*]u8) ?[*:0]u8; extern "c" fn __getdirentries64(fd: fd_t, buf_ptr: [*]u8, buf_len: usize, basep: *i64) isize; extern "c" fn pthread_threadid_np(thread: ?pthread_t, thread_id: *u64) c_int; /// netbsd modernized symbols. extern "c" fn __clock_getres50(clk_id: clockid_t, tp: *timespec) c_int; extern "c" fn __clock_gettime50(clk_id: clockid_t, tp: *timespec) c_int; extern "c" fn __fstat50(fd: fd_t, buf: *Stat) c_int; extern "c" fn __getrusage50(who: c_int, usage: *rusage) c_int; extern "c" fn __gettimeofday50(noalias tv: ?*timeval, noalias tz: ?*timezone) c_int; extern "c" fn __libc_thr_yield() c_int; extern "c" fn __msync13(addr: *align(page_size) const anyopaque, len: usize, flags: c_int) c_int; extern "c" fn __nanosleep50(rqtp: *const timespec, rmtp: ?*timespec) c_int; extern "c" fn __sigaction14(sig: c_int, noalias act: ?*const Sigaction, noalias oact: ?*Sigaction) c_int; extern "c" fn __sigemptyset14(set: ?*sigset_t) c_int; extern "c" fn __sigfillset14(set: ?*sigset_t) c_int; extern "c" fn __sigprocmask14(how: c_int, noalias set: ?*const sigset_t, noalias oset: ?*sigset_t) c_int; extern "c" fn __socket30(domain: c_uint, sock_type: c_uint, protocol: c_uint) c_int; extern "c" fn __stat50(path: [*:0]const u8, buf: *Stat) c_int; extern "c" fn __getdents30(fd: c_int, buf_ptr: [*]u8, nbytes: usize) c_int; extern "c" fn __sigaltstack14(ss: ?*stack_t, old_ss: ?*stack_t) c_int; extern "c" fn __libc_current_sigrtmin() c_int; extern "c" fn __libc_current_sigrtmax() c_int; // Don't forget to add another clown when an OS picks yet another unique // symbol name for errno location! // 🤡🤡🤡🤡🤡🤡 extern "c" fn ___errno() *c_int; extern "c" fn __errno() *c_int; extern "c" fn __errno_location() *c_int; extern "c" fn __error() *c_int; extern "c" fn _errno() *c_int; extern threadlocal var errno: c_int; fn errnoFromThreadLocal() *c_int { return &errno; } }; |
Generated by zstd-live on 2025-08-12 12:37:55 UTC. |