authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-16 23:38:18+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-17 01:20:31+02:00
logfc7a5f2ae49aa0a0c5e1f1dd1c5678ee3e49b1b6
tree1be2f1200504b2a60422a7939a40e274461b20ad
parent8970d80355e869b07582ef400e7a7a6b8a4de974
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.os.linux: move some generic decls out of the arch bits


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

lib/std/os/linux.zig+12-3
...@@ -88,7 +88,6 @@ pub fn clone(...@@ -88,7 +88,6 @@ pub fn clone(
88}88}
8989
90pub const ARCH = arch_bits.ARCH;90pub const ARCH = arch_bits.ARCH;
91pub const Elf_Symndx = arch_bits.Elf_Symndx;
92pub const F = arch_bits.F;91pub const F = arch_bits.F;
93pub const Flock = arch_bits.Flock;92pub const Flock = arch_bits.Flock;
94pub const HWCAP = arch_bits.HWCAP;93pub const HWCAP = arch_bits.HWCAP;
...@@ -103,8 +102,6 @@ pub const mode_t = arch_bits.mode_t;...@@ -103,8 +102,6 @@ pub const mode_t = arch_bits.mode_t;
103pub const nlink_t = arch_bits.nlink_t;102pub const nlink_t = arch_bits.nlink_t;
104pub const off_t = arch_bits.off_t;103pub const off_t = arch_bits.off_t;
105pub const time_t = arch_bits.time_t;104pub const time_t = arch_bits.time_t;
106pub const timeval = arch_bits.timeval;
107pub const timezone = arch_bits.timezone;
108pub const user_desc = arch_bits.user_desc;105pub const user_desc = arch_bits.user_desc;
109106
110pub const tls = @import("linux/tls.zig");107pub const tls = @import("linux/tls.zig");
...@@ -1611,6 +1608,8 @@ pub fn flock(fd: fd_t, operation: i32) usize {...@@ -1611,6 +1608,8 @@ pub fn flock(fd: fd_t, operation: i32) usize {
1611 return syscall2(.flock, @as(usize, @bitCast(@as(isize, fd))), @as(usize, @bitCast(@as(isize, operation))));1608 return syscall2(.flock, @as(usize, @bitCast(@as(isize, fd))), @as(usize, @bitCast(@as(isize, operation))));
1612}1609}
16131610
1611pub const Elf_Symndx = if (native_arch == .s390x) u64 else u32;
1612
1614// We must follow the C calling convention when we call into the VDSO1613// We must follow the C calling convention when we call into the VDSO
1615const VdsoClockGettime = *align(1) const fn (clockid_t, *timespec) callconv(.c) usize;1614const VdsoClockGettime = *align(1) const fn (clockid_t, *timespec) callconv(.c) usize;
1616var vdso_clock_gettime: ?VdsoClockGettime = &init_vdso_clock_gettime;1615var vdso_clock_gettime: ?VdsoClockGettime = &init_vdso_clock_gettime;
...@@ -8360,6 +8359,16 @@ pub const POSIX_FADV = switch (native_arch) {...@@ -8360,6 +8359,16 @@ pub const POSIX_FADV = switch (native_arch) {
8360 },8359 },
8361};8360};
83628361
8362pub const timeval = extern struct {
8363 tv_sec: isize,
8364 tv_usec: i64,
8365};
8366
8367pub const timezone = extern struct {
8368 minuteswest: i32,
8369 dsttime: i32,
8370};
8371
8363/// The timespec struct used by the kernel.8372/// The timespec struct used by the kernel.
8364pub const kernel_timespec = extern struct {8373pub const kernel_timespec = extern struct {
8365 sec: i64,8374 sec: i64,
lib/std/os/linux/aarch64.zig-12
...@@ -230,15 +230,3 @@ pub const Stat = extern struct {...@@ -230,15 +230,3 @@ pub const Stat = extern struct {
230 return self.ctim;230 return self.ctim;
231 }231 }
232};232};
233
234pub const timeval = extern struct {
235 sec: isize,
236 usec: isize,
237};
238
239pub const timezone = extern struct {
240 minuteswest: i32,
241 dsttime: i32,
242};
243
244pub const Elf_Symndx = u32;
lib/std/os/linux/arm.zig-12
...@@ -266,15 +266,3 @@ pub const Stat = extern struct {...@@ -266,15 +266,3 @@ pub const Stat = extern struct {
266 return self.ctim;266 return self.ctim;
267 }267 }
268};268};
269
270pub const timeval = extern struct {
271 sec: i32,
272 usec: i32,
273};
274
275pub const timezone = extern struct {
276 minuteswest: i32,
277 dsttime: i32,
278};
279
280pub const Elf_Symndx = u32;
lib/std/os/linux/hexagon.zig-7
...@@ -154,11 +154,6 @@ pub const F = struct {...@@ -154,11 +154,6 @@ pub const F = struct {
154 pub const GETOWNER_UIDS = 17;154 pub const GETOWNER_UIDS = 17;
155};155};
156156
157pub const timeval = extern struct {
158 sec: time_t,
159 usec: i32,
160};
161
162pub const Flock = extern struct {157pub const Flock = extern struct {
163 type: i16,158 type: i16,
164 whence: i16,159 whence: i16,
...@@ -209,6 +204,4 @@ pub const Stat = extern struct {...@@ -209,6 +204,4 @@ pub const Stat = extern struct {
209 }204 }
210};205};
211206
212pub const Elf_Symndx = u32;
213
214pub const VDSO = void;207pub const VDSO = void;
lib/std/os/linux/loongarch64.zig-7
...@@ -176,11 +176,6 @@ pub const Stat = extern struct {...@@ -176,11 +176,6 @@ pub const Stat = extern struct {
176 }176 }
177};177};
178178
179pub const timeval = extern struct {
180 tv_sec: time_t,
181 tv_usec: i64,
182};
183
184pub const F = struct {179pub const F = struct {
185 pub const DUPFD = 0;180 pub const DUPFD = 0;
186 pub const GETFD = 1;181 pub const GETFD = 1;
...@@ -209,5 +204,3 @@ pub const VDSO = struct {...@@ -209,5 +204,3 @@ pub const VDSO = struct {
209 pub const CGT_SYM = "__vdso_clock_gettime";204 pub const CGT_SYM = "__vdso_clock_gettime";
210 pub const CGT_VER = "LINUX_5.10";205 pub const CGT_VER = "LINUX_5.10";
211};206};
212
213pub const Elf_Symndx = u32;
lib/std/os/linux/m68k.zig-7
...@@ -186,11 +186,6 @@ pub const ino_t = u64;...@@ -186,11 +186,6 @@ pub const ino_t = u64;
186pub const dev_t = u64;186pub const dev_t = u64;
187pub const blkcnt_t = i64;187pub const blkcnt_t = i64;
188188
189pub const timeval = extern struct {
190 sec: time_t,
191 usec: i32,
192};
193
194pub const Flock = extern struct {189pub const Flock = extern struct {
195 type: i16,190 type: i16,
196 whence: i16,191 whence: i16,
...@@ -230,7 +225,5 @@ pub const Stat = extern struct {...@@ -230,7 +225,5 @@ pub const Stat = extern struct {
230 }225 }
231};226};
232227
233pub const Elf_Symndx = u32;
234
235// No VDSO used as of glibc 112a0ae18b831bf31f44d81b82666980312511d6.228// No VDSO used as of glibc 112a0ae18b831bf31f44d81b82666980312511d6.
236pub const VDSO = void;229pub const VDSO = void;
lib/std/os/linux/mips.zig-12
...@@ -336,15 +336,3 @@ pub const Stat = extern struct {...@@ -336,15 +336,3 @@ pub const Stat = extern struct {
336 };336 };
337 }337 }
338};338};
339
340pub const timeval = extern struct {
341 sec: isize,
342 usec: isize,
343};
344
345pub const timezone = extern struct {
346 minuteswest: i32,
347 dsttime: i32,
348};
349
350pub const Elf_Symndx = u32;
lib/std/os/linux/mips64.zig-12
...@@ -315,15 +315,3 @@ pub const Stat = extern struct {...@@ -315,15 +315,3 @@ pub const Stat = extern struct {
315 };315 };
316 }316 }
317};317};
318
319pub const timeval = extern struct {
320 sec: isize,
321 usec: isize,
322};
323
324pub const timezone = extern struct {
325 minuteswest: i32,
326 dsttime: i32,
327};
328
329pub const Elf_Symndx = u32;
lib/std/os/linux/powerpc.zig-12
...@@ -340,15 +340,3 @@ pub const Stat = extern struct {...@@ -340,15 +340,3 @@ pub const Stat = extern struct {
340 return self.ctim;340 return self.ctim;
341 }341 }
342};342};
343
344pub const timeval = extern struct {
345 sec: time_t,
346 usec: isize,
347};
348
349pub const timezone = extern struct {
350 minuteswest: i32,
351 dsttime: i32,
352};
353
354pub const Elf_Symndx = u32;
lib/std/os/linux/powerpc64.zig-12
...@@ -325,15 +325,3 @@ pub const Stat = extern struct {...@@ -325,15 +325,3 @@ pub const Stat = extern struct {
325 return self.ctim;325 return self.ctim;
326 }326 }
327};327};
328
329pub const timeval = extern struct {
330 sec: isize,
331 usec: isize,
332};
333
334pub const timezone = extern struct {
335 minuteswest: i32,
336 dsttime: i32,
337};
338
339pub const Elf_Symndx = u32;
lib/std/os/linux/riscv32.zig-7
...@@ -168,11 +168,6 @@ pub const ino_t = u64;...@@ -168,11 +168,6 @@ pub const ino_t = u64;
168pub const dev_t = u64;168pub const dev_t = u64;
169pub const blkcnt_t = i64;169pub const blkcnt_t = i64;
170170
171pub const timeval = extern struct {
172 sec: time_t,
173 usec: i64,
174};
175
176pub const Flock = extern struct {171pub const Flock = extern struct {
177 type: i16,172 type: i16,
178 whence: i16,173 whence: i16,
...@@ -214,8 +209,6 @@ pub const Stat = extern struct {...@@ -214,8 +209,6 @@ pub const Stat = extern struct {
214 }209 }
215};210};
216211
217pub const Elf_Symndx = u32;
218
219pub const VDSO = struct {212pub const VDSO = struct {
220 pub const CGT_SYM = "__vdso_clock_gettime";213 pub const CGT_SYM = "__vdso_clock_gettime";
221 pub const CGT_VER = "LINUX_4.15";214 pub const CGT_VER = "LINUX_4.15";
lib/std/os/linux/riscv64.zig-7
...@@ -168,11 +168,6 @@ pub const ino_t = u64;...@@ -168,11 +168,6 @@ pub const ino_t = u64;
168pub const dev_t = u64;168pub const dev_t = u64;
169pub const blkcnt_t = i64;169pub const blkcnt_t = i64;
170170
171pub const timeval = extern struct {
172 sec: time_t,
173 usec: i64,
174};
175
176pub const Flock = extern struct {171pub const Flock = extern struct {
177 type: i16,172 type: i16,
178 whence: i16,173 whence: i16,
...@@ -214,8 +209,6 @@ pub const Stat = extern struct {...@@ -214,8 +209,6 @@ pub const Stat = extern struct {
214 }209 }
215};210};
216211
217pub const Elf_Symndx = u32;
218
219pub const VDSO = struct {212pub const VDSO = struct {
220 pub const CGT_SYM = "__vdso_clock_gettime";213 pub const CGT_SYM = "__vdso_clock_gettime";
221 pub const CGT_VER = "LINUX_4.15";214 pub const CGT_VER = "LINUX_4.15";
lib/std/os/linux/s390x.zig-7
...@@ -186,11 +186,6 @@ pub const ino_t = u64;...@@ -186,11 +186,6 @@ pub const ino_t = u64;
186pub const dev_t = u64;186pub const dev_t = u64;
187pub const blkcnt_t = i64;187pub const blkcnt_t = i64;
188188
189pub const timeval = extern struct {
190 sec: time_t,
191 usec: i64,
192};
193
194pub const Flock = extern struct {189pub const Flock = extern struct {
195 type: i16,190 type: i16,
196 whence: i16,191 whence: i16,
...@@ -229,8 +224,6 @@ pub const Stat = extern struct {...@@ -229,8 +224,6 @@ pub const Stat = extern struct {
229 }224 }
230};225};
231226
232pub const Elf_Symndx = u64;
233
234pub const VDSO = struct {227pub const VDSO = struct {
235 pub const CGT_SYM = "__kernel_clock_gettime";228 pub const CGT_SYM = "__kernel_clock_gettime";
236 pub const CGT_VER = "LINUX_2.6.29";229 pub const CGT_VER = "LINUX_2.6.29";
lib/std/os/linux/sparc64.zig-12
...@@ -314,15 +314,3 @@ pub const Stat = extern struct {...@@ -314,15 +314,3 @@ pub const Stat = extern struct {
314 return self.ctim;314 return self.ctim;
315 }315 }
316};316};
317
318pub const timeval = extern struct {
319 sec: isize,
320 usec: i32,
321};
322
323pub const timezone = extern struct {
324 minuteswest: i32,
325 dsttime: i32,
326};
327
328pub const Elf_Symndx = u32;
lib/std/os/linux/x86.zig-12
...@@ -278,18 +278,6 @@ pub const Stat = extern struct {...@@ -278,18 +278,6 @@ pub const Stat = extern struct {
278 }278 }
279};279};
280280
281pub const timeval = extern struct {
282 sec: i32,
283 usec: i32,
284};
285
286pub const timezone = extern struct {
287 minuteswest: i32,
288 dsttime: i32,
289};
290
291pub const Elf_Symndx = u32;
292
293pub const user_desc = extern struct {281pub const user_desc = extern struct {
294 entry_number: u32,282 entry_number: u32,
295 base_addr: u32,283 base_addr: u32,
lib/std/os/linux/x86_64.zig-12
...@@ -234,15 +234,3 @@ pub const Stat = extern struct {...@@ -234,15 +234,3 @@ pub const Stat = extern struct {
234 return self.ctim;234 return self.ctim;
235 }235 }
236};236};
237
238pub const timeval = extern struct {
239 sec: isize,
240 usec: isize,
241};
242
243pub const timezone = extern struct {
244 minuteswest: i32,
245 dsttime: i32,
246};
247
248pub const Elf_Symndx = u32;