authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-17 01:01:27+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-17 01:20:33+02:00
logaa8e53908a355f42551b7fb51cf78b197bfbd851
treec02533db908fd2f541be40e8d58466a98294deff
parentdc1bc52dd6c10b99041f9e6189d6fd3541c714c4
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.os.linux: clean up a bunch of dead consts


16 files changed, 153 insertions(+), 338 deletions(-)

lib/std/os/linux/aarch64.zig+10-22
...@@ -1,18 +1,6 @@...@@ -1,18 +1,6 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const std = @import("../../std.zig");2const std = @import("../../std.zig");
3const maxInt = std.math.maxInt;3const SYS = std.os.linux.SYS;
4const linux = std.os.linux;
5const SYS = linux.SYS;
6const socklen_t = linux.socklen_t;
7const sockaddr = linux.sockaddr;
8const iovec = std.posix.iovec;
9const iovec_const = std.posix.iovec_const;
10const uid_t = linux.uid_t;
11const gid_t = linux.gid_t;
12const pid_t = linux.pid_t;
13const stack_t = linux.stack_t;
14const sigset_t = linux.sigset_t;
15const timespec = std.os.linux.timespec;
164
17pub fn syscall0(number: SYS) u64 {5pub fn syscall0(number: SYS) u64 {
18 return asm volatile ("svc #0"6 return asm volatile ("svc #0"
...@@ -135,7 +123,7 @@ pub fn clone() callconv(.naked) u64 {...@@ -135,7 +123,7 @@ pub fn clone() callconv(.naked) u64 {
135pub const restore = restore_rt;123pub const restore = restore_rt;
136124
137pub fn restore_rt() callconv(.naked) noreturn {125pub fn restore_rt() callconv(.naked) noreturn {
138 switch (@import("builtin").zig_backend) {126 switch (builtin.zig_backend) {
139 .stage2_c => asm volatile (127 .stage2_c => asm volatile (
140 \\ mov x8, %[number]128 \\ mov x8, %[number]
141 \\ svc #0129 \\ svc #0
...@@ -170,28 +158,28 @@ pub const Stat = extern struct {...@@ -170,28 +158,28 @@ pub const Stat = extern struct {
170 ino: ino_t,158 ino: ino_t,
171 mode: mode_t,159 mode: mode_t,
172 nlink: nlink_t,160 nlink: nlink_t,
173 uid: uid_t,161 uid: std.os.linux.uid_t,
174 gid: gid_t,162 gid: std.os.linux.gid_t,
175 rdev: dev_t,163 rdev: dev_t,
176 __pad: u64,164 __pad: u64,
177 size: off_t,165 size: off_t,
178 blksize: blksize_t,166 blksize: blksize_t,
179 __pad2: i32,167 __pad2: i32,
180 blocks: blkcnt_t,168 blocks: blkcnt_t,
181 atim: timespec,169 atim: std.os.linux.timespec,
182 mtim: timespec,170 mtim: std.os.linux.timespec,
183 ctim: timespec,171 ctim: std.os.linux.timespec,
184 __unused: [2]u32,172 __unused: [2]u32,
185173
186 pub fn atime(self: @This()) timespec {174 pub fn atime(self: @This()) std.os.linux.timespec {
187 return self.atim;175 return self.atim;
188 }176 }
189177
190 pub fn mtime(self: @This()) timespec {178 pub fn mtime(self: @This()) std.os.linux.timespec {
191 return self.mtim;179 return self.mtim;
192 }180 }
193181
194 pub fn ctime(self: @This()) timespec {182 pub fn ctime(self: @This()) std.os.linux.timespec {
195 return self.ctim;183 return self.ctim;
196 }184 }
197};185};
lib/std/os/linux/arm.zig+12-23
...@@ -1,17 +1,6 @@...@@ -1,17 +1,6 @@
1const builtin = @import("builtin");
1const std = @import("../../std.zig");2const std = @import("../../std.zig");
2const maxInt = std.math.maxInt;3const SYS = std.os.linux.SYS;
3const linux = std.os.linux;
4const SYS = linux.SYS;
5const iovec = std.posix.iovec;
6const iovec_const = std.posix.iovec_const;
7const socklen_t = linux.socklen_t;
8const stack_t = linux.stack_t;
9const sigset_t = linux.sigset_t;
10const uid_t = linux.uid_t;
11const gid_t = linux.gid_t;
12const pid_t = linux.pid_t;
13const sockaddr = linux.sockaddr;
14const timespec = linux.timespec;
154
16pub fn syscall0(number: SYS) u32 {5pub fn syscall0(number: SYS) u32 {
17 return asm volatile ("svc #0"6 return asm volatile ("svc #0"
...@@ -128,7 +117,7 @@ pub fn clone() callconv(.naked) u32 {...@@ -128,7 +117,7 @@ pub fn clone() callconv(.naked) u32 {
128}117}
129118
130pub fn restore() callconv(.naked) noreturn {119pub fn restore() callconv(.naked) noreturn {
131 switch (@import("builtin").zig_backend) {120 switch (builtin.zig_backend) {
132 .stage2_c => asm volatile (121 .stage2_c => asm volatile (
133 \\ mov r7, %[number]122 \\ mov r7, %[number]
134 \\ svc #0123 \\ svc #0
...@@ -144,7 +133,7 @@ pub fn restore() callconv(.naked) noreturn {...@@ -144,7 +133,7 @@ pub fn restore() callconv(.naked) noreturn {
144}133}
145134
146pub fn restore_rt() callconv(.naked) noreturn {135pub fn restore_rt() callconv(.naked) noreturn {
147 switch (@import("builtin").zig_backend) {136 switch (builtin.zig_backend) {
148 .stage2_c => asm volatile (137 .stage2_c => asm volatile (
149 \\ mov r7, %[number]138 \\ mov r7, %[number]
150 \\ svc #0139 \\ svc #0
...@@ -206,27 +195,27 @@ pub const Stat = extern struct {...@@ -206,27 +195,27 @@ pub const Stat = extern struct {
206 __ino_truncated: u32,195 __ino_truncated: u32,
207 mode: mode_t,196 mode: mode_t,
208 nlink: nlink_t,197 nlink: nlink_t,
209 uid: uid_t,198 uid: std.os.linux.uid_t,
210 gid: gid_t,199 gid: std.os.linux.gid_t,
211 rdev: dev_t,200 rdev: dev_t,
212 __rdev_padding: u32,201 __rdev_padding: u32,
213 size: off_t,202 size: off_t,
214 blksize: blksize_t,203 blksize: blksize_t,
215 blocks: blkcnt_t,204 blocks: blkcnt_t,
216 atim: timespec,205 atim: std.os.linux.timespec,
217 mtim: timespec,206 mtim: std.os.linux.timespec,
218 ctim: timespec,207 ctim: std.os.linux.timespec,
219 ino: ino_t,208 ino: ino_t,
220209
221 pub fn atime(self: @This()) timespec {210 pub fn atime(self: @This()) std.os.linux.timespec {
222 return self.atim;211 return self.atim;
223 }212 }
224213
225 pub fn mtime(self: @This()) timespec {214 pub fn mtime(self: @This()) std.os.linux.timespec {
226 return self.mtim;215 return self.mtim;
227 }216 }
228217
229 pub fn ctime(self: @This()) timespec {218 pub fn ctime(self: @This()) std.os.linux.timespec {
230 return self.ctim;219 return self.ctim;
231 }220 }
232};221};
lib/std/os/linux/hexagon.zig+9-20
...@@ -1,17 +1,6 @@...@@ -1,17 +1,6 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const std = @import("../../std.zig");2const std = @import("../../std.zig");
3const iovec = std.posix.iovec;3const SYS = std.os.linux.SYS;
4const iovec_const = std.posix.iovec_const;
5const linux = std.os.linux;
6const SYS = linux.SYS;
7const uid_t = std.os.linux.uid_t;
8const gid_t = std.os.linux.gid_t;
9const pid_t = std.os.linux.pid_t;
10const sockaddr = linux.sockaddr;
11const socklen_t = linux.socklen_t;
12const stack_t = linux.stack_t;
13const sigset_t = linux.sigset_t;
14const timespec = std.os.linux.timespec;
154
16pub fn syscall0(number: SYS) u32 {5pub fn syscall0(number: SYS) u32 {
17 return asm volatile ("trap0(#1)"6 return asm volatile ("trap0(#1)"
...@@ -145,28 +134,28 @@ pub const Stat = extern struct {...@@ -145,28 +134,28 @@ pub const Stat = extern struct {
145 ino: ino_t,134 ino: ino_t,
146 mode: mode_t,135 mode: mode_t,
147 nlink: nlink_t,136 nlink: nlink_t,
148 uid: uid_t,137 uid: std.os.linux.uid_t,
149 gid: gid_t,138 gid: std.os.linux.gid_t,
150 rdev: dev_t,139 rdev: dev_t,
151 __pad: u32,140 __pad: u32,
152 size: off_t,141 size: off_t,
153 blksize: blksize_t,142 blksize: blksize_t,
154 __pad2: i32,143 __pad2: i32,
155 blocks: blkcnt_t,144 blocks: blkcnt_t,
156 atim: timespec,145 atim: std.os.linux.timespec,
157 mtim: timespec,146 mtim: std.os.linux.timespec,
158 ctim: timespec,147 ctim: std.os.linux.timespec,
159 __unused: [2]u32,148 __unused: [2]u32,
160149
161 pub fn atime(self: @This()) timespec {150 pub fn atime(self: @This()) std.os.linux.timespec {
162 return self.atim;151 return self.atim;
163 }152 }
164153
165 pub fn mtime(self: @This()) timespec {154 pub fn mtime(self: @This()) std.os.linux.timespec {
166 return self.mtim;155 return self.mtim;
167 }156 }
168157
169 pub fn ctime(self: @This()) timespec {158 pub fn ctime(self: @This()) std.os.linux.timespec {
170 return self.ctim;159 return self.ctim;
171 }160 }
172};161};
lib/std/os/linux/loongarch64.zig+9-19
...@@ -1,16 +1,6 @@...@@ -1,16 +1,6 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const std = @import("../../std.zig");2const std = @import("../../std.zig");
3const linux = std.os.linux;3const SYS = std.os.linux.SYS;
4const SYS = linux.SYS;
5const iovec = std.posix.iovec;
6const iovec_const = std.posix.iovec_const;
7const uid_t = linux.uid_t;
8const gid_t = linux.gid_t;
9const stack_t = linux.stack_t;
10const sigset_t = linux.sigset_t;
11const sockaddr = linux.sockaddr;
12const socklen_t = linux.socklen_t;
13const timespec = linux.timespec;
144
15pub fn syscall0(number: SYS) u64 {5pub fn syscall0(number: SYS) u64 {
16 return asm volatile (6 return asm volatile (
...@@ -150,28 +140,28 @@ pub const Stat = extern struct {...@@ -150,28 +140,28 @@ pub const Stat = extern struct {
150 ino: ino_t,140 ino: ino_t,
151 mode: mode_t,141 mode: mode_t,
152 nlink: nlink_t,142 nlink: nlink_t,
153 uid: uid_t,143 uid: std.os.linux.uid_t,
154 gid: gid_t,144 gid: std.os.linux.gid_t,
155 rdev: dev_t,145 rdev: dev_t,
156 _pad1: u64,146 _pad1: u64,
157 size: off_t,147 size: off_t,
158 blksize: blksize_t,148 blksize: blksize_t,
159 _pad2: i32,149 _pad2: i32,
160 blocks: blkcnt_t,150 blocks: blkcnt_t,
161 atim: timespec,151 atim: std.os.linux.timespec,
162 mtim: timespec,152 mtim: std.os.linux.timespec,
163 ctim: timespec,153 ctim: std.os.linux.timespec,
164 _pad3: [2]u32,154 _pad3: [2]u32,
165155
166 pub fn atime(self: @This()) timespec {156 pub fn atime(self: @This()) std.os.linux.timespec {
167 return self.atim;157 return self.atim;
168 }158 }
169159
170 pub fn mtime(self: @This()) timespec {160 pub fn mtime(self: @This()) std.os.linux.timespec {
171 return self.mtim;161 return self.mtim;
172 }162 }
173163
174 pub fn ctime(self: @This()) timespec {164 pub fn ctime(self: @This()) std.os.linux.timespec {
175 return self.ctim;165 return self.ctim;
176 }166 }
177};167};
lib/std/os/linux/m68k.zig+9-18
...@@ -1,15 +1,6 @@...@@ -1,15 +1,6 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const std = @import("../../std.zig");2const std = @import("../../std.zig");
3const iovec = std.posix.iovec;3const SYS = std.os.linux.SYS;
4const iovec_const = std.posix.iovec_const;
5const linux = std.os.linux;
6const SYS = linux.SYS;
7const uid_t = std.os.linux.uid_t;
8const gid_t = std.os.linux.uid_t;
9const pid_t = std.os.linux.pid_t;
10const sockaddr = linux.sockaddr;
11const socklen_t = linux.socklen_t;
12const timespec = std.os.linux.timespec;
134
14pub fn syscall0(number: SYS) u32 {5pub fn syscall0(number: SYS) u32 {
15 return asm volatile ("trap #0"6 return asm volatile ("trap #0"
...@@ -166,27 +157,27 @@ pub const Stat = extern struct {...@@ -166,27 +157,27 @@ pub const Stat = extern struct {
166 __ino_truncated: i32,157 __ino_truncated: i32,
167 mode: mode_t,158 mode: mode_t,
168 nlink: nlink_t,159 nlink: nlink_t,
169 uid: uid_t,160 uid: std.os.linux.uid_t,
170 gid: gid_t,161 gid: std.os.linux.gid_t,
171 rdev: dev_t,162 rdev: dev_t,
172 __pad2: i16,163 __pad2: i16,
173 size: off_t,164 size: off_t,
174 blksize: blksize_t,165 blksize: blksize_t,
175 blocks: blkcnt_t,166 blocks: blkcnt_t,
176 atim: timespec,167 atim: std.os.linux.timespec,
177 mtim: timespec,168 mtim: std.os.linux.timespec,
178 ctim: timespec,169 ctim: std.os.linux.timespec,
179 ino: ino_t,170 ino: ino_t,
180171
181 pub fn atime(self: @This()) timespec {172 pub fn atime(self: @This()) std.os.linux.timespec {
182 return self.atim;173 return self.atim;
183 }174 }
184175
185 pub fn mtime(self: @This()) timespec {176 pub fn mtime(self: @This()) std.os.linux.timespec {
186 return self.mtim;177 return self.mtim;
187 }178 }
188179
189 pub fn ctime(self: @This()) timespec {180 pub fn ctime(self: @This()) std.os.linux.timespec {
190 return self.ctim;181 return self.ctim;
191 }182 }
192};183};
lib/std/os/linux/mips.zig+12-36
...@@ -1,18 +1,6 @@...@@ -1,18 +1,6 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const std = @import("../../std.zig");2const std = @import("../../std.zig");
3const maxInt = std.math.maxInt;3const SYS = std.os.linux.SYS;
4const linux = std.os.linux;
5const SYS = linux.SYS;
6const socklen_t = linux.socklen_t;
7const iovec = std.posix.iovec;
8const iovec_const = std.posix.iovec_const;
9const uid_t = linux.uid_t;
10const gid_t = linux.gid_t;
11const pid_t = linux.pid_t;
12const stack_t = linux.stack_t;
13const sigset_t = linux.sigset_t;
14const sockaddr = linux.sockaddr;
15const timespec = linux.timespec;
164
17pub fn syscall0(number: SYS) u32 {5pub fn syscall0(number: SYS) u32 {
18 return asm volatile (6 return asm volatile (
...@@ -264,39 +252,27 @@ pub const Stat = extern struct {...@@ -264,39 +252,27 @@ pub const Stat = extern struct {
264 ino: ino_t,252 ino: ino_t,
265 mode: mode_t,253 mode: mode_t,
266 nlink: nlink_t,254 nlink: nlink_t,
267 uid: uid_t,255 uid: std.os.linux.uid_t,
268 gid: gid_t,256 gid: std.os.linux.gid_t,
269 rdev: dev_t,257 rdev: dev_t,
270 __pad1: [2]u32,258 __pad1: [2]u32,
271 size: off_t,259 size: off_t,
272 atim: i32,260 atim: std.os.linux.timespec,
273 atim_nsec: i32,261 mtim: std.os.linux.timespec,
274 mtim: i32,262 ctim: std.os.linux.timespec,
275 mtim_nsec: i32,
276 ctim: i32,
277 ctim_nsec: i32,
278 blksize: blksize_t,263 blksize: blksize_t,
279 __pad3: u32,264 __pad3: u32,
280 blocks: blkcnt_t,265 blocks: blkcnt_t,
281266
282 pub fn atime(self: @This()) timespec {267 pub fn atime(self: @This()) std.os.linux.timespec {
283 return .{268 return self.atim;
284 .sec = self.atim,
285 .nsec = self.atim_nsec,
286 };
287 }269 }
288270
289 pub fn mtime(self: @This()) timespec {271 pub fn mtime(self: @This()) std.os.linux.timespec {
290 return .{272 return self.mtim;
291 .sec = self.mtim,
292 .nsec = self.mtim_nsec,
293 };
294 }273 }
295274
296 pub fn ctime(self: @This()) timespec {275 pub fn ctime(self: @This()) std.os.linux.timespec {
297 return .{276 return self.ctim;
298 .sec = self.ctim,
299 .nsec = self.ctim_nsec,
300 };
301 }277 }
302};278};
lib/std/os/linux/mips64.zig+6-18
...@@ -1,18 +1,6 @@...@@ -1,18 +1,6 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const std = @import("../../std.zig");2const std = @import("../../std.zig");
3const maxInt = std.math.maxInt;3const SYS = std.os.linux.SYS;
4const linux = std.os.linux;
5const SYS = linux.SYS;
6const socklen_t = linux.socklen_t;
7const iovec = std.posix.iovec;
8const iovec_const = std.posix.iovec_const;
9const uid_t = linux.uid_t;
10const gid_t = linux.gid_t;
11const pid_t = linux.pid_t;
12const stack_t = linux.stack_t;
13const sigset_t = linux.sigset_t;
14const sockaddr = linux.sockaddr;
15const timespec = linux.timespec;
164
17pub fn syscall0(number: SYS) u64 {5pub fn syscall0(number: SYS) u64 {
18 return asm volatile (6 return asm volatile (
...@@ -243,8 +231,8 @@ pub const Stat = extern struct {...@@ -243,8 +231,8 @@ pub const Stat = extern struct {
243 ino: ino_t,231 ino: ino_t,
244 mode: mode_t,232 mode: mode_t,
245 nlink: nlink_t,233 nlink: nlink_t,
246 uid: uid_t,234 uid: std.os.linux.uid_t,
247 gid: gid_t,235 gid: std.os.linux.gid_t,
248 rdev: dev_t,236 rdev: dev_t,
249 __pad1: [2]u32, // -1 because our dev_t is u64 (kernel dev_t is really u32).237 __pad1: [2]u32, // -1 because our dev_t is u64 (kernel dev_t is really u32).
250 size: off_t,238 size: off_t,
...@@ -258,21 +246,21 @@ pub const Stat = extern struct {...@@ -258,21 +246,21 @@ pub const Stat = extern struct {
258 __pad3: u32,246 __pad3: u32,
259 blocks: blkcnt_t,247 blocks: blkcnt_t,
260248
261 pub fn atime(self: @This()) timespec {249 pub fn atime(self: @This()) std.os.linux.timespec {
262 return .{250 return .{
263 .sec = self.atim,251 .sec = self.atim,
264 .nsec = self.atim_nsec,252 .nsec = self.atim_nsec,
265 };253 };
266 }254 }
267255
268 pub fn mtime(self: @This()) timespec {256 pub fn mtime(self: @This()) std.os.linux.timespec {
269 return .{257 return .{
270 .sec = self.mtim,258 .sec = self.mtim,
271 .nsec = self.mtim_nsec,259 .nsec = self.mtim_nsec,
272 };260 };
273 }261 }
274262
275 pub fn ctime(self: @This()) timespec {263 pub fn ctime(self: @This()) std.os.linux.timespec {
276 return .{264 return .{
277 .sec = self.ctim,265 .sec = self.ctim,
278 .nsec = self.ctim_nsec,266 .nsec = self.ctim_nsec,
lib/std/os/linux/powerpc.zig+10-22
...@@ -1,18 +1,6 @@...@@ -1,18 +1,6 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const std = @import("../../std.zig");2const std = @import("../../std.zig");
3const maxInt = std.math.maxInt;3const SYS = std.os.linux.SYS;
4const linux = std.os.linux;
5const SYS = linux.SYS;
6const socklen_t = linux.socklen_t;
7const iovec = std.posix.iovec;
8const iovec_const = std.posix.iovec_const;
9const uid_t = linux.uid_t;
10const gid_t = linux.gid_t;
11const pid_t = linux.pid_t;
12const stack_t = linux.stack_t;
13const sigset_t = linux.sigset_t;
14const sockaddr = linux.sockaddr;
15const timespec = linux.timespec;
164
17pub fn syscall0(number: SYS) u32 {5pub fn syscall0(number: SYS) u32 {
18 // r0 is both an input register and a clobber. musl and glibc achieve this with6 // r0 is both an input register and a clobber. musl and glibc achieve this with
...@@ -247,7 +235,7 @@ pub fn clone() callconv(.naked) u32 {...@@ -247,7 +235,7 @@ pub fn clone() callconv(.naked) u32 {
247pub const restore = restore_rt;235pub const restore = restore_rt;
248236
249pub fn restore_rt() callconv(.naked) noreturn {237pub fn restore_rt() callconv(.naked) noreturn {
250 switch (@import("builtin").zig_backend) {238 switch (builtin.zig_backend) {
251 .stage2_c => asm volatile (239 .stage2_c => asm volatile (
252 \\ li 0, %[number]240 \\ li 0, %[number]
253 \\ sc241 \\ sc
...@@ -282,27 +270,27 @@ pub const Stat = extern struct {...@@ -282,27 +270,27 @@ pub const Stat = extern struct {
282 ino: ino_t,270 ino: ino_t,
283 mode: mode_t,271 mode: mode_t,
284 nlink: nlink_t,272 nlink: nlink_t,
285 uid: uid_t,273 uid: std.os.linux.uid_t,
286 gid: gid_t,274 gid: std.os.linux.gid_t,
287 rdev: dev_t,275 rdev: dev_t,
288 __rdev_padding: i16,276 __rdev_padding: i16,
289 size: off_t,277 size: off_t,
290 blksize: blksize_t,278 blksize: blksize_t,
291 blocks: blkcnt_t,279 blocks: blkcnt_t,
292 atim: timespec,280 atim: std.os.linux.timespec,
293 mtim: timespec,281 mtim: std.os.linux.timespec,
294 ctim: timespec,282 ctim: std.os.linux.timespec,
295 __unused: [2]u32,283 __unused: [2]u32,
296284
297 pub fn atime(self: @This()) timespec {285 pub fn atime(self: @This()) std.os.linux.timespec {
298 return self.atim;286 return self.atim;
299 }287 }
300288
301 pub fn mtime(self: @This()) timespec {289 pub fn mtime(self: @This()) std.os.linux.timespec {
302 return self.mtim;290 return self.mtim;
303 }291 }
304292
305 pub fn ctime(self: @This()) timespec {293 pub fn ctime(self: @This()) std.os.linux.timespec {
306 return self.ctim;294 return self.ctim;
307 }295 }
308};296};
lib/std/os/linux/powerpc64.zig+10-22
...@@ -1,18 +1,6 @@...@@ -1,18 +1,6 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const std = @import("../../std.zig");2const std = @import("../../std.zig");
3const maxInt = std.math.maxInt;3const SYS = std.os.linux.SYS;
4const linux = std.os.linux;
5const SYS = linux.SYS;
6const socklen_t = linux.socklen_t;
7const iovec = std.posix.iovec;
8const iovec_const = std.posix.iovec_const;
9const uid_t = linux.uid_t;
10const gid_t = linux.gid_t;
11const pid_t = linux.pid_t;
12const stack_t = linux.stack_t;
13const sigset_t = linux.sigset_t;
14const sockaddr = linux.sockaddr;
15const timespec = linux.timespec;
164
17pub fn syscall0(number: SYS) u64 {5pub fn syscall0(number: SYS) u64 {
18 // r0 is both an input register and a clobber. musl and glibc achieve this with6 // r0 is both an input register and a clobber. musl and glibc achieve this with
...@@ -232,7 +220,7 @@ pub fn clone() callconv(.naked) u64 {...@@ -232,7 +220,7 @@ pub fn clone() callconv(.naked) u64 {
232pub const restore = restore_rt;220pub const restore = restore_rt;
233221
234pub fn restore_rt() callconv(.naked) noreturn {222pub fn restore_rt() callconv(.naked) noreturn {
235 switch (@import("builtin").zig_backend) {223 switch (builtin.zig_backend) {
236 .stage2_c => asm volatile (224 .stage2_c => asm volatile (
237 \\ li 0, %[number]225 \\ li 0, %[number]
238 \\ sc226 \\ sc
...@@ -267,26 +255,26 @@ pub const Stat = extern struct {...@@ -267,26 +255,26 @@ pub const Stat = extern struct {
267 ino: ino_t,255 ino: ino_t,
268 nlink: nlink_t,256 nlink: nlink_t,
269 mode: mode_t,257 mode: mode_t,
270 uid: uid_t,258 uid: std.os.linux.uid_t,
271 gid: gid_t,259 gid: std.os.linux.gid_t,
272 rdev: dev_t,260 rdev: dev_t,
273 size: off_t,261 size: off_t,
274 blksize: blksize_t,262 blksize: blksize_t,
275 blocks: blkcnt_t,263 blocks: blkcnt_t,
276 atim: timespec,264 atim: std.os.linux.timespec,
277 mtim: timespec,265 mtim: std.os.linux.timespec,
278 ctim: timespec,266 ctim: std.os.linux.timespec,
279 __unused: [3]u64,267 __unused: [3]u64,
280268
281 pub fn atime(self: @This()) timespec {269 pub fn atime(self: @This()) std.os.linux.timespec {
282 return self.atim;270 return self.atim;
283 }271 }
284272
285 pub fn mtime(self: @This()) timespec {273 pub fn mtime(self: @This()) std.os.linux.timespec {
286 return self.mtim;274 return self.mtim;
287 }275 }
288276
289 pub fn ctime(self: @This()) timespec {277 pub fn ctime(self: @This()) std.os.linux.timespec {
290 return self.ctim;278 return self.ctim;
291 }279 }
292};280};
lib/std/os/linux/riscv32.zig+9-20
...@@ -1,17 +1,6 @@...@@ -1,17 +1,6 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const std = @import("../../std.zig");2const std = @import("../../std.zig");
3const iovec = std.posix.iovec;3const SYS = std.os.linux.SYS;
4const iovec_const = std.posix.iovec_const;
5const linux = std.os.linux;
6const SYS = linux.SYS;
7const uid_t = std.os.linux.uid_t;
8const gid_t = std.os.linux.gid_t;
9const pid_t = std.os.linux.pid_t;
10const stack_t = linux.stack_t;
11const sigset_t = linux.sigset_t;
12const sockaddr = linux.sockaddr;
13const socklen_t = linux.socklen_t;
14const timespec = std.os.linux.timespec;
154
16pub fn syscall0(number: SYS) u32 {5pub fn syscall0(number: SYS) u32 {
17 return asm volatile ("ecall"6 return asm volatile ("ecall"
...@@ -150,28 +139,28 @@ pub const Stat = extern struct {...@@ -150,28 +139,28 @@ pub const Stat = extern struct {
150 ino: ino_t,139 ino: ino_t,
151 mode: mode_t,140 mode: mode_t,
152 nlink: nlink_t,141 nlink: nlink_t,
153 uid: uid_t,142 uid: std.os.linux.uid_t,
154 gid: gid_t,143 gid: std.os.linux.gid_t,
155 rdev: dev_t,144 rdev: dev_t,
156 __pad: u32,145 __pad: u32,
157 size: off_t,146 size: off_t,
158 blksize: blksize_t,147 blksize: blksize_t,
159 __pad2: i32,148 __pad2: i32,
160 blocks: blkcnt_t,149 blocks: blkcnt_t,
161 atim: timespec,150 atim: std.os.linux.timespec,
162 mtim: timespec,151 mtim: std.os.linux.timespec,
163 ctim: timespec,152 ctim: std.os.linux.timespec,
164 __unused: [2]u32,153 __unused: [2]u32,
165154
166 pub fn atime(self: @This()) timespec {155 pub fn atime(self: @This()) std.os.linux.timespec {
167 return self.atim;156 return self.atim;
168 }157 }
169158
170 pub fn mtime(self: @This()) timespec {159 pub fn mtime(self: @This()) std.os.linux.timespec {
171 return self.mtim;160 return self.mtim;
172 }161 }
173162
174 pub fn ctime(self: @This()) timespec {163 pub fn ctime(self: @This()) std.os.linux.timespec {
175 return self.ctim;164 return self.ctim;
176 }165 }
177};166};
lib/std/os/linux/riscv64.zig+9-20
...@@ -1,17 +1,6 @@...@@ -1,17 +1,6 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const std = @import("../../std.zig");2const std = @import("../../std.zig");
3const iovec = std.posix.iovec;3const SYS = std.os.linux.SYS;
4const iovec_const = std.posix.iovec_const;
5const linux = std.os.linux;
6const SYS = linux.SYS;
7const uid_t = std.os.linux.uid_t;
8const gid_t = std.os.linux.gid_t;
9const pid_t = std.os.linux.pid_t;
10const stack_t = linux.stack_t;
11const sigset_t = linux.sigset_t;
12const sockaddr = linux.sockaddr;
13const socklen_t = linux.socklen_t;
14const timespec = std.os.linux.timespec;
154
16pub fn syscall0(number: SYS) u64 {5pub fn syscall0(number: SYS) u64 {
17 return asm volatile ("ecall"6 return asm volatile ("ecall"
...@@ -150,28 +139,28 @@ pub const Stat = extern struct {...@@ -150,28 +139,28 @@ pub const Stat = extern struct {
150 ino: ino_t,139 ino: ino_t,
151 mode: mode_t,140 mode: mode_t,
152 nlink: nlink_t,141 nlink: nlink_t,
153 uid: uid_t,142 uid: std.os.linux.uid_t,
154 gid: gid_t,143 gid: std.os.linux.gid_t,
155 rdev: dev_t,144 rdev: dev_t,
156 __pad: u64,145 __pad: u64,
157 size: off_t,146 size: off_t,
158 blksize: blksize_t,147 blksize: blksize_t,
159 __pad2: i32,148 __pad2: i32,
160 blocks: blkcnt_t,149 blocks: blkcnt_t,
161 atim: timespec,150 atim: std.os.linux.timespec,
162 mtim: timespec,151 mtim: std.os.linux.timespec,
163 ctim: timespec,152 ctim: std.os.linux.timespec,
164 __unused: [2]u32,153 __unused: [2]u32,
165154
166 pub fn atime(self: @This()) timespec {155 pub fn atime(self: @This()) std.os.linux.timespec {
167 return self.atim;156 return self.atim;
168 }157 }
169158
170 pub fn mtime(self: @This()) timespec {159 pub fn mtime(self: @This()) std.os.linux.timespec {
171 return self.mtim;160 return self.mtim;
172 }161 }
173162
174 pub fn ctime(self: @This()) timespec {163 pub fn ctime(self: @This()) std.os.linux.timespec {
175 return self.ctim;164 return self.ctim;
176 }165 }
177};166};
lib/std/os/linux/s390x.zig+9-20
...@@ -1,17 +1,6 @@...@@ -1,17 +1,6 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const std = @import("../../std.zig");2const std = @import("../../std.zig");
3const iovec = std.posix.iovec;3const SYS = std.os.linux.SYS;
4const iovec_const = std.posix.iovec_const;
5const linux = std.os.linux;
6const SYS = linux.SYS;
7const uid_t = std.os.linux.uid_t;
8const gid_t = std.os.linux.gid_t;
9const pid_t = std.os.linux.pid_t;
10const sockaddr = linux.sockaddr;
11const socklen_t = linux.socklen_t;
12const timespec = std.os.linux.timespec;
13const stack_t = std.os.linux.stack_t;
14const sigset_t = std.os.linux.sigset_t;
154
16pub fn syscall0(number: SYS) u64 {5pub fn syscall0(number: SYS) u64 {
17 return asm volatile ("svc 0"6 return asm volatile ("svc 0"
...@@ -172,26 +161,26 @@ pub const Stat = extern struct {...@@ -172,26 +161,26 @@ pub const Stat = extern struct {
172 ino: ino_t,161 ino: ino_t,
173 nlink: nlink_t,162 nlink: nlink_t,
174 mode: mode_t,163 mode: mode_t,
175 uid: uid_t,164 uid: std.os.linux.uid_t,
176 gid: gid_t,165 gid: std.os.linux.gid_t,
177 rdev: dev_t,166 rdev: dev_t,
178 size: off_t,167 size: off_t,
179 atim: timespec,168 atim: std.os.linux.timespec,
180 mtim: timespec,169 mtim: std.os.linux.timespec,
181 ctim: timespec,170 ctim: std.os.linux.timespec,
182 blksize: blksize_t,171 blksize: blksize_t,
183 blocks: blkcnt_t,172 blocks: blkcnt_t,
184 __unused: [3]c_ulong,173 __unused: [3]c_ulong,
185174
186 pub fn atime(self: @This()) timespec {175 pub fn atime(self: @This()) std.os.linux.timespec {
187 return self.atim;176 return self.atim;
188 }177 }
189178
190 pub fn mtime(self: @This()) timespec {179 pub fn mtime(self: @This()) std.os.linux.timespec {
191 return self.mtim;180 return self.mtim;
192 }181 }
193182
194 pub fn ctime(self: @This()) timespec {183 pub fn ctime(self: @This()) std.os.linux.timespec {
195 return self.ctim;184 return self.ctim;
196 }185 }
197};186};
lib/std/os/linux/sparc64.zig+17-29
...@@ -1,19 +1,6 @@...@@ -1,19 +1,6 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const std = @import("../../std.zig");2const std = @import("../../std.zig");
3const maxInt = std.math.maxInt;3const SYS = std.os.linux.SYS;
4const pid_t = linux.pid_t;
5const uid_t = linux.uid_t;
6const clock_t = linux.clock_t;
7const stack_t = linux.stack_t;
8const sigset_t = linux.sigset_t;
9
10const linux = std.os.linux;
11const SYS = linux.SYS;
12const sockaddr = linux.sockaddr;
13const socklen_t = linux.socklen_t;
14const iovec = std.posix.iovec;
15const iovec_const = std.posix.iovec_const;
16const timespec = linux.timespec;
174
18pub fn syscall_pipe(fd: *[2]i32) u64 {5pub fn syscall_pipe(fd: *[2]i32) u64 {
19 return asm volatile (6 return asm volatile (
...@@ -252,34 +239,35 @@ pub const blkcnt_t = i64;...@@ -252,34 +239,35 @@ pub const blkcnt_t = i64;
252239
253// The `stat64` definition used by the kernel.240// The `stat64` definition used by the kernel.
254pub const Stat = extern struct {241pub const Stat = extern struct {
255 dev: u64,242 dev: dev_t,
256 ino: u64,243 ino: ino_t,
257 nlink: u64,244 nlink: nlink_t,
245 _pad: i32,
258246
259 mode: u32,247 mode: mode_t,
260 uid: u32,248 uid: std.os.linux.uid_t,
261 gid: u32,249 gid: std.os.linux.gid_t,
262 __pad0: u32,250 __pad0: u32,
263251
264 rdev: u64,252 rdev: dev_t,
265 size: i64,253 size: i64,
266 blksize: i64,254 blksize: blksize_t,
267 blocks: i64,255 blocks: blkcnt_t,
268256
269 atim: timespec,257 atim: std.os.linux.timespec,
270 mtim: timespec,258 mtim: std.os.linux.timespec,
271 ctim: timespec,259 ctim: std.os.linux.timespec,
272 __unused: [3]u64,260 __unused: [3]u64,
273261
274 pub fn atime(self: @This()) timespec {262 pub fn atime(self: @This()) std.os.linux.timespec {
275 return self.atim;263 return self.atim;
276 }264 }
277265
278 pub fn mtime(self: @This()) timespec {266 pub fn mtime(self: @This()) std.os.linux.timespec {
279 return self.mtim;267 return self.mtim;
280 }268 }
281269
282 pub fn ctime(self: @This()) timespec {270 pub fn ctime(self: @This()) std.os.linux.timespec {
283 return self.ctim;271 return self.ctim;
284 }272 }
285};273};
lib/std/os/linux/thumb.zig+1-2
...@@ -4,8 +4,7 @@...@@ -4,8 +4,7 @@
4//! Save and restore r7 around the syscall without touching the stack pointer not4//! Save and restore r7 around the syscall without touching the stack pointer not
5//! to break the frame chain.5//! to break the frame chain.
6const std = @import("../../std.zig");6const std = @import("../../std.zig");
7const linux = std.os.linux;7const SYS = std.os.linux.SYS;
8const SYS = linux.SYS;
98
10pub fn syscall0(number: SYS) u32 {9pub fn syscall0(number: SYS) u32 {
11 var buf: [2]u32 = .{ @intFromEnum(number), undefined };10 var buf: [2]u32 = .{ @intFromEnum(number), undefined };
lib/std/os/linux/x86.zig+11-23
...@@ -1,18 +1,6 @@...@@ -1,18 +1,6 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const std = @import("../../std.zig");2const std = @import("../../std.zig");
3const maxInt = std.math.maxInt;3const SYS = std.os.linux.SYS;
4const linux = std.os.linux;
5const SYS = linux.SYS;
6const socklen_t = linux.socklen_t;
7const iovec = std.posix.iovec;
8const iovec_const = std.posix.iovec_const;
9const uid_t = linux.uid_t;
10const gid_t = linux.gid_t;
11const pid_t = linux.pid_t;
12const stack_t = linux.stack_t;
13const sigset_t = linux.sigset_t;
14const sockaddr = linux.sockaddr;
15const timespec = linux.timespec;
164
17pub fn syscall0(number: SYS) u32 {5pub fn syscall0(number: SYS) u32 {
18 return asm volatile ("int $0x80"6 return asm volatile ("int $0x80"
...@@ -169,7 +157,7 @@ pub fn clone() callconv(.naked) u32 {...@@ -169,7 +157,7 @@ pub fn clone() callconv(.naked) u32 {
169}157}
170158
171pub fn restore() callconv(.naked) noreturn {159pub fn restore() callconv(.naked) noreturn {
172 switch (@import("builtin").zig_backend) {160 switch (builtin.zig_backend) {
173 .stage2_c => asm volatile (161 .stage2_c => asm volatile (
174 \\ movl %[number], %%eax162 \\ movl %[number], %%eax
175 \\ int $0x80163 \\ int $0x80
...@@ -185,7 +173,7 @@ pub fn restore() callconv(.naked) noreturn {...@@ -185,7 +173,7 @@ pub fn restore() callconv(.naked) noreturn {
185}173}
186174
187pub fn restore_rt() callconv(.naked) noreturn {175pub fn restore_rt() callconv(.naked) noreturn {
188 switch (@import("builtin").zig_backend) {176 switch (builtin.zig_backend) {
189 .stage2_c => asm volatile (177 .stage2_c => asm volatile (
190 \\ movl %[number], %%eax178 \\ movl %[number], %%eax
191 \\ int $0x80179 \\ int $0x80
...@@ -221,27 +209,27 @@ pub const Stat = extern struct {...@@ -221,27 +209,27 @@ pub const Stat = extern struct {
221 __ino_truncated: u32,209 __ino_truncated: u32,
222 mode: mode_t,210 mode: mode_t,
223 nlink: nlink_t,211 nlink: nlink_t,
224 uid: uid_t,212 uid: std.os.linux.uid_t,
225 gid: gid_t,213 gid: std.os.linux.gid_t,
226 rdev: dev_t,214 rdev: dev_t,
227 __rdev_padding: u32,215 __rdev_padding: u32,
228 size: off_t,216 size: off_t,
229 blksize: blksize_t,217 blksize: blksize_t,
230 blocks: blkcnt_t,218 blocks: blkcnt_t,
231 atim: timespec,219 atim: std.os.linux.timespec,
232 mtim: timespec,220 mtim: std.os.linux.timespec,
233 ctim: timespec,221 ctim: std.os.linux.timespec,
234 ino: ino_t,222 ino: ino_t,
235223
236 pub fn atime(self: @This()) timespec {224 pub fn atime(self: @This()) std.os.linux.timespec {
237 return self.atim;225 return self.atim;
238 }226 }
239227
240 pub fn mtime(self: @This()) timespec {228 pub fn mtime(self: @This()) std.os.linux.timespec {
241 return self.mtim;229 return self.mtim;
242 }230 }
243231
244 pub fn ctime(self: @This()) timespec {232 pub fn ctime(self: @This()) std.os.linux.timespec {
245 return self.ctim;233 return self.ctim;
246 }234 }
247};235};
lib/std/os/linux/x86_64.zig+10-24
...@@ -1,20 +1,6 @@...@@ -1,20 +1,6 @@
1const builtin = @import("builtin");1const builtin = @import("builtin");
2const std = @import("../../std.zig");2const std = @import("../../std.zig");
3const maxInt = std.math.maxInt;3const SYS = std.os.linux.SYS;
4const linux = std.os.linux;
5const SYS = linux.SYS;
6const iovec = std.posix.iovec;
7const iovec_const = std.posix.iovec_const;
8
9const pid_t = linux.pid_t;
10const uid_t = linux.uid_t;
11const gid_t = linux.gid_t;
12const clock_t = linux.clock_t;
13const stack_t = linux.stack_t;
14const sigset_t = linux.sigset_t;
15const sockaddr = linux.sockaddr;
16const socklen_t = linux.socklen_t;
17const timespec = linux.timespec;
184
19pub fn syscall0(number: SYS) u64 {5pub fn syscall0(number: SYS) u64 {
20 return asm volatile ("syscall"6 return asm volatile ("syscall"
...@@ -131,7 +117,7 @@ pub fn clone() callconv(.naked) u64 {...@@ -131,7 +117,7 @@ pub fn clone() callconv(.naked) u64 {
131pub const restore = restore_rt;117pub const restore = restore_rt;
132118
133pub fn restore_rt() callconv(.naked) noreturn {119pub fn restore_rt() callconv(.naked) noreturn {
134 switch (@import("builtin").zig_backend) {120 switch (builtin.zig_backend) {
135 .stage2_c => asm volatile (121 .stage2_c => asm volatile (
136 \\ movl %[number], %%eax122 \\ movl %[number], %%eax
137 \\ syscall123 \\ syscall
...@@ -177,28 +163,28 @@ pub const Stat = extern struct {...@@ -177,28 +163,28 @@ pub const Stat = extern struct {
177 nlink: u64,163 nlink: u64,
178164
179 mode: u32,165 mode: u32,
180 uid: uid_t,166 uid: std.os.linux.uid_t,
181 gid: gid_t,167 gid: std.os.linux.gid_t,
182 __pad0: u32,168 __pad0: u32,
183 rdev: dev_t,169 rdev: dev_t,
184 size: off_t,170 size: off_t,
185 blksize: i64,171 blksize: i64,
186 blocks: i64,172 blocks: i64,
187173
188 atim: timespec,174 atim: std.os.linux.timespec,
189 mtim: timespec,175 mtim: std.os.linux.timespec,
190 ctim: timespec,176 ctim: std.os.linux.timespec,
191 __unused: [3]i64,177 __unused: [3]i64,
192178
193 pub fn atime(self: @This()) timespec {179 pub fn atime(self: @This()) std.os.linux.timespec {
194 return self.atim;180 return self.atim;
195 }181 }
196182
197 pub fn mtime(self: @This()) timespec {183 pub fn mtime(self: @This()) std.os.linux.timespec {
198 return self.mtim;184 return self.mtim;
199 }185 }
200186
201 pub fn ctime(self: @This()) timespec {187 pub fn ctime(self: @This()) std.os.linux.timespec {
202 return self.ctim;188 return self.ctim;
203 }189 }
204};190};