mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 22:35:24 +00:00
std.os: munmap takes a const pointer
This commit is contained in:
parent
d7bf4f8070
commit
742d588b3a
@ -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;
|
||||
|
||||
@ -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.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user