authorgravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2019-07-07 14:31:27+10:00
committergravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2019-07-07 14:31:27+10:00
loge197968734b2a0c1dd77034611361a121ecfc5ab
tree38789c1665ee843606533aaba00d96af40a1ca1f
parent7610d39413d45b5d72c532b2128a81d080fe342f
signature Commit is signed but in an unrecognized format.

std: Make linux MAP_ definitions match kernel


3 files changed, 83 insertions(+), 11 deletions(-)

std/os/bits/linux.zig+20-11
......@@ -74,22 +74,31 @@ pub const PROT_EXEC = 4;
7474pub const PROT_GROWSDOWN = 0x01000000;
7575pub const PROT_GROWSUP = 0x02000000;
7676
77pub const MAP_FAILED = @intToPtr(*c_void, maxInt(usize));
77/// Share changes
7878pub const MAP_SHARED = 0x01;
79
80/// Changes are private
7981pub const MAP_PRIVATE = 0x02;
82
83/// share + validate extension flags
84pub const MAP_SHARED_VALIDATE = 0x03;
85
86/// Mask for type of mapping
8087pub const MAP_TYPE = 0x0f;
88
89/// Interpret addr exactly
8190pub const MAP_FIXED = 0x10;
91
92/// don't use a file
8293pub const MAP_ANONYMOUS = 0x20;
83pub const MAP_NORESERVE = 0x4000;
84pub const MAP_GROWSDOWN = 0x0100;
85pub const MAP_DENYWRITE = 0x0800;
86pub const MAP_EXECUTABLE = 0x1000;
87pub const MAP_LOCKED = 0x2000;
88pub const MAP_POPULATE = 0x8000;
89pub const MAP_NONBLOCK = 0x10000;
90pub const MAP_STACK = 0x20000;
91pub const MAP_HUGETLB = 0x40000;
92pub const MAP_FILE = 0;
94
95/// For anonymous mmap, memory could be uninitialized
96pub const MAP_UNINITIALIZED = 0x4000000;
97
98// MAP_ 0x0100 - 0x80000 flags are per architecture
99
100/// MAP_FIXED which doesn't unmap underlying mapping
101pub const MAP_FIXED_NOREPLACE = 0x100000;
93102
94103pub const F_OK = 0;
95104pub const X_OK = 1;
std/os/bits/linux/arm64.zig+30
......@@ -331,6 +331,36 @@ pub const F_GETOWN_EX = 16;
331331
332332pub const F_GETOWNER_UIDS = 17;
333333
334/// stack-like segment
335pub const MAP_GROWSDOWN = 0x0100;
336
337/// ETXTBSY
338pub const MAP_DENYWRITE = 0x0800;
339
340/// mark it as an executable
341pub const MAP_EXECUTABLE = 0x1000;
342
343/// pages are locked
344pub const MAP_LOCKED = 0x2000;
345
346/// don't check for reservations
347pub const MAP_NORESERVE = 0x4000;
348
349/// populate (prefault) pagetables
350pub const MAP_POPULATE = 0x8000;
351
352/// do not block on IO
353pub const MAP_NONBLOCK = 0x10000;
354
355/// give out an address that is best suited for process/thread stacks
356pub const MAP_STACK = 0x20000;
357
358/// create a huge page mapping
359pub const MAP_HUGETLB = 0x40000;
360
361/// perform synchronous page faults for the mapping
362pub const MAP_SYNC = 0x80000;
363
334364pub const VDSO_USEFUL = true;
335365pub const VDSO_CGT_SYM = "__kernel_clock_gettime";
336366pub const VDSO_CGT_VER = "LINUX_2.6.39";
std/os/bits/linux/x86_64.zig+33
......@@ -394,6 +394,39 @@ pub const F_GETOWN_EX = 16;
394394
395395pub const F_GETOWNER_UIDS = 17;
396396
397/// only give out 32bit addresses
398pub const MAP_32BIT = 0x40;
399
400/// stack-like segment
401pub const MAP_GROWSDOWN = 0x0100;
402
403/// ETXTBSY
404pub const MAP_DENYWRITE = 0x0800;
405
406/// mark it as an executable
407pub const MAP_EXECUTABLE = 0x1000;
408
409/// pages are locked
410pub const MAP_LOCKED = 0x2000;
411
412/// don't check for reservations
413pub const MAP_NORESERVE = 0x4000;
414
415/// populate (prefault) pagetables
416pub const MAP_POPULATE = 0x8000;
417
418/// do not block on IO
419pub const MAP_NONBLOCK = 0x10000;
420
421/// give out an address that is best suited for process/thread stacks
422pub const MAP_STACK = 0x20000;
423
424/// create a huge page mapping
425pub const MAP_HUGETLB = 0x40000;
426
427/// perform synchronous page faults for the mapping
428pub const MAP_SYNC = 0x80000;
429
397430pub const VDSO_USEFUL = true;
398431pub const VDSO_CGT_SYM = "__vdso_clock_gettime";
399432pub const VDSO_CGT_VER = "LINUX_2.6";