zig

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

commit 772bb1ade372ad625381ccee198c812fcccc0e3d (tree)
parent d0d7895d3308763422e4da0eb5d6e03c445f1b08
Author: LeRoyce Pearson <leroycepearson@geemili.xyz>
Date:   Wed,  8 Apr 2020 16:29:44 -0600

Disable open flock flags on darwin

The tests were put into a deadlock, and it seems that darwin doesn't
support `O_SYNC`, though it supports `O_NONBLOCK`. It shouldn't block
even with that, but I'm not sure why else it would fail.

Diffstat:
Mlib/std/fs.zig | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/std/fs.zig b/lib/std/fs.zig @@ -596,7 +596,8 @@ pub const Dir = struct { } // Use the O_ locking flags if the os supports them - const has_flock_open_flags = @hasDecl(os, "O_EXLOCK"); + // (Or if it's darwin, as darwin's `open` doesn't support the O_SYNC flag) + const has_flock_open_flags = @hasDecl(os, "O_EXLOCK") and !builtin.os.tag.isDarwin(); const nonblocking_lock_flag = if (has_flock_open_flags and flags.lock_nonblocking) (os.O_NONBLOCK | os.O_SYNC) else @as(u32, 0); const lock_flag: u32 = if (has_flock_open_flags) switch (flags.lock) { .None => @as(u32, 0), @@ -678,7 +679,8 @@ pub const Dir = struct { } // Use the O_ locking flags if the os supports them - const has_flock_open_flags = @hasDecl(os, "O_EXLOCK"); + // (Or if it's darwin, as darwin's `open` doesn't support the O_SYNC flag) + const has_flock_open_flags = @hasDecl(os, "O_EXLOCK") and !builtin.os.tag.isDarwin(); const nonblocking_lock_flag = if (has_flock_open_flags and flags.lock_nonblocking) (os.O_NONBLOCK | os.O_SYNC) else @as(u32, 0); const lock_flag: u32 = if (has_flock_open_flags) switch (flags.lock) { .None => @as(u32, 0),