authorgravatar for 15335529+Sobeston@users.noreply.github.comSobeston <15335529+Sobeston@users.noreply.github.com> 2021-05-22 05:04:53+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-22 20:51:53-04:00
log742d588b3a2fc73c4bf6802f4ea37edb2534226f
tree46a92a3ba1da44f1536dc59479577d2154734840
parentd7bf4f80703d16a6485f605c89d24acf427b4680

std.os: munmap takes a const pointer


2 files changed, 2 insertions(+), 2 deletions(-)

lib/std/c.zig+1-1
......@@ -96,7 +96,7 @@ pub extern "c" fn pwritev(fd: c_int, iov: [*]const iovec_const, iovcnt: c_uint,
9696pub extern "c" fn write(fd: fd_t, buf: [*]const u8, nbyte: usize) isize;
9797pub extern "c" fn pwrite(fd: fd_t, buf: [*]const u8, nbyte: usize, offset: off_t) isize;
9898pub 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;
99pub extern "c" fn munmap(addr: *align(page_size) c_void, len: usize) c_int;
99pub extern "c" fn munmap(addr: *align(page_size) const c_void, len: usize) c_int;
100100pub extern "c" fn mprotect(addr: *align(page_size) c_void, len: usize, prot: c_uint) c_int;
101101pub extern "c" fn link(oldpath: [*:0]const u8, newpath: [*:0]const u8, flags: c_int) c_int;
102102pub extern "c" fn linkat(oldfd: fd_t, oldpath: [*:0]const u8, newfd: fd_t, newpath: [*:0]const u8, flags: c_int) c_int;
lib/std/os.zig+1-1
......@@ -3792,7 +3792,7 @@ pub fn mmap(
37923792/// Zig's munmap function does not, for two reasons:
37933793/// * It violates the Zig principle that resource deallocation must succeed.
37943794/// * The Windows function, VirtualFree, has this restriction.
3795pub fn munmap(memory: []align(mem.page_size) u8) void {
3795pub fn munmap(memory: []align(mem.page_size) const u8) void {
37963796 switch (errno(system.munmap(memory.ptr, memory.len))) {
37973797 0 => return,
37983798 EINVAL => unreachable, // Invalid parameters.