authorgravatar for hahv@msn.comHuang Zhichao <hahv@msn.com> 2026-05-29 13:15:21+08:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-05-31 07:29:58+02:00
log0618743543464e0b5862255ebb89f265bd29c8b9
treef3bb7e93656e81daef510e15911d97e51e63727f
parent532047edd01ebedf6fae4d63ad25713f81d8fae4

std.os.linux: make dev_t u32

glibc and musl define dev_t as u64, but in the kernel it is u32. see https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/types.h?id=v7.0#n17

2 files changed, 3 insertions(+), 3 deletions(-)

lib/std/c.zig+2-2
......@@ -148,12 +148,12 @@ pub const timespec = switch (native_os) {
148148};
149149
150150pub const dev_t = switch (native_os) {
151 .linux => linux.dev_t,
152151 .emscripten => emscripten.dev_t,
153152 .wasi => wasi.device_t,
154153 .openbsd, .haiku, .illumos, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => i32,
154 // glibc and musl define dev_t as u64, while in Linux kernel it is u32.
155155 // https://github.com/SerenityOS/serenity/blob/b98f537f117b341788023ab82e0c11ca9ae29a57/Kernel/API/POSIX/sys/types.h#L43
156 .netbsd, .freebsd, .serenity => u64,
156 .linux, .netbsd, .freebsd, .serenity => u64,
157157 else => void,
158158};
159159
lib/std/os/linux.zig+1-1
......@@ -106,7 +106,7 @@ pub const user_desc = arch_bits.user_desc;
106106
107107pub const blkcnt_t = u64;
108108pub const blksize_t = u32;
109pub const dev_t = u64;
109pub const dev_t = u32;
110110pub const ino_t = u64;
111111pub const mode_t = u32;
112112pub const nlink_t = u32;