authorgravatar for koachan@protonmail.comKoakuma <koachan@protonmail.com> 2022-03-13 16:14:47+07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-13 16:48:02-04:00
logcb3b1dd6ddee65d1811fb4058b5cc0f2c06d0139
tree966044929ac44f6fc79a9373b1157cbe437ab7de
parentbb859a0be7860a544aca1543cfd724435a24e380

c/linux: Fix `stat` struct definition for SPARCv9

The libc interface uses `stat` instead of `stat64` struct. This fixes, among other things, `zig fmt` accidentally setting the formatted file's permission to 000.

1 files changed, 4 insertions(+), 3 deletions(-)

lib/std/c/linux.zig+4-3
...@@ -117,14 +117,15 @@ pub const _errno = switch (native_abi) {...@@ -117,14 +117,15 @@ pub const _errno = switch (native_abi) {
117pub const Stat = switch (native_arch) {117pub const Stat = switch (native_arch) {
118 .sparcv9 => extern struct {118 .sparcv9 => extern struct {
119 dev: u64,119 dev: u64,
120 __pad1: u16,
120 ino: ino_t,121 ino: ino_t,
121 mode: u32,122 mode: u32,
122 nlink: usize,123 nlink: u32,
123124
124 uid: u32,125 uid: u32,
125 gid: u32,126 gid: u32,
126 rdev: u64,127 rdev: u64,
127 __pad0: u32,128 __pad2: u16,
128129
129 size: off_t,130 size: off_t,
130 blksize: isize,131 blksize: isize,
...@@ -133,7 +134,7 @@ pub const Stat = switch (native_arch) {...@@ -133,7 +134,7 @@ pub const Stat = switch (native_arch) {
133 atim: timespec,134 atim: timespec,
134 mtim: timespec,135 mtim: timespec,
135 ctim: timespec,136 ctim: timespec,
136 __unused: [2]isize,137 __reserved: [2]usize,
137138
138 pub fn atime(self: @This()) timespec {139 pub fn atime(self: @This()) timespec {
139 return self.atim;140 return self.atim;