| author | |
| committer | |
| log | 42fcca49c55eb9250a9ac8868fa6a9201dd9eb7e |
| tree | 11e6fa39875109b709dac3e8ee33cab91cad70c1 |
| parent | ee36131e6a8bf8611f8a6fd55116e98eae2ed63c |
| parent | a60f219660c5973c12987149c48ce9febf3c2b24 |
| signature |
std.os.MAP: use a packed struct31 files changed, 290 insertions(+), 328 deletions(-)
lib/std/Thread.zig+1-1| ... | @@ -1237,7 +1237,7 @@ const LinuxThreadImpl = struct { | ... | @@ -1237,7 +1237,7 @@ const LinuxThreadImpl = struct { |
| 1237 | null, | 1237 | null, |
| 1238 | map_bytes, | 1238 | map_bytes, |
| 1239 | os.PROT.NONE, | 1239 | os.PROT.NONE, |
| 1240 | os.MAP.PRIVATE | os.MAP.ANONYMOUS, | 1240 | .{ .TYPE = .PRIVATE, .ANONYMOUS = true }, |
| 1241 | -1, | 1241 | -1, |
| 1242 | 0, | 1242 | 0, |
| 1243 | ) catch |err| switch (err) { | 1243 | ) catch |err| switch (err) { |
lib/std/c.zig+142| ... | @@ -45,6 +45,148 @@ pub usingnamespace switch (builtin.os.tag) { | ... | @@ -45,6 +45,148 @@ pub usingnamespace switch (builtin.os.tag) { |
| 45 | else => struct {}, | 45 | else => struct {}, |
| 46 | }; | 46 | }; |
| 47 | 47 | ||
| 48 | pub const MAP = switch (builtin.os.tag) { | ||
| 49 | .linux => std.os.linux.MAP, | ||
| 50 | .emscripten => packed struct(u32) { | ||
| 51 | TYPE: enum(u4) { | ||
| 52 | SHARED = 0x01, | ||
| 53 | PRIVATE = 0x02, | ||
| 54 | SHARED_VALIDATE = 0x03, | ||
| 55 | }, | ||
| 56 | FIXED: bool = false, | ||
| 57 | ANONYMOUS: bool = false, | ||
| 58 | _6: u2 = 0, | ||
| 59 | GROWSDOWN: bool = false, | ||
| 60 | _9: u2 = 0, | ||
| 61 | DENYWRITE: bool = false, | ||
| 62 | EXECUTABLE: bool = false, | ||
| 63 | LOCKED: bool = false, | ||
| 64 | NORESERVE: bool = false, | ||
| 65 | POPULATE: bool = false, | ||
| 66 | NONBLOCK: bool = false, | ||
| 67 | STACK: bool = false, | ||
| 68 | HUGETLB: bool = false, | ||
| 69 | SYNC: bool = false, | ||
| 70 | FIXED_NOREPLACE: bool = false, | ||
| 71 | _: u11 = 0, | ||
| 72 | }, | ||
| 73 | .solaris, .illumos => packed struct(u32) { | ||
| 74 | TYPE: enum(u4) { | ||
| 75 | SHARED = 0x01, | ||
| 76 | PRIVATE = 0x02, | ||
| 77 | }, | ||
| 78 | FIXED: bool = false, | ||
| 79 | RENAME: bool = false, | ||
| 80 | NORESERVE: bool = false, | ||
| 81 | @"32BIT": bool = false, | ||
| 82 | ANONYMOUS: bool = false, | ||
| 83 | ALIGN: bool = false, | ||
| 84 | TEXT: bool = false, | ||
| 85 | INITDATA: bool = false, | ||
| 86 | _: u20 = 0, | ||
| 87 | }, | ||
| 88 | .netbsd => packed struct(u32) { | ||
| 89 | TYPE: enum(u2) { | ||
| 90 | SHARED = 0x01, | ||
| 91 | PRIVATE = 0x02, | ||
| 92 | }, | ||
| 93 | REMAPDUP: bool = false, | ||
| 94 | _3: u1 = 0, | ||
| 95 | FIXED: bool = false, | ||
| 96 | RENAME: bool = false, | ||
| 97 | NORESERVE: bool = false, | ||
| 98 | INHERIT: bool = false, | ||
| 99 | _8: u1 = 0, | ||
| 100 | HASSEMAPHORE: bool = false, | ||
| 101 | TRYFIXED: bool = false, | ||
| 102 | WIRED: bool = false, | ||
| 103 | ANONYMOUS: bool = false, | ||
| 104 | STACK: bool = false, | ||
| 105 | _: u18 = 0, | ||
| 106 | }, | ||
| 107 | .openbsd => packed struct(u32) { | ||
| 108 | TYPE: enum(u4) { | ||
| 109 | SHARED = 0x01, | ||
| 110 | PRIVATE = 0x02, | ||
| 111 | }, | ||
| 112 | FIXED: bool = false, | ||
| 113 | _5: u7 = 0, | ||
| 114 | ANONYMOUS: bool = false, | ||
| 115 | _13: u1 = 0, | ||
| 116 | STACK: bool = false, | ||
| 117 | CONCEAL: bool = false, | ||
| 118 | _: u16 = 0, | ||
| 119 | }, | ||
| 120 | .haiku => packed struct(u32) { | ||
| 121 | TYPE: enum(u2) { | ||
| 122 | SHARED = 0x01, | ||
| 123 | PRIVATE = 0x02, | ||
| 124 | }, | ||
| 125 | FIXED: bool = false, | ||
| 126 | ANONYMOUS: bool = false, | ||
| 127 | NORESERVE: bool = false, | ||
| 128 | _: u27 = 0, | ||
| 129 | }, | ||
| 130 | .macos, .ios, .tvos, .watchos => packed struct(u32) { | ||
| 131 | TYPE: enum(u4) { | ||
| 132 | SHARED = 0x01, | ||
| 133 | PRIVATE = 0x02, | ||
| 134 | }, | ||
| 135 | FIXED: bool = false, | ||
| 136 | _5: u1 = 0, | ||
| 137 | NORESERVE: bool = false, | ||
| 138 | _7: u2 = 0, | ||
| 139 | HASSEMAPHORE: bool = false, | ||
| 140 | NOCACHE: bool = false, | ||
| 141 | _11: u1 = 0, | ||
| 142 | ANONYMOUS: bool = false, | ||
| 143 | _: u19 = 0, | ||
| 144 | }, | ||
| 145 | .dragonfly => packed struct(u32) { | ||
| 146 | TYPE: enum(u4) { | ||
| 147 | SHARED = 0x01, | ||
| 148 | PRIVATE = 0x02, | ||
| 149 | }, | ||
| 150 | FIXED: bool = false, | ||
| 151 | RENAME: bool = false, | ||
| 152 | NORESERVE: bool = false, | ||
| 153 | INHERIT: bool = false, | ||
| 154 | NOEXTEND: bool = false, | ||
| 155 | HASSEMAPHORE: bool = false, | ||
| 156 | STACK: bool = false, | ||
| 157 | NOSYNC: bool = false, | ||
| 158 | ANONYMOUS: bool = false, | ||
| 159 | VPAGETABLE: bool = false, | ||
| 160 | _14: u2 = 0, | ||
| 161 | TRYFIXED: bool = false, | ||
| 162 | NOCORE: bool = false, | ||
| 163 | SIZEALIGN: bool = false, | ||
| 164 | _: u13 = 0, | ||
| 165 | }, | ||
| 166 | .freebsd => packed struct(u32) { | ||
| 167 | TYPE: enum(u4) { | ||
| 168 | SHARED = 0x01, | ||
| 169 | PRIVATE = 0x02, | ||
| 170 | }, | ||
| 171 | FIXED: bool = false, | ||
| 172 | _5: u5 = 0, | ||
| 173 | STACK: bool = false, | ||
| 174 | NOSYNC: bool = false, | ||
| 175 | ANONYMOUS: bool = false, | ||
| 176 | GUARD: bool = false, | ||
| 177 | EXCL: bool = false, | ||
| 178 | _15: u2 = 0, | ||
| 179 | NOCORE: bool = false, | ||
| 180 | PREFAULT_READ: bool = false, | ||
| 181 | @"32BIT": bool = false, | ||
| 182 | _: u12 = 0, | ||
| 183 | }, | ||
| 184 | else => @compileError("target libc does not have MAP"), | ||
| 185 | }; | ||
| 186 | |||
| 187 | /// Used by libc to communicate failure. Not actually part of the underlying syscall. | ||
| 188 | pub const MAP_FAILED: *anyopaque = @ptrFromInt(std.math.maxInt(usize)); | ||
| 189 | |||
| 48 | pub const whence_t = if (builtin.os.tag == .wasi) std.os.wasi.whence_t else c_int; | 190 | pub const whence_t = if (builtin.os.tag == .wasi) std.os.wasi.whence_t else c_int; |
| 49 | 191 | ||
| 50 | // Unix-like systems | 192 | // Unix-like systems |
lib/std/c/darwin.zig-20| ... | @@ -1310,26 +1310,6 @@ pub const PROT = struct { | ... | @@ -1310,26 +1310,6 @@ pub const PROT = struct { |
| 1310 | pub const COPY: vm_prot_t = 0x10; | 1310 | pub const COPY: vm_prot_t = 0x10; |
| 1311 | }; | 1311 | }; |
| 1312 | 1312 | ||
| 1313 | pub const MAP = struct { | ||
| 1314 | /// allocated from memory, swap space | ||
| 1315 | pub const ANONYMOUS = 0x1000; | ||
| 1316 | /// map from file (default) | ||
| 1317 | pub const FILE = 0x0000; | ||
| 1318 | /// interpret addr exactly | ||
| 1319 | pub const FIXED = 0x0010; | ||
| 1320 | /// region may contain semaphores | ||
| 1321 | pub const HASSEMAPHORE = 0x0200; | ||
| 1322 | /// changes are private | ||
| 1323 | pub const PRIVATE = 0x0002; | ||
| 1324 | /// share changes | ||
| 1325 | pub const SHARED = 0x0001; | ||
| 1326 | /// don't cache pages for this mapping | ||
| 1327 | pub const NOCACHE = 0x0400; | ||
| 1328 | /// don't reserve needed swap area | ||
| 1329 | pub const NORESERVE = 0x0040; | ||
| 1330 | pub const FAILED = @as(*anyopaque, @ptrFromInt(maxInt(usize))); | ||
| 1331 | }; | ||
| 1332 | |||
| 1333 | pub const MSF = struct { | 1313 | pub const MSF = struct { |
| 1334 | pub const ASYNC = 0x1; | 1314 | pub const ASYNC = 0x1; |
| 1335 | pub const INVALIDATE = 0x2; | 1315 | pub const INVALIDATE = 0x2; |
lib/std/c/dragonfly.zig-22| ... | @@ -223,28 +223,6 @@ pub const PROT = struct { | ... | @@ -223,28 +223,6 @@ pub const PROT = struct { |
| 223 | pub const EXEC = 4; | 223 | pub const EXEC = 4; |
| 224 | }; | 224 | }; |
| 225 | 225 | ||
| 226 | pub const MAP = struct { | ||
| 227 | pub const FILE = 0; | ||
| 228 | pub const FAILED = @as(*anyopaque, @ptrFromInt(maxInt(usize))); | ||
| 229 | pub const ANONYMOUS = ANON; | ||
| 230 | pub const COPY = PRIVATE; | ||
| 231 | pub const SHARED = 1; | ||
| 232 | pub const PRIVATE = 2; | ||
| 233 | pub const FIXED = 16; | ||
| 234 | pub const RENAME = 32; | ||
| 235 | pub const NORESERVE = 64; | ||
| 236 | pub const INHERIT = 128; | ||
| 237 | pub const NOEXTEND = 256; | ||
| 238 | pub const HASSEMAPHORE = 512; | ||
| 239 | pub const STACK = 1024; | ||
| 240 | pub const NOSYNC = 2048; | ||
| 241 | pub const ANON = 4096; | ||
| 242 | pub const VPAGETABLE = 8192; | ||
| 243 | pub const TRYFIXED = 65536; | ||
| 244 | pub const NOCORE = 131072; | ||
| 245 | pub const SIZEALIGN = 262144; | ||
| 246 | }; | ||
| 247 | |||
| 248 | pub const MSF = struct { | 226 | pub const MSF = struct { |
| 249 | pub const ASYNC = 1; | 227 | pub const ASYNC = 1; |
| 250 | pub const INVALIDATE = 2; | 228 | pub const INVALIDATE = 2; |
lib/std/c/emscripten.zig-5| ... | @@ -16,11 +16,6 @@ pub const IOV_MAX = emscripten.IOV_MAX; | ... | @@ -16,11 +16,6 @@ pub const IOV_MAX = emscripten.IOV_MAX; |
| 16 | pub const IPPROTO = emscripten.IPPROTO; | 16 | pub const IPPROTO = emscripten.IPPROTO; |
| 17 | pub const LOCK = emscripten.LOCK; | 17 | pub const LOCK = emscripten.LOCK; |
| 18 | pub const MADV = emscripten.MADV; | 18 | pub const MADV = emscripten.MADV; |
| 19 | pub const MAP = struct { | ||
| 20 | pub usingnamespace emscripten.MAP; | ||
| 21 | /// Only used by libc to communicate failure. | ||
| 22 | pub const FAILED = @as(*anyopaque, @ptrFromInt(maxInt(usize))); | ||
| 23 | }; | ||
| 24 | pub const MSF = emscripten.MSF; | 19 | pub const MSF = emscripten.MSF; |
| 25 | pub const MSG = emscripten.MSG; | 20 | pub const MSG = emscripten.MSG; |
| 26 | pub const NAME_MAX = emscripten.NAME_MAX; | 21 | pub const NAME_MAX = emscripten.NAME_MAX; |
lib/std/c/freebsd.zig-23| ... | @@ -606,29 +606,6 @@ pub const CLOCK = struct { | ... | @@ -606,29 +606,6 @@ pub const CLOCK = struct { |
| 606 | pub const PROCESS_CPUTIME_ID = 15; | 606 | pub const PROCESS_CPUTIME_ID = 15; |
| 607 | }; | 607 | }; |
| 608 | 608 | ||
| 609 | pub const MAP = struct { | ||
| 610 | pub const FAILED = @as(*anyopaque, @ptrFromInt(maxInt(usize))); | ||
| 611 | pub const SHARED = 0x0001; | ||
| 612 | pub const PRIVATE = 0x0002; | ||
| 613 | pub const FIXED = 0x0010; | ||
| 614 | pub const STACK = 0x0400; | ||
| 615 | pub const NOSYNC = 0x0800; | ||
| 616 | pub const ANON = 0x1000; | ||
| 617 | pub const ANONYMOUS = ANON; | ||
| 618 | pub const FILE = 0; | ||
| 619 | |||
| 620 | pub const GUARD = 0x00002000; | ||
| 621 | pub const EXCL = 0x00004000; | ||
| 622 | pub const NOCORE = 0x00020000; | ||
| 623 | pub const PREFAULT_READ = 0x00040000; | ||
| 624 | pub const @"32BIT" = 0x00080000; | ||
| 625 | |||
| 626 | pub fn ALIGNED(alignment: u32) u32 { | ||
| 627 | return alignment << 24; | ||
| 628 | } | ||
| 629 | pub const ALIGNED_SUPER = ALIGNED(1); | ||
| 630 | }; | ||
| 631 | |||
| 632 | pub const MADV = struct { | 609 | pub const MADV = struct { |
| 633 | pub const NORMAL = 0; | 610 | pub const NORMAL = 0; |
| 634 | pub const RANDOM = 1; | 611 | pub const RANDOM = 1; |
lib/std/c/haiku.zig-16| ... | @@ -408,22 +408,6 @@ pub const CLOCK = struct { | ... | @@ -408,22 +408,6 @@ pub const CLOCK = struct { |
| 408 | pub const THREAD_CPUTIME_ID = -3; | 408 | pub const THREAD_CPUTIME_ID = -3; |
| 409 | }; | 409 | }; |
| 410 | 410 | ||
| 411 | pub const MAP = struct { | ||
| 412 | /// mmap() error return code | ||
| 413 | pub const FAILED = @as(*anyopaque, @ptrFromInt(maxInt(usize))); | ||
| 414 | /// changes are seen by others | ||
| 415 | pub const SHARED = 0x01; | ||
| 416 | /// changes are only seen by caller | ||
| 417 | pub const PRIVATE = 0x02; | ||
| 418 | /// require mapping to specified addr | ||
| 419 | pub const FIXED = 0x04; | ||
| 420 | /// no underlying object | ||
| 421 | pub const ANONYMOUS = 0x0008; | ||
| 422 | pub const ANON = ANONYMOUS; | ||
| 423 | /// don't commit memory | ||
| 424 | pub const NORESERVE = 0x10; | ||
| 425 | }; | ||
| 426 | |||
| 427 | pub const MSF = struct { | 411 | pub const MSF = struct { |
| 428 | pub const ASYNC = 1; | 412 | pub const ASYNC = 1; |
| 429 | pub const INVALIDATE = 2; | 413 | pub const INVALIDATE = 2; |
lib/std/c/linux.zig-6| ... | @@ -1,6 +1,5 @@ | ... | @@ -1,6 +1,5 @@ |
| 1 | const std = @import("../std.zig"); | 1 | const std = @import("../std.zig"); |
| 2 | const builtin = @import("builtin"); | 2 | const builtin = @import("builtin"); |
| 3 | const maxInt = std.math.maxInt; | ||
| 4 | const native_abi = builtin.abi; | 3 | const native_abi = builtin.abi; |
| 5 | const native_arch = builtin.cpu.arch; | 4 | const native_arch = builtin.cpu.arch; |
| 6 | const linux = std.os.linux; | 5 | const linux = std.os.linux; |
| ... | @@ -25,11 +24,6 @@ pub const IOV_MAX = linux.IOV_MAX; | ... | @@ -25,11 +24,6 @@ pub const IOV_MAX = linux.IOV_MAX; |
| 25 | pub const IPPROTO = linux.IPPROTO; | 24 | pub const IPPROTO = linux.IPPROTO; |
| 26 | pub const LOCK = linux.LOCK; | 25 | pub const LOCK = linux.LOCK; |
| 27 | pub const MADV = linux.MADV; | 26 | pub const MADV = linux.MADV; |
| 28 | pub const MAP = struct { | ||
| 29 | pub usingnamespace linux.MAP; | ||
| 30 | /// Only used by libc to communicate failure. | ||
| 31 | pub const FAILED = @as(*anyopaque, @ptrFromInt(maxInt(usize))); | ||
| 32 | }; | ||
| 33 | pub const MSF = linux.MSF; | 27 | pub const MSF = linux.MSF; |
| 34 | pub const MMAP2_UNIT = linux.MMAP2_UNIT; | 28 | pub const MMAP2_UNIT = linux.MMAP2_UNIT; |
| 35 | pub const MSG = linux.MSG; | 29 | pub const MSG = linux.MSG; |
lib/std/c/netbsd.zig-20| ... | @@ -573,26 +573,6 @@ pub const CLOCK = struct { | ... | @@ -573,26 +573,6 @@ pub const CLOCK = struct { |
| 573 | pub const PROCESS_CPUTIME_ID = 0x40000000; | 573 | pub const PROCESS_CPUTIME_ID = 0x40000000; |
| 574 | }; | 574 | }; |
| 575 | 575 | ||
| 576 | pub const MAP = struct { | ||
| 577 | pub const FAILED = @as(*anyopaque, @ptrFromInt(maxInt(usize))); | ||
| 578 | pub const SHARED = 0x0001; | ||
| 579 | pub const PRIVATE = 0x0002; | ||
| 580 | pub const REMAPDUP = 0x0004; | ||
| 581 | pub const FIXED = 0x0010; | ||
| 582 | pub const RENAME = 0x0020; | ||
| 583 | pub const NORESERVE = 0x0040; | ||
| 584 | pub const INHERIT = 0x0080; | ||
| 585 | pub const HASSEMAPHORE = 0x0200; | ||
| 586 | pub const TRYFIXED = 0x0400; | ||
| 587 | pub const WIRED = 0x0800; | ||
| 588 | |||
| 589 | pub const FILE = 0x0000; | ||
| 590 | pub const NOSYNC = 0x0800; | ||
| 591 | pub const ANON = 0x1000; | ||
| 592 | pub const ANONYMOUS = ANON; | ||
| 593 | pub const STACK = 0x2000; | ||
| 594 | }; | ||
| 595 | |||
| 596 | pub const MSF = struct { | 576 | pub const MSF = struct { |
| 597 | pub const ASYNC = 1; | 577 | pub const ASYNC = 1; |
| 598 | pub const INVALIDATE = 2; | 578 | pub const INVALIDATE = 2; |
lib/std/c/openbsd.zig-18| ... | @@ -436,24 +436,6 @@ pub const CLOCK = struct { | ... | @@ -436,24 +436,6 @@ pub const CLOCK = struct { |
| 436 | pub const THREAD_CPUTIME_ID = 4; | 436 | pub const THREAD_CPUTIME_ID = 4; |
| 437 | }; | 437 | }; |
| 438 | 438 | ||
| 439 | pub const MAP = struct { | ||
| 440 | pub const FAILED = @as(*anyopaque, @ptrFromInt(maxInt(usize))); | ||
| 441 | pub const SHARED = 0x0001; | ||
| 442 | pub const PRIVATE = 0x0002; | ||
| 443 | pub const FIXED = 0x0010; | ||
| 444 | pub const RENAME = 0; | ||
| 445 | pub const NORESERVE = 0; | ||
| 446 | pub const INHERIT = 0; | ||
| 447 | pub const HASSEMAPHORE = 0; | ||
| 448 | pub const TRYFIXED = 0; | ||
| 449 | |||
| 450 | pub const FILE = 0; | ||
| 451 | pub const ANON = 0x1000; | ||
| 452 | pub const ANONYMOUS = ANON; | ||
| 453 | pub const STACK = 0x4000; | ||
| 454 | pub const CONCEAL = 0x8000; | ||
| 455 | }; | ||
| 456 | |||
| 457 | pub const MSF = struct { | 439 | pub const MSF = struct { |
| 458 | pub const ASYNC = 1; | 440 | pub const ASYNC = 1; |
| 459 | pub const INVALIDATE = 2; | 441 | pub const INVALIDATE = 2; |
lib/std/c/solaris.zig-21| ... | @@ -523,27 +523,6 @@ pub const CLOCK = struct { | ... | @@ -523,27 +523,6 @@ pub const CLOCK = struct { |
| 523 | pub const PROF = THREAD_CPUTIME_ID; | 523 | pub const PROF = THREAD_CPUTIME_ID; |
| 524 | }; | 524 | }; |
| 525 | 525 | ||
| 526 | pub const MAP = struct { | ||
| 527 | pub const FAILED = @as(*anyopaque, @ptrFromInt(maxInt(usize))); | ||
| 528 | pub const SHARED = 0x0001; | ||
| 529 | pub const PRIVATE = 0x0002; | ||
| 530 | pub const TYPE = 0x000f; | ||
| 531 | |||
| 532 | pub const FILE = 0x0000; | ||
| 533 | pub const FIXED = 0x0010; | ||
| 534 | // Unimplemented | ||
| 535 | pub const RENAME = 0x0020; | ||
| 536 | pub const NORESERVE = 0x0040; | ||
| 537 | /// Force mapping in lower 4G address space | ||
| 538 | pub const @"32BIT" = 0x0080; | ||
| 539 | |||
| 540 | pub const ANON = 0x0100; | ||
| 541 | pub const ANONYMOUS = ANON; | ||
| 542 | pub const ALIGN = 0x0200; | ||
| 543 | pub const TEXT = 0x0400; | ||
| 544 | pub const INITDATA = 0x0800; | ||
| 545 | }; | ||
| 546 | |||
| 547 | pub const MSF = struct { | 526 | pub const MSF = struct { |
| 548 | pub const ASYNC = 1; | 527 | pub const ASYNC = 1; |
| 549 | pub const INVALIDATE = 2; | 528 | pub const INVALIDATE = 2; |
lib/std/crypto/tlcsprng.zig+1-1| ... | @@ -83,7 +83,7 @@ fn tlsCsprngFill(_: *anyopaque, buffer: []u8) void { | ... | @@ -83,7 +83,7 @@ fn tlsCsprngFill(_: *anyopaque, buffer: []u8) void { |
| 83 | null, | 83 | null, |
| 84 | @sizeOf(Context), | 84 | @sizeOf(Context), |
| 85 | os.PROT.READ | os.PROT.WRITE, | 85 | os.PROT.READ | os.PROT.WRITE, |
| 86 | os.MAP.PRIVATE | os.MAP.ANONYMOUS, | 86 | .{ .TYPE = .PRIVATE, .ANONYMOUS = true }, |
| 87 | -1, | 87 | -1, |
| 88 | 0, | 88 | 0, |
| 89 | ) catch { | 89 | ) catch { |
lib/std/debug.zig+1-1| ... | @@ -1652,7 +1652,7 @@ fn mapWholeFile(file: File) ![]align(mem.page_size) const u8 { | ... | @@ -1652,7 +1652,7 @@ fn mapWholeFile(file: File) ![]align(mem.page_size) const u8 { |
| 1652 | null, | 1652 | null, |
| 1653 | file_len, | 1653 | file_len, |
| 1654 | os.PROT.READ, | 1654 | os.PROT.READ, |
| 1655 | os.MAP.SHARED, | 1655 | .{ .TYPE = .SHARED }, |
| 1656 | file.handle, | 1656 | file.handle, |
| 1657 | 0, | 1657 | 0, |
| 1658 | ); | 1658 | ); |
lib/std/dynamic_library.zig+4-4| ... | @@ -127,7 +127,7 @@ pub const ElfDynLib = struct { | ... | @@ -127,7 +127,7 @@ pub const ElfDynLib = struct { |
| 127 | null, | 127 | null, |
| 128 | mem.alignForward(usize, size, mem.page_size), | 128 | mem.alignForward(usize, size, mem.page_size), |
| 129 | os.PROT.READ, | 129 | os.PROT.READ, |
| 130 | os.MAP.PRIVATE, | 130 | .{ .TYPE = .PRIVATE }, |
| 131 | fd, | 131 | fd, |
| 132 | 0, | 132 | 0, |
| 133 | ); | 133 | ); |
| ... | @@ -165,7 +165,7 @@ pub const ElfDynLib = struct { | ... | @@ -165,7 +165,7 @@ pub const ElfDynLib = struct { |
| 165 | null, | 165 | null, |
| 166 | virt_addr_end, | 166 | virt_addr_end, |
| 167 | os.PROT.NONE, | 167 | os.PROT.NONE, |
| 168 | os.MAP.PRIVATE | os.MAP.ANONYMOUS, | 168 | .{ .TYPE = .PRIVATE, .ANONYMOUS = true }, |
| 169 | -1, | 169 | -1, |
| 170 | 0, | 170 | 0, |
| 171 | ); | 171 | ); |
| ... | @@ -197,7 +197,7 @@ pub const ElfDynLib = struct { | ... | @@ -197,7 +197,7 @@ pub const ElfDynLib = struct { |
| 197 | ptr, | 197 | ptr, |
| 198 | extended_memsz, | 198 | extended_memsz, |
| 199 | prot, | 199 | prot, |
| 200 | os.MAP.PRIVATE | os.MAP.FIXED, | 200 | .{ .TYPE = .PRIVATE, .FIXED = true }, |
| 201 | fd, | 201 | fd, |
| 202 | ph.p_offset - extra_bytes, | 202 | ph.p_offset - extra_bytes, |
| 203 | ); | 203 | ); |
| ... | @@ -206,7 +206,7 @@ pub const ElfDynLib = struct { | ... | @@ -206,7 +206,7 @@ pub const ElfDynLib = struct { |
| 206 | ptr, | 206 | ptr, |
| 207 | extended_memsz, | 207 | extended_memsz, |
| 208 | prot, | 208 | prot, |
| 209 | os.MAP.PRIVATE | os.MAP.FIXED | os.MAP.ANONYMOUS, | 209 | .{ .TYPE = .PRIVATE, .FIXED = true, .ANONYMOUS = true }, |
| 210 | -1, | 210 | -1, |
| 211 | 0, | 211 | 0, |
| 212 | ); | 212 | ); |
lib/std/heap/PageAllocator.zig+1-1| ... | @@ -35,7 +35,7 @@ fn alloc(_: *anyopaque, n: usize, log2_align: u8, ra: usize) ?[*]u8 { | ... | @@ -35,7 +35,7 @@ fn alloc(_: *anyopaque, n: usize, log2_align: u8, ra: usize) ?[*]u8 { |
| 35 | hint, | 35 | hint, |
| 36 | aligned_len, | 36 | aligned_len, |
| 37 | os.PROT.READ | os.PROT.WRITE, | 37 | os.PROT.READ | os.PROT.WRITE, |
| 38 | os.MAP.PRIVATE | os.MAP.ANONYMOUS, | 38 | .{ .TYPE = .PRIVATE, .ANONYMOUS = true }, |
| 39 | -1, | 39 | -1, |
| 40 | 0, | 40 | 0, |
| 41 | ) catch return null; | 41 | ) catch return null; |
lib/std/os.zig+4-4| ... | @@ -4657,16 +4657,16 @@ pub fn mmap( | ... | @@ -4657,16 +4657,16 @@ pub fn mmap( |
| 4657 | ptr: ?[*]align(mem.page_size) u8, | 4657 | ptr: ?[*]align(mem.page_size) u8, |
| 4658 | length: usize, | 4658 | length: usize, |
| 4659 | prot: u32, | 4659 | prot: u32, |
| 4660 | flags: u32, | 4660 | flags: system.MAP, |
| 4661 | fd: fd_t, | 4661 | fd: fd_t, |
| 4662 | offset: u64, | 4662 | offset: u64, |
| 4663 | ) MMapError![]align(mem.page_size) u8 { | 4663 | ) MMapError![]align(mem.page_size) u8 { |
| 4664 | const mmap_sym = if (lfs64_abi) system.mmap64 else system.mmap; | 4664 | const mmap_sym = if (lfs64_abi) system.mmap64 else system.mmap; |
| 4665 | 4665 | ||
| 4666 | const ioffset = @as(i64, @bitCast(offset)); // the OS treats this as unsigned | 4666 | const ioffset: i64 = @bitCast(offset); // the OS treats this as unsigned |
| 4667 | const rc = mmap_sym(ptr, length, prot, flags, fd, ioffset); | 4667 | const rc = mmap_sym(ptr, length, prot, @bitCast(flags), fd, ioffset); |
| 4668 | const err = if (builtin.link_libc) blk: { | 4668 | const err = if (builtin.link_libc) blk: { |
| 4669 | if (rc != std.c.MAP.FAILED) return @as([*]align(mem.page_size) u8, @ptrCast(@alignCast(rc)))[0..length]; | 4669 | if (rc != std.c.MAP_FAILED) return @as([*]align(mem.page_size) u8, @ptrCast(@alignCast(rc)))[0..length]; |
| 4670 | break :blk @as(E, @enumFromInt(system._errno().*)); | 4670 | break :blk @as(E, @enumFromInt(system._errno().*)); |
| 4671 | } else blk: { | 4671 | } else blk: { |
| 4672 | const err = errno(rc); | 4672 | const err = errno(rc); |
lib/std/os/emscripten.zig-21| ... | @@ -449,27 +449,6 @@ pub const MADV = struct { | ... | @@ -449,27 +449,6 @@ pub const MADV = struct { |
| 449 | pub const SOFT_OFFLINE = 101; | 449 | pub const SOFT_OFFLINE = 101; |
| 450 | }; | 450 | }; |
| 451 | 451 | ||
| 452 | pub const MAP = struct { | ||
| 453 | pub const SHARED = 0x01; | ||
| 454 | pub const PRIVATE = 0x02; | ||
| 455 | pub const SHARED_VALIDATE = 0x03; | ||
| 456 | pub const TYPE = 0x0f; | ||
| 457 | pub const FIXED = 0x10; | ||
| 458 | pub const ANON = 0x20; | ||
| 459 | pub const ANONYMOUS = ANON; | ||
| 460 | pub const NORESERVE = 0x4000; | ||
| 461 | pub const GROWSDOWN = 0x0100; | ||
| 462 | pub const DENYWRITE = 0x0800; | ||
| 463 | pub const EXECUTABLE = 0x1000; | ||
| 464 | pub const LOCKED = 0x2000; | ||
| 465 | pub const POPULATE = 0x8000; | ||
| 466 | pub const NONBLOCK = 0x10000; | ||
| 467 | pub const STACK = 0x20000; | ||
| 468 | pub const HUGETLB = 0x40000; | ||
| 469 | pub const SYNC = 0x80000; | ||
| 470 | pub const FIXED_NOREPLACE = 0x100000; | ||
| 471 | }; | ||
| 472 | |||
| 473 | pub const MSF = struct { | 452 | pub const MSF = struct { |
| 474 | pub const ASYNC = 1; | 453 | pub const ASYNC = 1; |
| 475 | pub const INVALIDATE = 2; | 454 | pub const INVALIDATE = 2; |
lib/std/os/linux.zig+130-30| ... | @@ -109,36 +109,136 @@ pub const SYS = switch (@import("builtin").cpu.arch) { | ... | @@ -109,36 +109,136 @@ pub const SYS = switch (@import("builtin").cpu.arch) { |
| 109 | else => @compileError("The Zig Standard Library is missing syscall definitions for the target CPU architecture"), | 109 | else => @compileError("The Zig Standard Library is missing syscall definitions for the target CPU architecture"), |
| 110 | }; | 110 | }; |
| 111 | 111 | ||
| 112 | pub const MAP = struct { | 112 | pub const MAP_TYPE = enum(u4) { |
| 113 | pub usingnamespace arch_bits.MAP; | 113 | SHARED = 0x01, |
| 114 | 114 | PRIVATE = 0x02, | |
| 115 | /// Share changes | 115 | SHARED_VALIDATE = 0x03, |
| 116 | pub const SHARED = 0x01; | 116 | }; |
| 117 | /// Changes are private | 117 | |
| 118 | pub const PRIVATE = 0x02; | 118 | pub const MAP = switch (native_arch) { |
| 119 | /// share + validate extension flags | 119 | .x86_64, .x86 => packed struct(u32) { |
| 120 | pub const SHARED_VALIDATE = 0x03; | 120 | TYPE: MAP_TYPE, |
| 121 | /// Mask for type of mapping | 121 | FIXED: bool = false, |
| 122 | pub const TYPE = 0x0f; | 122 | ANONYMOUS: bool = false, |
| 123 | /// Interpret addr exactly | 123 | @"32BIT": bool = false, |
| 124 | pub const FIXED = 0x10; | 124 | _7: u1 = 0, |
| 125 | /// don't use a file | 125 | GROWSDOWN: bool = false, |
| 126 | pub const ANONYMOUS = if (is_mips) 0x800 else 0x20; | 126 | _9: u2 = 0, |
| 127 | // MAP_ 0x0100 - 0x4000 flags are per architecture | 127 | DENYWRITE: bool = false, |
| 128 | /// populate (prefault) pagetables | 128 | EXECUTABLE: bool = false, |
| 129 | pub const POPULATE = if (is_mips) 0x10000 else 0x8000; | 129 | LOCKED: bool = false, |
| 130 | /// do not block on IO | 130 | NORESERVE: bool = false, |
| 131 | pub const NONBLOCK = if (is_mips) 0x20000 else 0x10000; | 131 | POPULATE: bool = false, |
| 132 | /// give out an address that is best suited for process/thread stacks | 132 | NONBLOCK: bool = false, |
| 133 | pub const STACK = if (is_mips) 0x40000 else 0x20000; | 133 | STACK: bool = false, |
| 134 | /// create a huge page mapping | 134 | HUGETLB: bool = false, |
| 135 | pub const HUGETLB = if (is_mips) 0x80000 else 0x40000; | 135 | SYNC: bool = false, |
| 136 | /// perform synchronous page faults for the mapping | 136 | FIXED_NOREPLACE: bool = false, |
| 137 | pub const SYNC = 0x80000; | 137 | _21: u5 = 0, |
| 138 | /// MAP_FIXED which doesn't unmap underlying mapping | 138 | UNINITIALIZED: bool = false, |
| 139 | pub const FIXED_NOREPLACE = 0x100000; | 139 | _: u5 = 0, |
| 140 | /// For anonymous mmap, memory could be uninitialized | 140 | }, |
| 141 | pub const UNINITIALIZED = 0x4000000; | 141 | .aarch64, .aarch64_be, .arm, .thumb => packed struct(u32) { |
| 142 | TYPE: MAP_TYPE, | ||
| 143 | FIXED: bool = false, | ||
| 144 | ANONYMOUS: bool = false, | ||
| 145 | _6: u2 = 0, | ||
| 146 | GROWSDOWN: bool = false, | ||
| 147 | _9: u2 = 0, | ||
| 148 | DENYWRITE: bool = false, | ||
| 149 | EXECUTABLE: bool = false, | ||
| 150 | LOCKED: bool = false, | ||
| 151 | NORESERVE: bool = false, | ||
| 152 | POPULATE: bool = false, | ||
| 153 | NONBLOCK: bool = false, | ||
| 154 | STACK: bool = false, | ||
| 155 | HUGETLB: bool = false, | ||
| 156 | SYNC: bool = false, | ||
| 157 | FIXED_NOREPLACE: bool = false, | ||
| 158 | _21: u5 = 0, | ||
| 159 | UNINITIALIZED: bool = false, | ||
| 160 | _: u5 = 0, | ||
| 161 | }, | ||
| 162 | .riscv64 => packed struct(u32) { | ||
| 163 | TYPE: MAP_TYPE, | ||
| 164 | FIXED: bool = false, | ||
| 165 | ANONYMOUS: bool = false, | ||
| 166 | _6: u9 = 0, | ||
| 167 | POPULATE: bool = false, | ||
| 168 | NONBLOCK: bool = false, | ||
| 169 | STACK: bool = false, | ||
| 170 | HUGETLB: bool = false, | ||
| 171 | SYNC: bool = false, | ||
| 172 | FIXED_NOREPLACE: bool = false, | ||
| 173 | _21: u5 = 0, | ||
| 174 | UNINITIALIZED: bool = false, | ||
| 175 | _: u5 = 0, | ||
| 176 | }, | ||
| 177 | .sparc64 => packed struct(u32) { | ||
| 178 | TYPE: MAP_TYPE, | ||
| 179 | FIXED: bool = false, | ||
| 180 | ANONYMOUS: bool = false, | ||
| 181 | NORESERVE: bool = false, | ||
| 182 | _7: u1 = 0, | ||
| 183 | LOCKED: bool = false, | ||
| 184 | GROWSDOWN: bool = false, | ||
| 185 | _10: u1 = 0, | ||
| 186 | DENYWRITE: bool = false, | ||
| 187 | EXECUTABLE: bool = false, | ||
| 188 | _13: u2 = 0, | ||
| 189 | POPULATE: bool = false, | ||
| 190 | NONBLOCK: bool = false, | ||
| 191 | STACK: bool = false, | ||
| 192 | HUGETLB: bool = false, | ||
| 193 | SYNC: bool = false, | ||
| 194 | FIXED_NOREPLACE: bool = false, | ||
| 195 | _21: u5 = 0, | ||
| 196 | UNINITIALIZED: bool = false, | ||
| 197 | _: u5 = 0, | ||
| 198 | }, | ||
| 199 | .mips, .mipsel, .mips64, .mips64el => packed struct(u32) { | ||
| 200 | TYPE: MAP_TYPE, | ||
| 201 | FIXED: bool = false, | ||
| 202 | _5: u1 = 0, | ||
| 203 | @"32BIT": bool = false, | ||
| 204 | _7: u3 = 0, | ||
| 205 | NORESERVE: bool = false, | ||
| 206 | ANONYMOUS: bool = false, | ||
| 207 | GROWSDOWN: bool = false, | ||
| 208 | DENYWRITE: bool = false, | ||
| 209 | EXECUTABLE: bool = false, | ||
| 210 | LOCKED: bool = false, | ||
| 211 | POPULATE: bool = false, | ||
| 212 | NONBLOCK: bool = false, | ||
| 213 | STACK: bool = false, | ||
| 214 | HUGETLB: bool = false, | ||
| 215 | FIXED_NOREPLACE: bool = false, | ||
| 216 | _21: u5 = 0, | ||
| 217 | UNINITIALIZED: bool = false, | ||
| 218 | _: u5 = 0, | ||
| 219 | }, | ||
| 220 | .powerpc, .powerpcle, .powerpc64, .powerpc64le => packed struct(u32) { | ||
| 221 | TYPE: MAP_TYPE, | ||
| 222 | FIXED: bool = false, | ||
| 223 | ANONYMOUS: bool = false, | ||
| 224 | NORESERVE: bool = false, | ||
| 225 | LOCKED: bool = false, | ||
| 226 | GROWSDOWN: bool = false, | ||
| 227 | _9: u2 = 0, | ||
| 228 | DENYWRITE: bool = false, | ||
| 229 | EXECUTABLE: bool = false, | ||
| 230 | _13: u2 = 0, | ||
| 231 | POPULATE: bool = false, | ||
| 232 | NONBLOCK: bool = false, | ||
| 233 | STACK: bool = false, | ||
| 234 | HUGETLB: bool = false, | ||
| 235 | SYNC: bool = false, | ||
| 236 | FIXED_NOREPLACE: bool = false, | ||
| 237 | _21: u5 = 0, | ||
| 238 | UNINITIALIZED: bool = false, | ||
| 239 | _: u5 = 0, | ||
| 240 | }, | ||
| 241 | else => @compileError("missing std.os.linux.MAP constants for this architecture"), | ||
| 142 | }; | 242 | }; |
| 143 | 243 | ||
| 144 | pub const O = struct { | 244 | pub const O = struct { |
lib/std/os/linux/arm-eabi.zig-13| ... | @@ -197,19 +197,6 @@ pub const LOCK = struct { | ... | @@ -197,19 +197,6 @@ pub const LOCK = struct { |
| 197 | pub const NB = 4; | 197 | pub const NB = 4; |
| 198 | }; | 198 | }; |
| 199 | 199 | ||
| 200 | pub const MAP = struct { | ||
| 201 | /// stack-like segment | ||
| 202 | pub const GROWSDOWN = 0x0100; | ||
| 203 | /// ETXTBSY | ||
| 204 | pub const DENYWRITE = 0x0800; | ||
| 205 | /// mark it as an executable | ||
| 206 | pub const EXECUTABLE = 0x1000; | ||
| 207 | /// pages are locked | ||
| 208 | pub const LOCKED = 0x2000; | ||
| 209 | /// don't check for reservations | ||
| 210 | pub const NORESERVE = 0x4000; | ||
| 211 | }; | ||
| 212 | |||
| 213 | pub const VDSO = struct { | 200 | pub const VDSO = struct { |
| 214 | pub const CGT_SYM = "__vdso_clock_gettime"; | 201 | pub const CGT_SYM = "__vdso_clock_gettime"; |
| 215 | pub const CGT_VER = "LINUX_2.6"; | 202 | pub const CGT_VER = "LINUX_2.6"; |
lib/std/os/linux/arm64.zig-13| ... | @@ -179,19 +179,6 @@ pub const LOCK = struct { | ... | @@ -179,19 +179,6 @@ pub const LOCK = struct { |
| 179 | pub const NB = 4; | 179 | pub const NB = 4; |
| 180 | }; | 180 | }; |
| 181 | 181 | ||
| 182 | pub const MAP = struct { | ||
| 183 | /// stack-like segment | ||
| 184 | pub const GROWSDOWN = 0x0100; | ||
| 185 | /// ETXTBSY | ||
| 186 | pub const DENYWRITE = 0x0800; | ||
| 187 | /// mark it as an executable | ||
| 188 | pub const EXECUTABLE = 0x1000; | ||
| 189 | /// pages are locked | ||
| 190 | pub const LOCKED = 0x2000; | ||
| 191 | /// don't check for reservations | ||
| 192 | pub const NORESERVE = 0x4000; | ||
| 193 | }; | ||
| 194 | |||
| 195 | pub const VDSO = struct { | 182 | pub const VDSO = struct { |
| 196 | pub const CGT_SYM = "__kernel_clock_gettime"; | 183 | pub const CGT_SYM = "__kernel_clock_gettime"; |
| 197 | pub const CGT_VER = "LINUX_2.6.39"; | 184 | pub const CGT_VER = "LINUX_2.6.39"; |
lib/std/os/linux/io_uring.zig+2-2| ... | @@ -1344,7 +1344,7 @@ pub const SubmissionQueue = struct { | ... | @@ -1344,7 +1344,7 @@ pub const SubmissionQueue = struct { |
| 1344 | null, | 1344 | null, |
| 1345 | size, | 1345 | size, |
| 1346 | os.PROT.READ | os.PROT.WRITE, | 1346 | os.PROT.READ | os.PROT.WRITE, |
| 1347 | os.MAP.SHARED | os.MAP.POPULATE, | 1347 | .{ .TYPE = .SHARED, .POPULATE = true }, |
| 1348 | fd, | 1348 | fd, |
| 1349 | linux.IORING_OFF_SQ_RING, | 1349 | linux.IORING_OFF_SQ_RING, |
| 1350 | ); | 1350 | ); |
| ... | @@ -1358,7 +1358,7 @@ pub const SubmissionQueue = struct { | ... | @@ -1358,7 +1358,7 @@ pub const SubmissionQueue = struct { |
| 1358 | null, | 1358 | null, |
| 1359 | size_sqes, | 1359 | size_sqes, |
| 1360 | os.PROT.READ | os.PROT.WRITE, | 1360 | os.PROT.READ | os.PROT.WRITE, |
| 1361 | os.MAP.SHARED | os.MAP.POPULATE, | 1361 | .{ .TYPE = .SHARED, .POPULATE = true }, |
| 1362 | fd, | 1362 | fd, |
| 1363 | linux.IORING_OFF_SQES, | 1363 | linux.IORING_OFF_SQES, |
| 1364 | ); | 1364 | ); |
lib/std/os/linux/mips.zig-9| ... | @@ -271,15 +271,6 @@ pub const LOCK = struct { | ... | @@ -271,15 +271,6 @@ pub const LOCK = struct { |
| 271 | 271 | ||
| 272 | pub const MMAP2_UNIT = 4096; | 272 | pub const MMAP2_UNIT = 4096; |
| 273 | 273 | ||
| 274 | pub const MAP = struct { | ||
| 275 | pub const NORESERVE = 0x0400; | ||
| 276 | pub const GROWSDOWN = 0x1000; | ||
| 277 | pub const DENYWRITE = 0x2000; | ||
| 278 | pub const EXECUTABLE = 0x4000; | ||
| 279 | pub const LOCKED = 0x8000; | ||
| 280 | pub const @"32BIT" = 0x40; | ||
| 281 | }; | ||
| 282 | |||
| 283 | pub const VDSO = struct { | 274 | pub const VDSO = struct { |
| 284 | pub const CGT_SYM = "__kernel_clock_gettime"; | 275 | pub const CGT_SYM = "__kernel_clock_gettime"; |
| 285 | pub const CGT_VER = "LINUX_2.6.39"; | 276 | pub const CGT_VER = "LINUX_2.6.39"; |
lib/std/os/linux/mips64.zig-9| ... | @@ -256,15 +256,6 @@ pub const LOCK = struct { | ... | @@ -256,15 +256,6 @@ pub const LOCK = struct { |
| 256 | 256 | ||
| 257 | pub const MMAP2_UNIT = 4096; | 257 | pub const MMAP2_UNIT = 4096; |
| 258 | 258 | ||
| 259 | pub const MAP = struct { | ||
| 260 | pub const NORESERVE = 0x0400; | ||
| 261 | pub const GROWSDOWN = 0x1000; | ||
| 262 | pub const DENYWRITE = 0x2000; | ||
| 263 | pub const EXECUTABLE = 0x4000; | ||
| 264 | pub const LOCKED = 0x8000; | ||
| 265 | pub const @"32BIT" = 0x40; | ||
| 266 | }; | ||
| 267 | |||
| 268 | pub const VDSO = struct { | 259 | pub const VDSO = struct { |
| 269 | pub const CGT_SYM = "__kernel_clock_gettime"; | 260 | pub const CGT_SYM = "__kernel_clock_gettime"; |
| 270 | pub const CGT_VER = "LINUX_2.6.39"; | 261 | pub const CGT_VER = "LINUX_2.6.39"; |
lib/std/os/linux/powerpc.zig-13| ... | @@ -198,19 +198,6 @@ pub const LOCK = struct { | ... | @@ -198,19 +198,6 @@ pub const LOCK = struct { |
| 198 | pub const NB = 4; | 198 | pub const NB = 4; |
| 199 | }; | 199 | }; |
| 200 | 200 | ||
| 201 | pub const MAP = struct { | ||
| 202 | /// stack-like segment | ||
| 203 | pub const GROWSDOWN = 0x0100; | ||
| 204 | /// ETXTBSY | ||
| 205 | pub const DENYWRITE = 0x0800; | ||
| 206 | /// mark it as an executable | ||
| 207 | pub const EXECUTABLE = 0x1000; | ||
| 208 | /// pages are locked | ||
| 209 | pub const LOCKED = 0x0080; | ||
| 210 | /// don't check for reservations | ||
| 211 | pub const NORESERVE = 0x0040; | ||
| 212 | }; | ||
| 213 | |||
| 214 | pub const VDSO = struct { | 201 | pub const VDSO = struct { |
| 215 | pub const CGT_SYM = "__kernel_clock_gettime"; | 202 | pub const CGT_SYM = "__kernel_clock_gettime"; |
| 216 | pub const CGT_VER = "LINUX_2.6.15"; | 203 | pub const CGT_VER = "LINUX_2.6.15"; |
lib/std/os/linux/powerpc64.zig-13| ... | @@ -198,19 +198,6 @@ pub const LOCK = struct { | ... | @@ -198,19 +198,6 @@ pub const LOCK = struct { |
| 198 | pub const NB = 4; | 198 | pub const NB = 4; |
| 199 | }; | 199 | }; |
| 200 | 200 | ||
| 201 | pub const MAP = struct { | ||
| 202 | /// stack-like segment | ||
| 203 | pub const GROWSDOWN = 0x0100; | ||
| 204 | /// ETXTBSY | ||
| 205 | pub const DENYWRITE = 0x0800; | ||
| 206 | /// mark it as an executable | ||
| 207 | pub const EXECUTABLE = 0x1000; | ||
| 208 | /// pages are locked | ||
| 209 | pub const LOCKED = 0x0080; | ||
| 210 | /// don't check for reservations | ||
| 211 | pub const NORESERVE = 0x0040; | ||
| 212 | }; | ||
| 213 | |||
| 214 | pub const VDSO = struct { | 201 | pub const VDSO = struct { |
| 215 | pub const CGT_SYM = "__kernel_clock_gettime"; | 202 | pub const CGT_SYM = "__kernel_clock_gettime"; |
| 216 | pub const CGT_VER = "LINUX_2.6.15"; | 203 | pub const CGT_VER = "LINUX_2.6.15"; |
lib/std/os/linux/riscv64.zig-1| ... | @@ -246,4 +246,3 @@ pub const Stat = extern struct { | ... | @@ -246,4 +246,3 @@ pub const Stat = extern struct { |
| 246 | pub const Elf_Symndx = u32; | 246 | pub const Elf_Symndx = u32; |
| 247 | 247 | ||
| 248 | pub const VDSO = struct {}; | 248 | pub const VDSO = struct {}; |
| 249 | pub const MAP = struct {}; |
lib/std/os/linux/sparc64.zig-13| ... | @@ -248,19 +248,6 @@ pub const LOCK = struct { | ... | @@ -248,19 +248,6 @@ pub const LOCK = struct { |
| 248 | pub const UN = 8; | 248 | pub const UN = 8; |
| 249 | }; | 249 | }; |
| 250 | 250 | ||
| 251 | pub const MAP = struct { | ||
| 252 | /// stack-like segment | ||
| 253 | pub const GROWSDOWN = 0x0200; | ||
| 254 | /// ETXTBSY | ||
| 255 | pub const DENYWRITE = 0x0800; | ||
| 256 | /// mark it as an executable | ||
| 257 | pub const EXECUTABLE = 0x1000; | ||
| 258 | /// pages are locked | ||
| 259 | pub const LOCKED = 0x0100; | ||
| 260 | /// don't check for reservations | ||
| 261 | pub const NORESERVE = 0x0040; | ||
| 262 | }; | ||
| 263 | |||
| 264 | pub const VDSO = struct { | 251 | pub const VDSO = struct { |
| 265 | pub const CGT_SYM = "__vdso_clock_gettime"; | 252 | pub const CGT_SYM = "__vdso_clock_gettime"; |
| 266 | pub const CGT_VER = "LINUX_2.6"; | 253 | pub const CGT_VER = "LINUX_2.6"; |
lib/std/os/linux/tls.zig+1-1| ... | @@ -324,7 +324,7 @@ pub fn initStaticTLS(phdrs: []elf.Phdr) void { | ... | @@ -324,7 +324,7 @@ pub fn initStaticTLS(phdrs: []elf.Phdr) void { |
| 324 | null, | 324 | null, |
| 325 | tls_image.alloc_size + tls_image.alloc_align - 1, | 325 | tls_image.alloc_size + tls_image.alloc_align - 1, |
| 326 | os.PROT.READ | os.PROT.WRITE, | 326 | os.PROT.READ | os.PROT.WRITE, |
| 327 | os.MAP.PRIVATE | os.MAP.ANONYMOUS, | 327 | .{ .TYPE = .PRIVATE, .ANONYMOUS = true }, |
| 328 | -1, | 328 | -1, |
| 329 | 0, | 329 | 0, |
| 330 | ) catch os.abort(); | 330 | ) catch os.abort(); |
lib/std/os/linux/x86.zig-9| ... | @@ -211,15 +211,6 @@ pub const LOCK = struct { | ... | @@ -211,15 +211,6 @@ pub const LOCK = struct { |
| 211 | pub const UN = 8; | 211 | pub const UN = 8; |
| 212 | }; | 212 | }; |
| 213 | 213 | ||
| 214 | pub const MAP = struct { | ||
| 215 | pub const NORESERVE = 0x4000; | ||
| 216 | pub const GROWSDOWN = 0x0100; | ||
| 217 | pub const DENYWRITE = 0x0800; | ||
| 218 | pub const EXECUTABLE = 0x1000; | ||
| 219 | pub const LOCKED = 0x2000; | ||
| 220 | pub const @"32BIT" = 0x40; | ||
| 221 | }; | ||
| 222 | |||
| 223 | pub const MMAP2_UNIT = 4096; | 214 | pub const MMAP2_UNIT = 4096; |
| 224 | 215 | ||
| 225 | pub const VDSO = struct { | 216 | pub const VDSO = struct { |
lib/std/os/linux/x86_64.zig-15| ... | @@ -177,21 +177,6 @@ pub const F = struct { | ... | @@ -177,21 +177,6 @@ pub const F = struct { |
| 177 | pub const UNLCK = 2; | 177 | pub const UNLCK = 2; |
| 178 | }; | 178 | }; |
| 179 | 179 | ||
| 180 | pub const MAP = struct { | ||
| 181 | /// only give out 32bit addresses | ||
| 182 | pub const @"32BIT" = 0x40; | ||
| 183 | /// stack-like segment | ||
| 184 | pub const GROWSDOWN = 0x0100; | ||
| 185 | /// ETXTBSY | ||
| 186 | pub const DENYWRITE = 0x0800; | ||
| 187 | /// mark it as an executable | ||
| 188 | pub const EXECUTABLE = 0x1000; | ||
| 189 | /// pages are locked | ||
| 190 | pub const LOCKED = 0x2000; | ||
| 191 | /// don't check for reservations | ||
| 192 | pub const NORESERVE = 0x4000; | ||
| 193 | }; | ||
| 194 | |||
| 195 | pub const VDSO = struct { | 180 | pub const VDSO = struct { |
| 196 | pub const CGT_SYM = "__vdso_clock_gettime"; | 181 | pub const CGT_SYM = "__vdso_clock_gettime"; |
| 197 | pub const CGT_VER = "LINUX_2.6"; | 182 | pub const CGT_VER = "LINUX_2.6"; |
lib/std/os/test.zig+3-3| ... | @@ -576,7 +576,7 @@ test "mmap" { | ... | @@ -576,7 +576,7 @@ test "mmap" { |
| 576 | null, | 576 | null, |
| 577 | 1234, | 577 | 1234, |
| 578 | os.PROT.READ | os.PROT.WRITE, | 578 | os.PROT.READ | os.PROT.WRITE, |
| 579 | os.MAP.ANONYMOUS | os.MAP.PRIVATE, | 579 | .{ .TYPE = .PRIVATE, .ANONYMOUS = true }, |
| 580 | -1, | 580 | -1, |
| 581 | 0, | 581 | 0, |
| 582 | ); | 582 | ); |
| ... | @@ -618,7 +618,7 @@ test "mmap" { | ... | @@ -618,7 +618,7 @@ test "mmap" { |
| 618 | null, | 618 | null, |
| 619 | alloc_size, | 619 | alloc_size, |
| 620 | os.PROT.READ, | 620 | os.PROT.READ, |
| 621 | os.MAP.PRIVATE, | 621 | .{ .TYPE = .PRIVATE }, |
| 622 | file.handle, | 622 | file.handle, |
| 623 | 0, | 623 | 0, |
| 624 | ); | 624 | ); |
| ... | @@ -642,7 +642,7 @@ test "mmap" { | ... | @@ -642,7 +642,7 @@ test "mmap" { |
| 642 | null, | 642 | null, |
| 643 | alloc_size / 2, | 643 | alloc_size / 2, |
| 644 | os.PROT.READ, | 644 | os.PROT.READ, |
| 645 | os.MAP.PRIVATE, | 645 | .{ .TYPE = .PRIVATE }, |
| 646 | file.handle, | 646 | file.handle, |
| 647 | alloc_size / 2, | 647 | alloc_size / 2, |
| 648 | ); | 648 | ); |