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
signaturelock-open 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 @@...@@ -1,11 +1,13 @@
1// arm64-specific declarations that are intended to be imported into the POSIX namespace.1// arm64-specific declarations that are intended to be imported into the POSIX namespace.
2// This does include Linux-only APIs.2// This does include Linux-only APIs.
33
4const std = @import("../../std.zig");4const std = @import("../../../std.zig");
5const linux = std.os.linux;5const linux = std.os.linux;
6const socklen_t = linux.socklen_t;6const socklen_t = linux.socklen_t;
7const iovec = linux.iovec;7const iovec = linux.iovec;
8const iovec_const = linux.iovec_const;8const iovec_const = linux.iovec_const;
9const uid_t = linux.uid_t;
10const gid_t = linux.gid_t;
911
10pub const SYS_io_setup = 0;12pub const SYS_io_setup = 0;
11pub const SYS_io_destroy = 1;13pub const SYS_io_destroy = 1;
...@@ -382,7 +384,14 @@ pub const msghdr_const = extern struct {...@@ -382,7 +384,14 @@ pub const msghdr_const = extern struct {
382 msg_flags: i32,384 msg_flags: i32,
383};385};
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
387/// Renamed to Stat to not conflict with the stat function.396/// Renamed to Stat to not conflict with the stat function.
388/// atime, mtime, and ctime have functions to return `timespec`,397/// atime, mtime, and ctime have functions to return `timespec`,
...@@ -391,23 +400,22 @@ pub const off_t = i64;...@@ -391,23 +400,22 @@ pub const off_t = i64;
391/// in C, macros are used to hide the differences. Here we use400/// in C, macros are used to hide the differences. Here we use
392/// methods to accomplish this.401/// methods to accomplish this.
393pub const Stat = extern struct {402pub const Stat = extern struct {
394 dev: u64,403 dev: dev_t,
395 ino: u64,404 ino: ino_t,
396 nlink: usize,405 mode: mode_t,
397406 nlink: nlink_t,
398 mode: u32,407 uid: uid_t,
399 uid: u32,408 gid: gid_t,
400 gid: u32,409 rdev: dev_t,
401 __pad0: u32,410 __pad: usize,
402 rdev: u64,
403 size: off_t,411 size: off_t,
404 blksize: isize,412 blksize: blksize_t,
405 blocks: i64,413 __pad2: i32,
406414 blocks: blkcnt_t,
407 atim: timespec,415 atim: timespec,
408 mtim: timespec,416 mtim: timespec,
409 ctim: timespec,417 ctim: timespec,
410 __unused: [3]isize,418 __unused: [2]u32,
411419
412 pub fn atime(self: Stat) timespec {420 pub fn atime(self: Stat) timespec {
413 return self.atim;421 return self.atim;
...@@ -423,7 +431,7 @@ pub const Stat = extern struct {...@@ -423,7 +431,7 @@ pub const Stat = extern struct {
423};431};
424432
425pub const timespec = extern struct {433pub const timespec = extern struct {
426 tv_sec: isize,434 tv_sec: time_t,
427 tv_nsec: isize,435 tv_nsec: isize,
428};436};
429437