| author | |
| committer | |
| log | f8ddc3d8732feece71d6ee55cdfc4d61a5a7e16e |
| tree | 725d930ad3dcba14370029dc649df54ef1a772e4 |
| parent | 9d2fe1682f19bd21a393deeea2c4173b4429b482 |
4 files changed, 10 insertions(+), 15 deletions(-)
lib/std/child_process.zig+1| ... | ... | @@ -368,6 +368,7 @@ pub const ChildProcess = struct { |
| 368 | 368 | error.DeviceBusy => unreachable, |
| 369 | 369 | error.FileLocksNotSupported => unreachable, |
| 370 | 370 | error.BadPathName => unreachable, // Windows-only |
| 371 | error.WouldBlock => unreachable, | |
| 371 | 372 | else => |e| return e, |
| 372 | 373 | } |
| 373 | 374 | else |
lib/std/fs.zig+5-3| ... | ... | @@ -405,7 +405,7 @@ pub const Dir = struct { |
| 405 | 405 | else => false, |
| 406 | 406 | }; |
| 407 | 407 | if (mem.eql(u8, name, ".") or mem.eql(u8, name, "..") or |
| 408 | (skip_zero_fileno and bsd_entry.d_fileno == 0)) | |
| 408 | (skip_zero_fileno and bsd_entry.d_fileno == 0)) | |
| 409 | 409 | { |
| 410 | 410 | continue :start_over; |
| 411 | 411 | } |
| ... | ... | @@ -863,8 +863,8 @@ pub const Dir = struct { |
| 863 | 863 | 0; |
| 864 | 864 | const lock_flag: u32 = if (has_flock_open_flags) switch (flags.lock) { |
| 865 | 865 | .None => @as(u32, 0), |
| 866 | .Shared => os.O_SHLOCK, | |
| 867 | .Exclusive => os.O_EXLOCK, | |
| 866 | .Shared => os.O_SHLOCK | nonblocking_lock_flag, | |
| 867 | .Exclusive => os.O_EXLOCK | nonblocking_lock_flag, | |
| 868 | 868 | } else 0; |
| 869 | 869 | |
| 870 | 870 | const O_LARGEFILE = if (@hasDecl(os, "O_LARGEFILE")) os.O_LARGEFILE else 0; |
| ... | ... | @@ -1178,6 +1178,7 @@ pub const Dir = struct { |
| 1178 | 1178 | error.NoSpaceLeft => unreachable, // not providing O_CREAT |
| 1179 | 1179 | error.PathAlreadyExists => unreachable, // not providing O_CREAT |
| 1180 | 1180 | error.FileLocksNotSupported => unreachable, // locking folders is not supported |
| 1181 | error.WouldBlock => unreachable, // can't happen for directories | |
| 1181 | 1182 | else => |e| return e, |
| 1182 | 1183 | }; |
| 1183 | 1184 | return Dir{ .fd = fd }; |
| ... | ... | @@ -1221,6 +1222,7 @@ pub const Dir = struct { |
| 1221 | 1222 | error.NoSpaceLeft => unreachable, // not providing O_CREAT |
| 1222 | 1223 | error.PathAlreadyExists => unreachable, // not providing O_CREAT |
| 1223 | 1224 | error.FileLocksNotSupported => unreachable, // locking folders is not supported |
| 1225 | error.WouldBlock => unreachable, // can't happen for directories | |
| 1224 | 1226 | else => |e| return e, |
| 1225 | 1227 | }; |
| 1226 | 1228 | return Dir{ .fd = fd }; |
lib/std/fs/test.zig-12| ... | ... | @@ -691,9 +691,6 @@ test "realpath" { |
| 691 | 691 | test "open file with exclusive nonblocking lock twice" { |
| 692 | 692 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 693 | 693 | |
| 694 | // TODO: fix this test on FreeBSD. https://github.com/ziglang/zig/issues/1759 | |
| 695 | if (builtin.os.tag == .freebsd) return error.SkipZigTest; | |
| 696 | ||
| 697 | 694 | const filename = "file_nonblocking_lock_test.txt"; |
| 698 | 695 | |
| 699 | 696 | var tmp = tmpDir(.{}); |
| ... | ... | @@ -709,9 +706,6 @@ test "open file with exclusive nonblocking lock twice" { |
| 709 | 706 | test "open file with shared and exclusive nonblocking lock" { |
| 710 | 707 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 711 | 708 | |
| 712 | // TODO: fix this test on FreeBSD. https://github.com/ziglang/zig/issues/1759 | |
| 713 | if (builtin.os.tag == .freebsd) return error.SkipZigTest; | |
| 714 | ||
| 715 | 709 | const filename = "file_nonblocking_lock_test.txt"; |
| 716 | 710 | |
| 717 | 711 | var tmp = tmpDir(.{}); |
| ... | ... | @@ -727,9 +721,6 @@ test "open file with shared and exclusive nonblocking lock" { |
| 727 | 721 | test "open file with exclusive and shared nonblocking lock" { |
| 728 | 722 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 729 | 723 | |
| 730 | // TODO: fix this test on FreeBSD. https://github.com/ziglang/zig/issues/1759 | |
| 731 | if (builtin.os.tag == .freebsd) return error.SkipZigTest; | |
| 732 | ||
| 733 | 724 | const filename = "file_nonblocking_lock_test.txt"; |
| 734 | 725 | |
| 735 | 726 | var tmp = tmpDir(.{}); |
| ... | ... | @@ -791,9 +782,6 @@ test "open file with exclusive lock twice, make sure it waits" { |
| 791 | 782 | test "open file with exclusive nonblocking lock twice (absolute paths)" { |
| 792 | 783 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 793 | 784 | |
| 794 | // TODO: fix this test on FreeBSD. https://github.com/ziglang/zig/issues/1759 | |
| 795 | if (builtin.os.tag == .freebsd) return error.SkipZigTest; | |
| 796 | ||
| 797 | 785 | const allocator = testing.allocator; |
| 798 | 786 | |
| 799 | 787 | const file_paths: [1][]const u8 = .{"zig-test-absolute-paths.txt"}; |
lib/std/os.zig+4| ... | ... | @@ -1020,6 +1020,8 @@ pub const OpenError = error{ |
| 1020 | 1020 | |
| 1021 | 1021 | BadPathName, |
| 1022 | 1022 | InvalidUtf8, |
| 1023 | ||
| 1024 | WouldBlock, | |
| 1023 | 1025 | } || UnexpectedError; |
| 1024 | 1026 | |
| 1025 | 1027 | /// Open and possibly create a file. Keeps trying if it gets interrupted. |
| ... | ... | @@ -1201,6 +1203,7 @@ pub fn openatZ(dir_fd: fd_t, file_path: [*:0]const u8, flags: u32, mode: mode_t) |
| 1201 | 1203 | EEXIST => return error.PathAlreadyExists, |
| 1202 | 1204 | EBUSY => return error.DeviceBusy, |
| 1203 | 1205 | EOPNOTSUPP => return error.FileLocksNotSupported, |
| 1206 | EWOULDBLOCK => return error.WouldBlock, | |
| 1204 | 1207 | else => |err| return unexpectedErrno(err), |
| 1205 | 1208 | } |
| 1206 | 1209 | } |
| ... | ... | @@ -4187,6 +4190,7 @@ pub fn realpathZ(pathname: [*:0]const u8, out_buffer: *[MAX_PATH_BYTES]u8) RealP |
| 4187 | 4190 | const flags = if (builtin.os.tag == .linux) O_PATH | O_NONBLOCK | O_CLOEXEC else O_NONBLOCK | O_CLOEXEC; |
| 4188 | 4191 | const fd = openZ(pathname, flags, 0) catch |err| switch (err) { |
| 4189 | 4192 | error.FileLocksNotSupported => unreachable, |
| 4193 | error.WouldBlock => unreachable, | |
| 4190 | 4194 | else => |e| return e, |
| 4191 | 4195 | }; |
| 4192 | 4196 | defer close(fd); |