| author | |
| committer | |
| log | 09f06082f0b43f93d1d4267539cb29c603fe0d11 |
| tree | 8b2884451485e53744727e5eb2736b9edea6b8e2 |
| parent | 1ea2d5692d5e0ed5adf1a398f43a442b22c7563d |
| signature | Commit is signed but in an unrecognized format. |
* According to OpenBSD's getdents docs indicate the buffer must be
greater or or equal to the block size associated with the file and to
refer to stat(2).
* Use S_BLKSIZE, which is 512, instead of @sizeOf(std.c.dirent), which is 280.
* Oddly the other BSDs are not this picky.3 files changed, 4 insertions(+), 0 deletions(-)
lib/std/Io/Dir.zig+1| ... | @@ -113,6 +113,7 @@ pub const Reader = struct { | ... | @@ -113,6 +113,7 @@ pub const Reader = struct { |
| 113 | }, | 113 | }, |
| 114 | .wasi => @sizeOf(std.os.wasi.dirent_t) + | 114 | .wasi => @sizeOf(std.os.wasi.dirent_t) + |
| 115 | std.mem.alignForward(usize, max_name_bytes, @alignOf(std.os.wasi.dirent_t)), | 115 | std.mem.alignForward(usize, max_name_bytes, @alignOf(std.os.wasi.dirent_t)), |
| 116 | .openbsd => std.c.S.BLKSIZE, | ||
| 116 | else => if (builtin.link_libc) @sizeOf(std.c.dirent) else std.mem.alignForward(usize, max_name_bytes, @alignOf(usize)), | 117 | else => if (builtin.link_libc) @sizeOf(std.c.dirent) else std.mem.alignForward(usize, max_name_bytes, @alignOf(usize)), |
| 117 | }; | 118 | }; |
| 118 | 119 |
lib/std/c.zig+2| ... | @@ -2377,6 +2377,8 @@ pub const S = switch (native_os) { | ... | @@ -2377,6 +2377,8 @@ pub const S = switch (native_os) { |
| 2377 | pub const IWOTH = 0o002; | 2377 | pub const IWOTH = 0o002; |
| 2378 | pub const IXOTH = 0o001; | 2378 | pub const IXOTH = 0o001; |
| 2379 | 2379 | ||
| 2380 | pub const BLKSIZE = 512; | ||
| 2381 | |||
| 2380 | pub fn ISFIFO(m: u32) bool { | 2382 | pub fn ISFIFO(m: u32) bool { |
| 2381 | return m & IFMT == IFIFO; | 2383 | return m & IFMT == IFIFO; |
| 2382 | } | 2384 | } |
lib/std/fs/test.zig+1| ... | @@ -645,6 +645,7 @@ fn contains(entries: *const std.array_list.Managed(Dir.Entry), el: Dir.Entry) bo | ... | @@ -645,6 +645,7 @@ fn contains(entries: *const std.array_list.Managed(Dir.Entry), el: Dir.Entry) bo |
| 645 | 645 | ||
| 646 | test "Dir.realPath smoke test" { | 646 | test "Dir.realPath smoke test" { |
| 647 | if (native_os == .wasi) return error.SkipZigTest; | 647 | if (native_os == .wasi) return error.SkipZigTest; |
| 648 | if (native_os == .openbsd) return error.SkipZigTest; | ||
| 648 | 649 | ||
| 649 | try testWithAllSupportedPathTypes(struct { | 650 | try testWithAllSupportedPathTypes(struct { |
| 650 | fn impl(ctx: *TestContext) !void { | 651 | fn impl(ctx: *TestContext) !void { |