From 742d588b3a2fc73c4bf6802f4ea37edb2534226f Mon Sep 17 00:00:00 2001 From: Sobeston <15335529+Sobeston@users.noreply.github.com> Date: Sat, 22 May 2021 05:04:53 +0100 Subject: [PATCH] std.os: munmap takes a const pointer --- lib/std/c.zig | 2 +- lib/std/os.zig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/std/c.zig b/lib/std/c.zig index acfc6b34f7..1d60af6747 100644 --- a/lib/std/c.zig +++ b/lib/std/c.zig @@ -96,7 +96,7 @@ pub extern "c" fn pwritev(fd: c_int, iov: [*]const iovec_const, iovcnt: c_uint, pub extern "c" fn write(fd: fd_t, buf: [*]const u8, nbyte: usize) isize; pub extern "c" fn pwrite(fd: fd_t, buf: [*]const u8, nbyte: usize, offset: off_t) isize; pub extern "c" fn mmap(addr: ?*align(page_size) c_void, len: usize, prot: c_uint, flags: c_uint, fd: fd_t, offset: off_t) *c_void; -pub extern "c" fn munmap(addr: *align(page_size) c_void, len: usize) c_int; +pub extern "c" fn munmap(addr: *align(page_size) const c_void, len: usize) c_int; pub extern "c" fn mprotect(addr: *align(page_size) c_void, len: usize, prot: c_uint) c_int; pub extern "c" fn link(oldpath: [*:0]const u8, newpath: [*:0]const u8, flags: c_int) c_int; pub extern "c" fn linkat(oldfd: fd_t, oldpath: [*:0]const u8, newfd: fd_t, newpath: [*:0]const u8, flags: c_int) c_int; diff --git a/lib/std/os.zig b/lib/std/os.zig index 601839ea1c..93d0b9832d 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -3792,7 +3792,7 @@ pub fn mmap( /// Zig's munmap function does not, for two reasons: /// * It violates the Zig principle that resource deallocation must succeed. /// * The Windows function, VirtualFree, has this restriction. -pub fn munmap(memory: []align(mem.page_size) u8) void { +pub fn munmap(memory: []align(mem.page_size) const u8) void { switch (errno(system.munmap(memory.ptr, memory.len))) { 0 => return, EINVAL => unreachable, // Invalid parameters.