srctree

Andrew Kelley parent ee36131e a60f2196 42fcca49
Merge pull request #18846 from ziglang/std.os.linux.MAP

std.os.MAP: use a packed struct

inlinesplit
lib/std/Thread.zig added: 320, removed: 358, total 0
@@ -1237,7 +1237,7 @@ const LinuxThreadImpl = struct {
null,
map_bytes,
os.PROT.NONE,
os.MAP.PRIVATE | os.MAP.ANONYMOUS,
.{ .TYPE = .PRIVATE, .ANONYMOUS = true },
-1,
0,
) catch |err| switch (err) {
 
lib/std/c.zig added: 320, removed: 358, total 0
@@ -45,6 +45,148 @@ pub usingnamespace switch (builtin.os.tag) {
else => struct {},
};
 
pub const MAP = switch (builtin.os.tag) {
.linux => std.os.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 => 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,
_11: u1 = 0,
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,
},
else => @compileError("target libc does not have MAP"),
};
 
/// Used by libc to communicate failure. Not actually part of the underlying syscall.
pub const MAP_FAILED: *anyopaque = @ptrFromInt(std.math.maxInt(usize));
 
pub const whence_t = if (builtin.os.tag == .wasi) std.os.wasi.whence_t else c_int;
 
// Unix-like systems
 
lib/std/c/darwin.zig added: 320, removed: 358, total 0
@@ -1310,26 +1310,6 @@ pub const PROT = struct {
pub const COPY: vm_prot_t = 0x10;
};
 
pub const MAP = struct {
/// allocated from memory, swap space
pub const ANONYMOUS = 0x1000;
/// map from file (default)
pub const FILE = 0x0000;
/// interpret addr exactly
pub const FIXED = 0x0010;
/// region may contain semaphores
pub const HASSEMAPHORE = 0x0200;
/// changes are private
pub const PRIVATE = 0x0002;
/// share changes
pub const SHARED = 0x0001;
/// don't cache pages for this mapping
pub const NOCACHE = 0x0400;
/// don't reserve needed swap area
pub const NORESERVE = 0x0040;
pub const FAILED = @as(*anyopaque, @ptrFromInt(maxInt(usize)));
};
 
pub const MSF = struct {
pub const ASYNC = 0x1;
pub const INVALIDATE = 0x2;
 
lib/std/c/dragonfly.zig added: 320, removed: 358, total 0
@@ -223,28 +223,6 @@ pub const PROT = struct {
pub const EXEC = 4;
};
 
pub const MAP = struct {
pub const FILE = 0;
pub const FAILED = @as(*anyopaque, @ptrFromInt(maxInt(usize)));
pub const ANONYMOUS = ANON;
pub const COPY = PRIVATE;
pub const SHARED = 1;
pub const PRIVATE = 2;
pub const FIXED = 16;
pub const RENAME = 32;
pub const NORESERVE = 64;
pub const INHERIT = 128;
pub const NOEXTEND = 256;
pub const HASSEMAPHORE = 512;
pub const STACK = 1024;
pub const NOSYNC = 2048;
pub const ANON = 4096;
pub const VPAGETABLE = 8192;
pub const TRYFIXED = 65536;
pub const NOCORE = 131072;
pub const SIZEALIGN = 262144;
};
 
pub const MSF = struct {
pub const ASYNC = 1;
pub const INVALIDATE = 2;
 
lib/std/c/emscripten.zig added: 320, removed: 358, total 0
@@ -16,11 +16,6 @@ pub const IOV_MAX = emscripten.IOV_MAX;
pub const IPPROTO = emscripten.IPPROTO;
pub const LOCK = emscripten.LOCK;
pub const MADV = emscripten.MADV;
pub const MAP = struct {
pub usingnamespace emscripten.MAP;
/// Only used by libc to communicate failure.
pub const FAILED = @as(*anyopaque, @ptrFromInt(maxInt(usize)));
};
pub const MSF = emscripten.MSF;
pub const MSG = emscripten.MSG;
pub const NAME_MAX = emscripten.NAME_MAX;
 
lib/std/c/freebsd.zig added: 320, removed: 358, total 0
@@ -606,29 +606,6 @@ pub const CLOCK = struct {
pub const PROCESS_CPUTIME_ID = 15;
};
 
pub const MAP = struct {
pub const FAILED = @as(*anyopaque, @ptrFromInt(maxInt(usize)));
pub const SHARED = 0x0001;
pub const PRIVATE = 0x0002;
pub const FIXED = 0x0010;
pub const STACK = 0x0400;
pub const NOSYNC = 0x0800;
pub const ANON = 0x1000;
pub const ANONYMOUS = ANON;
pub const FILE = 0;
 
pub const GUARD = 0x00002000;
pub const EXCL = 0x00004000;
pub const NOCORE = 0x00020000;
pub const PREFAULT_READ = 0x00040000;
pub const @"32BIT" = 0x00080000;
 
pub fn ALIGNED(alignment: u32) u32 {
return alignment << 24;
}
pub const ALIGNED_SUPER = ALIGNED(1);
};
 
pub const MADV = struct {
pub const NORMAL = 0;
pub const RANDOM = 1;
 
lib/std/c/haiku.zig added: 320, removed: 358, total 0
@@ -408,22 +408,6 @@ pub const CLOCK = struct {
pub const THREAD_CPUTIME_ID = -3;
};
 
pub const MAP = struct {
/// mmap() error return code
pub const FAILED = @as(*anyopaque, @ptrFromInt(maxInt(usize)));
/// changes are seen by others
pub const SHARED = 0x01;
/// changes are only seen by caller
pub const PRIVATE = 0x02;
/// require mapping to specified addr
pub const FIXED = 0x04;
/// no underlying object
pub const ANONYMOUS = 0x0008;
pub const ANON = ANONYMOUS;
/// don't commit memory
pub const NORESERVE = 0x10;
};
 
pub const MSF = struct {
pub const ASYNC = 1;
pub const INVALIDATE = 2;
 
lib/std/c/linux.zig added: 320, removed: 358, total 0
@@ -1,6 +1,5 @@
const std = @import("../std.zig");
const builtin = @import("builtin");
const maxInt = std.math.maxInt;
const native_abi = builtin.abi;
const native_arch = builtin.cpu.arch;
const linux = std.os.linux;
@@ -25,11 +24,6 @@ pub const IOV_MAX = linux.IOV_MAX;
pub const IPPROTO = linux.IPPROTO;
pub const LOCK = linux.LOCK;
pub const MADV = linux.MADV;
pub const MAP = struct {
pub usingnamespace linux.MAP;
/// Only used by libc to communicate failure.
pub const FAILED = @as(*anyopaque, @ptrFromInt(maxInt(usize)));
};
pub const MSF = linux.MSF;
pub const MMAP2_UNIT = linux.MMAP2_UNIT;
pub const MSG = linux.MSG;
 
lib/std/c/netbsd.zig added: 320, removed: 358, total 0
@@ -573,26 +573,6 @@ pub const CLOCK = struct {
pub const PROCESS_CPUTIME_ID = 0x40000000;
};
 
pub const MAP = struct {
pub const FAILED = @as(*anyopaque, @ptrFromInt(maxInt(usize)));
pub const SHARED = 0x0001;
pub const PRIVATE = 0x0002;
pub const REMAPDUP = 0x0004;
pub const FIXED = 0x0010;
pub const RENAME = 0x0020;
pub const NORESERVE = 0x0040;
pub const INHERIT = 0x0080;
pub const HASSEMAPHORE = 0x0200;
pub const TRYFIXED = 0x0400;
pub const WIRED = 0x0800;
 
pub const FILE = 0x0000;
pub const NOSYNC = 0x0800;
pub const ANON = 0x1000;
pub const ANONYMOUS = ANON;
pub const STACK = 0x2000;
};
 
pub const MSF = struct {
pub const ASYNC = 1;
pub const INVALIDATE = 2;
 
lib/std/c/openbsd.zig added: 320, removed: 358, total 0
@@ -436,24 +436,6 @@ pub const CLOCK = struct {
pub const THREAD_CPUTIME_ID = 4;
};
 
pub const MAP = struct {
pub const FAILED = @as(*anyopaque, @ptrFromInt(maxInt(usize)));
pub const SHARED = 0x0001;
pub const PRIVATE = 0x0002;
pub const FIXED = 0x0010;
pub const RENAME = 0;
pub const NORESERVE = 0;
pub const INHERIT = 0;
pub const HASSEMAPHORE = 0;
pub const TRYFIXED = 0;
 
pub const FILE = 0;
pub const ANON = 0x1000;
pub const ANONYMOUS = ANON;
pub const STACK = 0x4000;
pub const CONCEAL = 0x8000;
};
 
pub const MSF = struct {
pub const ASYNC = 1;
pub const INVALIDATE = 2;
 
lib/std/c/solaris.zig added: 320, removed: 358, total 0
@@ -523,27 +523,6 @@ pub const CLOCK = struct {
pub const PROF = THREAD_CPUTIME_ID;
};
 
pub const MAP = struct {
pub const FAILED = @as(*anyopaque, @ptrFromInt(maxInt(usize)));
pub const SHARED = 0x0001;
pub const PRIVATE = 0x0002;
pub const TYPE = 0x000f;
 
pub const FILE = 0x0000;
pub const FIXED = 0x0010;
// Unimplemented
pub const RENAME = 0x0020;
pub const NORESERVE = 0x0040;
/// Force mapping in lower 4G address space
pub const @"32BIT" = 0x0080;
 
pub const ANON = 0x0100;
pub const ANONYMOUS = ANON;
pub const ALIGN = 0x0200;
pub const TEXT = 0x0400;
pub const INITDATA = 0x0800;
};
 
pub const MSF = struct {
pub const ASYNC = 1;
pub const INVALIDATE = 2;
 
lib/std/crypto/tlcsprng.zig added: 320, removed: 358, total 0
@@ -83,7 +83,7 @@ fn tlsCsprngFill(_: *anyopaque, buffer: []u8) void {
null,
@sizeOf(Context),
os.PROT.READ | os.PROT.WRITE,
os.MAP.PRIVATE | os.MAP.ANONYMOUS,
.{ .TYPE = .PRIVATE, .ANONYMOUS = true },
-1,
0,
) catch {
 
lib/std/debug.zig added: 320, removed: 358, total 0
@@ -1652,7 +1652,7 @@ fn mapWholeFile(file: File) ![]align(mem.page_size) const u8 {
null,
file_len,
os.PROT.READ,
os.MAP.SHARED,
.{ .TYPE = .SHARED },
file.handle,
0,
);
 
lib/std/dynamic_library.zig added: 320, removed: 358, total 0
@@ -127,7 +127,7 @@ pub const ElfDynLib = struct {
null,
mem.alignForward(usize, size, mem.page_size),
os.PROT.READ,
os.MAP.PRIVATE,
.{ .TYPE = .PRIVATE },
fd,
0,
);
@@ -165,7 +165,7 @@ pub const ElfDynLib = struct {
null,
virt_addr_end,
os.PROT.NONE,
os.MAP.PRIVATE | os.MAP.ANONYMOUS,
.{ .TYPE = .PRIVATE, .ANONYMOUS = true },
-1,
0,
);
@@ -197,7 +197,7 @@ pub const ElfDynLib = struct {
ptr,
extended_memsz,
prot,
os.MAP.PRIVATE | os.MAP.FIXED,
.{ .TYPE = .PRIVATE, .FIXED = true },
fd,
ph.p_offset - extra_bytes,
);
@@ -206,7 +206,7 @@ pub const ElfDynLib = struct {
ptr,
extended_memsz,
prot,
os.MAP.PRIVATE | os.MAP.FIXED | os.MAP.ANONYMOUS,
.{ .TYPE = .PRIVATE, .FIXED = true, .ANONYMOUS = true },
-1,
0,
);
 
lib/std/heap/PageAllocator.zig added: 320, removed: 358, total 0
@@ -35,7 +35,7 @@ fn alloc(_: *anyopaque, n: usize, log2_align: u8, ra: usize) ?[*]u8 {
hint,
aligned_len,
os.PROT.READ | os.PROT.WRITE,
os.MAP.PRIVATE | os.MAP.ANONYMOUS,
.{ .TYPE = .PRIVATE, .ANONYMOUS = true },
-1,
0,
) catch return null;
 
lib/std/os.zig added: 320, removed: 358, total 0
@@ -4657,16 +4657,16 @@ pub fn mmap(
ptr: ?[*]align(mem.page_size) u8,
length: usize,
prot: u32,
flags: u32,
flags: system.MAP,
fd: fd_t,
offset: u64,
) MMapError![]align(mem.page_size) u8 {
const mmap_sym = if (lfs64_abi) system.mmap64 else system.mmap;
 
const ioffset = @as(i64, @bitCast(offset)); // the OS treats this as unsigned
const rc = mmap_sym(ptr, length, prot, flags, fd, ioffset);
const ioffset: i64 = @bitCast(offset); // the OS treats this as unsigned
const rc = mmap_sym(ptr, length, prot, @bitCast(flags), fd, ioffset);
const err = if (builtin.link_libc) blk: {
if (rc != std.c.MAP.FAILED) return @as([*]align(mem.page_size) u8, @ptrCast(@alignCast(rc)))[0..length];
if (rc != std.c.MAP_FAILED) return @as([*]align(mem.page_size) u8, @ptrCast(@alignCast(rc)))[0..length];
break :blk @as(E, @enumFromInt(system._errno().*));
} else blk: {
const err = errno(rc);
 
lib/std/os/emscripten.zig added: 320, removed: 358, total 0
@@ -449,27 +449,6 @@ pub const MADV = struct {
pub const SOFT_OFFLINE = 101;
};
 
pub const MAP = struct {
pub const SHARED = 0x01;
pub const PRIVATE = 0x02;
pub const SHARED_VALIDATE = 0x03;
pub const TYPE = 0x0f;
pub const FIXED = 0x10;
pub const ANON = 0x20;
pub const ANONYMOUS = ANON;
pub const NORESERVE = 0x4000;
pub const GROWSDOWN = 0x0100;
pub const DENYWRITE = 0x0800;
pub const EXECUTABLE = 0x1000;
pub const LOCKED = 0x2000;
pub const POPULATE = 0x8000;
pub const NONBLOCK = 0x10000;
pub const STACK = 0x20000;
pub const HUGETLB = 0x40000;
pub const SYNC = 0x80000;
pub const FIXED_NOREPLACE = 0x100000;
};
 
pub const MSF = struct {
pub const ASYNC = 1;
pub const INVALIDATE = 2;
 
lib/std/os/linux.zig added: 320, removed: 358, total 0
@@ -109,36 +109,136 @@ pub const SYS = switch (@import("builtin").cpu.arch) {
else => @compileError("The Zig Standard Library is missing syscall definitions for the target CPU architecture"),
};
 
pub const MAP = struct {
pub usingnamespace arch_bits.MAP;
pub const MAP_TYPE = enum(u4) {
SHARED = 0x01,
PRIVATE = 0x02,
SHARED_VALIDATE = 0x03,
};
 
/// Share changes
pub const SHARED = 0x01;
/// Changes are private
pub const PRIVATE = 0x02;
/// share + validate extension flags
pub const SHARED_VALIDATE = 0x03;
/// Mask for type of mapping
pub const TYPE = 0x0f;
/// Interpret addr exactly
pub const FIXED = 0x10;
/// don't use a file
pub const ANONYMOUS = if (is_mips) 0x800 else 0x20;
// MAP_ 0x0100 - 0x4000 flags are per architecture
/// populate (prefault) pagetables
pub const POPULATE = if (is_mips) 0x10000 else 0x8000;
/// do not block on IO
pub const NONBLOCK = if (is_mips) 0x20000 else 0x10000;
/// give out an address that is best suited for process/thread stacks
pub const STACK = if (is_mips) 0x40000 else 0x20000;
/// create a huge page mapping
pub const HUGETLB = if (is_mips) 0x80000 else 0x40000;
/// perform synchronous page faults for the mapping
pub const SYNC = 0x80000;
/// MAP_FIXED which doesn't unmap underlying mapping
pub const FIXED_NOREPLACE = 0x100000;
/// For anonymous mmap, memory could be uninitialized
pub const UNINITIALIZED = 0x4000000;
pub const MAP = switch (native_arch) {
.x86_64, .x86 => packed struct(u32) {
TYPE: MAP_TYPE,
FIXED: bool = false,
ANONYMOUS: bool = false,
@"32BIT": bool = false,
_7: u1 = 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,
_21: u5 = 0,
UNINITIALIZED: bool = false,
_: u5 = 0,
},
.aarch64, .aarch64_be, .arm, .thumb => packed struct(u32) {
TYPE: MAP_TYPE,
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,
_21: u5 = 0,
UNINITIALIZED: bool = false,
_: u5 = 0,
},
.riscv64 => packed struct(u32) {
TYPE: MAP_TYPE,
FIXED: bool = false,
ANONYMOUS: bool = false,
_6: u9 = 0,
POPULATE: bool = false,
NONBLOCK: bool = false,
STACK: bool = false,
HUGETLB: bool = false,
SYNC: bool = false,
FIXED_NOREPLACE: bool = false,
_21: u5 = 0,
UNINITIALIZED: bool = false,
_: u5 = 0,
},
.sparc64 => packed struct(u32) {
TYPE: MAP_TYPE,
FIXED: bool = false,
ANONYMOUS: bool = false,
NORESERVE: bool = false,
_7: u1 = 0,
LOCKED: bool = false,
GROWSDOWN: bool = false,
_10: u1 = 0,
DENYWRITE: bool = false,
EXECUTABLE: bool = false,
_13: u2 = 0,
POPULATE: bool = false,
NONBLOCK: bool = false,
STACK: bool = false,
HUGETLB: bool = false,
SYNC: bool = false,
FIXED_NOREPLACE: bool = false,
_21: u5 = 0,
UNINITIALIZED: bool = false,
_: u5 = 0,
},
.mips, .mipsel, .mips64, .mips64el => packed struct(u32) {
TYPE: MAP_TYPE,
FIXED: bool = false,
_5: u1 = 0,
@"32BIT": bool = false,
_7: u3 = 0,
NORESERVE: bool = false,
ANONYMOUS: bool = false,
GROWSDOWN: bool = false,
DENYWRITE: bool = false,
EXECUTABLE: bool = false,
LOCKED: bool = false,
POPULATE: bool = false,
NONBLOCK: bool = false,
STACK: bool = false,
HUGETLB: bool = false,
FIXED_NOREPLACE: bool = false,
_21: u5 = 0,
UNINITIALIZED: bool = false,
_: u5 = 0,
},
.powerpc, .powerpcle, .powerpc64, .powerpc64le => packed struct(u32) {
TYPE: MAP_TYPE,
FIXED: bool = false,
ANONYMOUS: bool = false,
NORESERVE: bool = false,
LOCKED: bool = false,
GROWSDOWN: bool = false,
_9: u2 = 0,
DENYWRITE: bool = false,
EXECUTABLE: bool = false,
_13: u2 = 0,
POPULATE: bool = false,
NONBLOCK: bool = false,
STACK: bool = false,
HUGETLB: bool = false,
SYNC: bool = false,
FIXED_NOREPLACE: bool = false,
_21: u5 = 0,
UNINITIALIZED: bool = false,
_: u5 = 0,
},
else => @compileError("missing std.os.linux.MAP constants for this architecture"),
};
 
pub const O = struct {
 
lib/std/os/linux/arm-eabi.zig added: 320, removed: 358, total 0
@@ -197,19 +197,6 @@ pub const LOCK = struct {
pub const NB = 4;
};
 
pub const MAP = struct {
/// stack-like segment
pub const GROWSDOWN = 0x0100;
/// ETXTBSY
pub const DENYWRITE = 0x0800;
/// mark it as an executable
pub const EXECUTABLE = 0x1000;
/// pages are locked
pub const LOCKED = 0x2000;
/// don't check for reservations
pub const NORESERVE = 0x4000;
};
 
pub const VDSO = struct {
pub const CGT_SYM = "__vdso_clock_gettime";
pub const CGT_VER = "LINUX_2.6";
 
lib/std/os/linux/arm64.zig added: 320, removed: 358, total 0
@@ -179,19 +179,6 @@ pub const LOCK = struct {
pub const NB = 4;
};
 
pub const MAP = struct {
/// stack-like segment
pub const GROWSDOWN = 0x0100;
/// ETXTBSY
pub const DENYWRITE = 0x0800;
/// mark it as an executable
pub const EXECUTABLE = 0x1000;
/// pages are locked
pub const LOCKED = 0x2000;
/// don't check for reservations
pub const NORESERVE = 0x4000;
};
 
pub const VDSO = struct {
pub const CGT_SYM = "__kernel_clock_gettime";
pub const CGT_VER = "LINUX_2.6.39";
 
lib/std/os/linux/io_uring.zig added: 320, removed: 358, total 0
@@ -1344,7 +1344,7 @@ pub const SubmissionQueue = struct {
null,
size,
os.PROT.READ | os.PROT.WRITE,
os.MAP.SHARED | os.MAP.POPULATE,
.{ .TYPE = .SHARED, .POPULATE = true },
fd,
linux.IORING_OFF_SQ_RING,
);
@@ -1358,7 +1358,7 @@ pub const SubmissionQueue = struct {
null,
size_sqes,
os.PROT.READ | os.PROT.WRITE,
os.MAP.SHARED | os.MAP.POPULATE,
.{ .TYPE = .SHARED, .POPULATE = true },
fd,
linux.IORING_OFF_SQES,
);
 
lib/std/os/linux/mips.zig added: 320, removed: 358, total 0
@@ -271,15 +271,6 @@ pub const LOCK = struct {
 
pub const MMAP2_UNIT = 4096;
 
pub const MAP = struct {
pub const NORESERVE = 0x0400;
pub const GROWSDOWN = 0x1000;
pub const DENYWRITE = 0x2000;
pub const EXECUTABLE = 0x4000;
pub const LOCKED = 0x8000;
pub const @"32BIT" = 0x40;
};
 
pub const VDSO = struct {
pub const CGT_SYM = "__kernel_clock_gettime";
pub const CGT_VER = "LINUX_2.6.39";
 
lib/std/os/linux/mips64.zig added: 320, removed: 358, total 0
@@ -256,15 +256,6 @@ pub const LOCK = struct {
 
pub const MMAP2_UNIT = 4096;
 
pub const MAP = struct {
pub const NORESERVE = 0x0400;
pub const GROWSDOWN = 0x1000;
pub const DENYWRITE = 0x2000;
pub const EXECUTABLE = 0x4000;
pub const LOCKED = 0x8000;
pub const @"32BIT" = 0x40;
};
 
pub const VDSO = struct {
pub const CGT_SYM = "__kernel_clock_gettime";
pub const CGT_VER = "LINUX_2.6.39";
 
lib/std/os/linux/powerpc.zig added: 320, removed: 358, total 0
@@ -198,19 +198,6 @@ pub const LOCK = struct {
pub const NB = 4;
};
 
pub const MAP = struct {
/// stack-like segment
pub const GROWSDOWN = 0x0100;
/// ETXTBSY
pub const DENYWRITE = 0x0800;
/// mark it as an executable
pub const EXECUTABLE = 0x1000;
/// pages are locked
pub const LOCKED = 0x0080;
/// don't check for reservations
pub const NORESERVE = 0x0040;
};
 
pub const VDSO = struct {
pub const CGT_SYM = "__kernel_clock_gettime";
pub const CGT_VER = "LINUX_2.6.15";
 
lib/std/os/linux/powerpc64.zig added: 320, removed: 358, total 0
@@ -198,19 +198,6 @@ pub const LOCK = struct {
pub const NB = 4;
};
 
pub const MAP = struct {
/// stack-like segment
pub const GROWSDOWN = 0x0100;
/// ETXTBSY
pub const DENYWRITE = 0x0800;
/// mark it as an executable
pub const EXECUTABLE = 0x1000;
/// pages are locked
pub const LOCKED = 0x0080;
/// don't check for reservations
pub const NORESERVE = 0x0040;
};
 
pub const VDSO = struct {
pub const CGT_SYM = "__kernel_clock_gettime";
pub const CGT_VER = "LINUX_2.6.15";
 
lib/std/os/linux/riscv64.zig added: 320, removed: 358, total 0
@@ -246,4 +246,3 @@ pub const Stat = extern struct {
pub const Elf_Symndx = u32;
 
pub const VDSO = struct {};
pub const MAP = struct {};
 
lib/std/os/linux/sparc64.zig added: 320, removed: 358, total 0
@@ -248,19 +248,6 @@ pub const LOCK = struct {
pub const UN = 8;
};
 
pub const MAP = struct {
/// stack-like segment
pub const GROWSDOWN = 0x0200;
/// ETXTBSY
pub const DENYWRITE = 0x0800;
/// mark it as an executable
pub const EXECUTABLE = 0x1000;
/// pages are locked
pub const LOCKED = 0x0100;
/// don't check for reservations
pub const NORESERVE = 0x0040;
};
 
pub const VDSO = struct {
pub const CGT_SYM = "__vdso_clock_gettime";
pub const CGT_VER = "LINUX_2.6";
 
lib/std/os/linux/tls.zig added: 320, removed: 358, total 0
@@ -324,7 +324,7 @@ pub fn initStaticTLS(phdrs: []elf.Phdr) void {
null,
tls_image.alloc_size + tls_image.alloc_align - 1,
os.PROT.READ | os.PROT.WRITE,
os.MAP.PRIVATE | os.MAP.ANONYMOUS,
.{ .TYPE = .PRIVATE, .ANONYMOUS = true },
-1,
0,
) catch os.abort();
 
lib/std/os/linux/x86.zig added: 320, removed: 358, total 0
@@ -211,15 +211,6 @@ pub const LOCK = struct {
pub const UN = 8;
};
 
pub const MAP = struct {
pub const NORESERVE = 0x4000;
pub const GROWSDOWN = 0x0100;
pub const DENYWRITE = 0x0800;
pub const EXECUTABLE = 0x1000;
pub const LOCKED = 0x2000;
pub const @"32BIT" = 0x40;
};
 
pub const MMAP2_UNIT = 4096;
 
pub const VDSO = struct {
 
lib/std/os/linux/x86_64.zig added: 320, removed: 358, total 0
@@ -177,21 +177,6 @@ pub const F = struct {
pub const UNLCK = 2;
};
 
pub const MAP = struct {
/// only give out 32bit addresses
pub const @"32BIT" = 0x40;
/// stack-like segment
pub const GROWSDOWN = 0x0100;
/// ETXTBSY
pub const DENYWRITE = 0x0800;
/// mark it as an executable
pub const EXECUTABLE = 0x1000;
/// pages are locked
pub const LOCKED = 0x2000;
/// don't check for reservations
pub const NORESERVE = 0x4000;
};
 
pub const VDSO = struct {
pub const CGT_SYM = "__vdso_clock_gettime";
pub const CGT_VER = "LINUX_2.6";
 
lib/std/os/test.zig added: 320, removed: 358, total 0
@@ -576,7 +576,7 @@ test "mmap" {
null,
1234,
os.PROT.READ | os.PROT.WRITE,
os.MAP.ANONYMOUS | os.MAP.PRIVATE,
.{ .TYPE = .PRIVATE, .ANONYMOUS = true },
-1,
0,
);
@@ -618,7 +618,7 @@ test "mmap" {
null,
alloc_size,
os.PROT.READ,
os.MAP.PRIVATE,
.{ .TYPE = .PRIVATE },
file.handle,
0,
);
@@ -642,7 +642,7 @@ test "mmap" {
null,
alloc_size / 2,
os.PROT.READ,
os.MAP.PRIVATE,
.{ .TYPE = .PRIVATE },
file.handle,
alloc_size / 2,
);