aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Io/Dir.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-12-19 11:26:06 -0800
committerAndrew Kelley <andrew@ziglang.org>2025-12-23 22:15:11 -0800
commit002d444964869a5fd4d588d45c46f3acfa16cf5d (patch)
treea92f8dcd1de9c85613a721d4f92f71f20bb520a4 /lib/std/Io/Dir.zig
parent018e34271fe58e540dc46e8bca529ce399625bef (diff)
downloadzig-002d444964869a5fd4d588d45c46f3acfa16cf5d.tar.gz
zig-002d444964869a5fd4d588d45c46f3acfa16cf5d.zip
std: fix Io.Dir.min_buffer_len on Linux
Diffstat (limited to 'lib/std/Io/Dir.zig')
-rw-r--r--lib/std/Io/Dir.zig7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/std/Io/Dir.zig b/lib/std/Io/Dir.zig
index 2de0fbe564..330ac5bf62 100644
--- a/lib/std/Io/Dir.zig
+++ b/lib/std/Io/Dir.zig
@@ -102,7 +102,12 @@ pub const Reader = struct {
end: usize,
/// A length for `buffer` that allows all implementations to function.
- pub const min_buffer_len = std.mem.alignForward(usize, max_name_bytes, @alignOf(usize));
+ pub const min_buffer_len = switch (native_os) {
+ .linux => @sizeOf(std.os.linux.dirent64) +
+ std.mem.alignForward(usize, max_name_bytes, @alignOf(std.os.linux.dirent64)),
+ .windows => std.mem.alignForward(usize, max_name_bytes, @alignOf(usize)),
+ else => if (builtin.link_libc) @sizeOf(std.c.dirent) else std.mem.alignForward(usize, max_name_bytes, @alignOf(usize)),
+ };
pub const State = enum {
/// Indicates the next call to `read` should rewind and start over the