| ... | ... | @@ -190,7 +190,11 @@ pub fn umount2(special: [*]const u8, flags: u32) usize { |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: u32, fd: i32, offset: isize) usize { |
| 193 | | return syscall6(SYS_mmap, @ptrToInt(address), length, prot, flags, @bitCast(usize, isize(fd)), @bitCast(usize, offset)); |
| 193 | if (@hasDecl(@This(), "SYS_mmap2")) { |
| 194 | return syscall6(SYS_mmap2, @ptrToInt(address), length, prot, flags, @bitCast(usize, isize(fd)), @bitCast(usize, @divTrunc(offset, MMAP2_UNIT))); |
| 195 | } else { |
| 196 | return syscall6(SYS_mmap, @ptrToInt(address), length, prot, flags, @bitCast(usize, isize(fd)), @bitCast(usize, offset)); |
| 197 | } |
| 194 | 198 | } |
| 195 | 199 | |
| 196 | 200 | pub fn mprotect(address: [*]const u8, length: usize, protection: usize) usize { |