authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-31 03:27:07+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-31 03:31:58+02:00
log537cb49eb241521bf58df8510c1c86aea60eb84f
treedb817a32b0f86e5e123ccf449a4fd1bbd15e19da
parente084c46ed6906dc51724d99b29f0992272384f5a
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.os.linux: Define the Stat struct for riscv32.

The kernel does define the struct, it just doesn't use it. Yet both glibc and musl expose it directly as their public stat struct, and std.c takes it from std.os.linux. So just define it after all.

1 files changed, 31 insertions(+), 2 deletions(-)

lib/std/os/linux/riscv32.zig+31-2
......@@ -212,8 +212,37 @@ pub const msghdr_const = extern struct {
212212 flags: i32,
213213};
214214
215/// No `Stat` structure on this platform, only `Statx`.
216pub const Stat = void;
215// The `stat` definition used by the Linux kernel.
216pub const Stat = extern struct {
217 dev: dev_t,
218 ino: ino_t,
219 mode: mode_t,
220 nlink: nlink_t,
221 uid: uid_t,
222 gid: gid_t,
223 rdev: dev_t,
224 __pad: usize,
225 size: off_t,
226 blksize: blksize_t,
227 __pad2: i32,
228 blocks: blkcnt_t,
229 atim: timespec,
230 mtim: timespec,
231 ctim: timespec,
232 __unused: [2]u32,
233
234 pub fn atime(self: @This()) timespec {
235 return self.atim;
236 }
237
238 pub fn mtime(self: @This()) timespec {
239 return self.mtim;
240 }
241
242 pub fn ctime(self: @This()) timespec {
243 return self.ctim;
244 }
245};
217246
218247pub const Elf_Symndx = u32;
219248