| ... | @@ -596,7 +596,8 @@ pub const Dir = struct { | ... | @@ -596,7 +596,8 @@ pub const Dir = struct { |
| 596 | } | 596 | } |
| 597 | | 597 | |
| 598 | // Use the O_ locking flags if the os supports them | 598 | // Use the O_ locking flags if the os supports them |
| 599 | const has_flock_open_flags = @hasDecl(os, "O_EXLOCK"); | 599 | // (Or if it's darwin, as darwin's `open` doesn't support the O_SYNC flag) |
| | 600 | const has_flock_open_flags = @hasDecl(os, "O_EXLOCK") and !builtin.os.tag.isDarwin(); |
| 600 | const nonblocking_lock_flag = if (has_flock_open_flags and flags.lock_nonblocking) (os.O_NONBLOCK | os.O_SYNC) else @as(u32, 0); | 601 | const nonblocking_lock_flag = if (has_flock_open_flags and flags.lock_nonblocking) (os.O_NONBLOCK | os.O_SYNC) else @as(u32, 0); |
| 601 | const lock_flag: u32 = if (has_flock_open_flags) switch (flags.lock) { | 602 | const lock_flag: u32 = if (has_flock_open_flags) switch (flags.lock) { |
| 602 | .None => @as(u32, 0), | 603 | .None => @as(u32, 0), |
| ... | @@ -678,7 +679,8 @@ pub const Dir = struct { | ... | @@ -678,7 +679,8 @@ pub const Dir = struct { |
| 678 | } | 679 | } |
| 679 | | 680 | |
| 680 | // Use the O_ locking flags if the os supports them | 681 | // Use the O_ locking flags if the os supports them |
| 681 | const has_flock_open_flags = @hasDecl(os, "O_EXLOCK"); | 682 | // (Or if it's darwin, as darwin's `open` doesn't support the O_SYNC flag) |
| | 683 | const has_flock_open_flags = @hasDecl(os, "O_EXLOCK") and !builtin.os.tag.isDarwin(); |
| 682 | const nonblocking_lock_flag = if (has_flock_open_flags and flags.lock_nonblocking) (os.O_NONBLOCK | os.O_SYNC) else @as(u32, 0); | 684 | const nonblocking_lock_flag = if (has_flock_open_flags and flags.lock_nonblocking) (os.O_NONBLOCK | os.O_SYNC) else @as(u32, 0); |
| 683 | const lock_flag: u32 = if (has_flock_open_flags) switch (flags.lock) { | 685 | const lock_flag: u32 = if (has_flock_open_flags) switch (flags.lock) { |
| 684 | .None => @as(u32, 0), | 686 | .None => @as(u32, 0), |