mirror of https://github.com/openbsd/ports.git
lang/zig: unbreak the build
msync() might return EPERM now. https://github.com/ziglang/zig/pull/18701
This commit is contained in:
parent
8e49d170c5
commit
4586b17aed
|
@ -6,7 +6,7 @@ BROKEN-powerpc64 = ld: error: undefined symbol: __subkf3 (and others)
|
|||
COMMENT = zig compiler and toolchain
|
||||
|
||||
DISTNAME = zig-0.11.0
|
||||
REVISION = 1
|
||||
REVISION = 2
|
||||
|
||||
GH_ACCOUNT = ziglang
|
||||
GH_PROJECT = zig
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
msync: https://github.com/ziglang/zig/pull/18701
|
||||
|
||||
Index: lib/std/debug.zig
|
||||
--- lib/std/debug.zig.orig
|
||||
+++ lib/std/debug.zig
|
||||
|
@ -9,3 +11,13 @@ Index: lib/std/debug.zig
|
|||
(builtin.os.tag != .linux or switch (builtin.cpu.arch) {
|
||||
.x86,
|
||||
.x86_64,
|
||||
@@ -606,6 +607,9 @@ pub const StackIterator = struct {
|
||||
if (native_os != .wasi) {
|
||||
os.msync(aligned_memory, os.MSF.ASYNC) catch |err| {
|
||||
switch (err) {
|
||||
+ os.MSyncError.AccessDenied => {
|
||||
+ return true;
|
||||
+ },
|
||||
os.MSyncError.UnmappedMemory => {
|
||||
return false;
|
||||
},
|
||||
|
|
|
@ -1,7 +1,23 @@
|
|||
msync: https://github.com/ziglang/zig/pull/18701
|
||||
|
||||
Index: lib/std/os.zig
|
||||
--- lib/std/os.zig.orig
|
||||
+++ lib/std/os.zig
|
||||
@@ -5303,6 +5303,9 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTE
|
||||
@@ -4416,11 +4416,13 @@ pub fn munmap(memory: []align(mem.page_size) const u8)
|
||||
|
||||
pub const MSyncError = error{
|
||||
UnmappedMemory,
|
||||
+ AccessDenied,
|
||||
} || UnexpectedError;
|
||||
|
||||
pub fn msync(memory: []align(mem.page_size) u8, flags: i32) MSyncError!void {
|
||||
switch (errno(system.msync(memory.ptr, memory.len, flags))) {
|
||||
.SUCCESS => return,
|
||||
+ .PERM => return error.AccessDenied,
|
||||
.NOMEM => return error.UnmappedMemory, // Unsuccessful, provided pointer does not point mapped memory
|
||||
.INVAL => unreachable, // Invalid parameters.
|
||||
else => unreachable,
|
||||
@@ -5303,6 +5305,9 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTE
|
||||
const len = mem.indexOfScalar(u8, out_buffer[0..], @as(u8, 0)) orelse MAX_PATH_BYTES;
|
||||
return out_buffer[0..len];
|
||||
},
|
||||
|
@ -11,3 +27,12 @@ Index: lib/std/os.zig
|
|||
else => @compileError("querying for canonical path of a handle is unsupported on this host"),
|
||||
}
|
||||
}
|
||||
@@ -7038,7 +7043,7 @@ pub const MadviseError = error{
|
||||
pub fn madvise(ptr: [*]align(mem.page_size) u8, length: usize, advice: u32) MadviseError!void {
|
||||
switch (errno(system.madvise(ptr, length, advice))) {
|
||||
.SUCCESS => return,
|
||||
- .ACCES => return error.AccessDenied,
|
||||
+ .PERM, .ACCES => return error.AccessDenied,
|
||||
.AGAIN => return error.SystemResources,
|
||||
.BADF => unreachable, // The map exists, but the area maps something that isn't a file.
|
||||
.INVAL => return error.InvalidSyscall,
|
||||
|
|
Loading…
Reference in New Issue