Source
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) {
FILE: bool = false,
SHARED: bool = false,
PRIVATE: bool = false,
_3: u2 = 0,
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) - 12) = 0,
},
else => void,
}