authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-09-22 11:10:28-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-09-22 11:22:22-04:00
log2510edeb71cad68bd133fd1e3dce08f3a74bbdc7
tree11e986a494c692a062d05704ae3b453061f5a58b
parentdc2463d9a9c67aa495883325ca62b172402ab4db
signature Commit is signed but in an unrecognized format.

fix linux stat struct on aarch64

The ABI was incorrect.

1 files changed, 24 insertions(+), 16 deletions(-)

std/os/bits/linux/arm64.zig+24-16
......@@ -1,11 +1,13 @@
11// arm64-specific declarations that are intended to be imported into the POSIX namespace.
22// This does include Linux-only APIs.
33
4const std = @import("../../std.zig");
4const std = @import("../../../std.zig");
55const linux = std.os.linux;
66const socklen_t = linux.socklen_t;
77const iovec = linux.iovec;
88const iovec_const = linux.iovec_const;
9const uid_t = linux.uid_t;
10const gid_t = linux.gid_t;
911
1012pub const SYS_io_setup = 0;
1113pub const SYS_io_destroy = 1;
......@@ -382,7 +384,14 @@ pub const msghdr_const = extern struct {
382384 msg_flags: i32,
383385};
384386
385pub const off_t = i64;
387pub const blksize_t = i32;
388pub const nlink_t = u32;
389pub const time_t = isize;
390pub const mode_t = u32;
391pub const off_t = isize;
392pub const ino_t = usize;
393pub const dev_t = usize;
394pub const blkcnt_t = isize;
386395
387396/// Renamed to Stat to not conflict with the stat function.
388397/// atime, mtime, and ctime have functions to return `timespec`,
......@@ -391,23 +400,22 @@ pub const off_t = i64;
391400/// in C, macros are used to hide the differences. Here we use
392401/// methods to accomplish this.
393402pub const Stat = extern struct {
394 dev: u64,
395 ino: u64,
396 nlink: usize,
397
398 mode: u32,
399 uid: u32,
400 gid: u32,
401 __pad0: u32,
402 rdev: u64,
403 dev: dev_t,
404 ino: ino_t,
405 mode: mode_t,
406 nlink: nlink_t,
407 uid: uid_t,
408 gid: gid_t,
409 rdev: dev_t,
410 __pad: usize,
403411 size: off_t,
404 blksize: isize,
405 blocks: i64,
406
412 blksize: blksize_t,
413 __pad2: i32,
414 blocks: blkcnt_t,
407415 atim: timespec,
408416 mtim: timespec,
409417 ctim: timespec,
410 __unused: [3]isize,
418 __unused: [2]u32,
411419
412420 pub fn atime(self: Stat) timespec {
413421 return self.atim;
......@@ -423,7 +431,7 @@ pub const Stat = extern struct {
423431};
424432
425433pub const timespec = extern struct {
426 tv_sec: isize,
434 tv_sec: time_t,
427435 tv_nsec: isize,
428436};
429437