feature. See also
. The project being documented here (as the example) is the Zig library itself.
c.dirent
pub const dirent = switch (native_os)
File
Code
pub const dirent = switch (native_os) {
.linux, .emscripten => extern struct {
ino: ino_t,
off: off_t,
reclen: c_ushort,
type: u8,
name: [256]u8,
},
.driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => extern struct {
ino: u64,
seekoff: u64,
reclen: u16,
namlen: u16,
type: u8,
name: [1024]u8,
},
.freebsd => extern struct {
fileno: ino_t,
off: off_t,
reclen: u16,
type: u8,
pad0: u8 = 0,
namlen: u16,
pad1: u16 = 0,
name: [255:0]u8,
},
.illumos => extern struct {
ino: ino_t,
off: off_t,
reclen: u16,
name: [MAXNAMLEN:0]u8,
},
.netbsd => extern struct {
fileno: ino_t,
reclen: u16,
namlen: u16,
type: u8,
name: [MAXNAMLEN:0]u8,
},
.dragonfly => extern struct {
fileno: c_ulong,
namlen: u16,
type: u8,
unused1: u8,
unused2: u32,
name: [256]u8,
pub fn reclen(self: dirent) u16 {
return (@offsetOf(dirent, "name") + self.namlen + 1 + 7) & ~@as(u16, 7);
}
},
.openbsd => extern struct {
fileno: ino_t,
off: off_t,
reclen: u16,
type: u8,
namlen: u8,
_: u32 align(1) = 0,
name: [MAXNAMLEN:0]u8,
},
.serenity => extern struct {
ino: ino_t,
off: off_t,
reclen: c_ushort,
type: u8,
name: [255:0]u8,
},
else => void,
}