zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 742d588b3a2fc73c4bf6802f4ea37edb2534226f (tree)
parent d7bf4f80703d16a6485f605c89d24acf427b4680
Author: Sobeston <15335529+Sobeston@users.noreply.github.com>
Date:   Sat, 22 May 2021 05:04:53 +0100

std.os: munmap takes a const pointer

Diffstat:
Mlib/std/c.zig | 2+-
Mlib/std/os.zig | 2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git 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 @@ -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.