From 687a756bf9b443ae53aa6dc3ee8f4a1550a09597 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Sat, 15 Jun 2024 22:20:20 +0200 Subject: [PATCH] std: make all dirent structs extern Using structs with unspecified layout on the ABI boundry can't end well. --- lib/std/c/emscripten.zig | 2 +- lib/std/c/linux.zig | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/std/c/emscripten.zig b/lib/std/c/emscripten.zig index 501fcb4386..0893289b14 100644 --- a/lib/std/c/emscripten.zig +++ b/lib/std/c/emscripten.zig @@ -171,7 +171,7 @@ pub const RTLD = struct { pub const LOCAL = 0; }; -pub const dirent = struct { +pub const dirent = extern struct { ino: c_uint, off: c_uint, reclen: c_ushort, diff --git a/lib/std/c/linux.zig b/lib/std/c/linux.zig index 1a3c634515..07a59e8c0f 100644 --- a/lib/std/c/linux.zig +++ b/lib/std/c/linux.zig @@ -330,14 +330,14 @@ pub const RTLD = struct { pub const LOCAL = 0; }; -pub const dirent = struct { +pub const dirent = extern struct { ino: c_uint, off: c_uint, reclen: c_ushort, type: u8, name: [256]u8, }; -pub const dirent64 = struct { +pub const dirent64 = extern struct { ino: c_ulong, off: c_ulong, reclen: c_ushort,