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,...@@ -96,7 +96,7 @@ pub extern "c" fn pwritev(fd: c_int, iov: [*]const iovec_const, iovcnt: c_uint,
96pub extern "c" fn write(fd: fd_t, buf: [*]const u8, nbyte: usize) isize;96pub extern "c" fn write(fd: fd_t, buf: [*]const u8, nbyte: usize) isize;
97pub extern "c" fn pwrite(fd: fd_t, buf: [*]const u8, nbyte: usize, offset: off_t) isize;97pub extern "c" fn pwrite(fd: fd_t, buf: [*]const u8, nbyte: usize, offset: off_t) isize;
98pub 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;98pub 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;
100pub extern "c" fn mprotect(addr: *align(page_size) c_void, len: usize, prot: c_uint) c_int;100pub extern "c" fn mprotect(addr: *align(page_size) c_void, len: usize, prot: c_uint) c_int;
101pub extern "c" fn link(oldpath: [*:0]const u8, newpath: [*:0]const u8, flags: c_int) c_int;101pub extern "c" fn link(oldpath: [*:0]const u8, newpath: [*:0]const u8, flags: c_int) c_int;
102pub extern "c" fn linkat(oldfd: fd_t, oldpath: [*:0]const u8, newfd: fd_t, newpath: [*:0]const u8, flags: c_int) c_int;102pub 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(...@@ -3792,7 +3792,7 @@ pub fn mmap(
3792/// Zig's munmap function does not, for two reasons:3792/// Zig's munmap function does not, for two reasons:
3793/// * It violates the Zig principle that resource deallocation must succeed.3793/// * It violates the Zig principle that resource deallocation must succeed.
3794/// * The Windows function, VirtualFree, has this restriction.3794/// * 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 {
3796 switch (errno(system.munmap(memory.ptr, memory.len))) {3796 switch (errno(system.munmap(memory.ptr, memory.len))) {
3797 0 => return,3797 0 => return,
3798 EINVAL => unreachable, // Invalid parameters.3798 EINVAL => unreachable, // Invalid parameters.