Skip to content

Commit fc7a5f2

Browse files
committed
std.os.linux: move some generic decls out of the arch bits
1 parent 8970d80 commit fc7a5f2

File tree

16 files changed

+12
-153
lines changed

16 files changed

+12
-153
lines changed

lib/std/os/linux.zig

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ pub fn clone(
8888
}
8989

9090
pub const ARCH = arch_bits.ARCH;
91-
pub const Elf_Symndx = arch_bits.Elf_Symndx;
9291
pub const F = arch_bits.F;
9392
pub const Flock = arch_bits.Flock;
9493
pub const HWCAP = arch_bits.HWCAP;
@@ -103,8 +102,6 @@ pub const mode_t = arch_bits.mode_t;
103102
pub const nlink_t = arch_bits.nlink_t;
104103
pub const off_t = arch_bits.off_t;
105104
pub const time_t = arch_bits.time_t;
106-
pub const timeval = arch_bits.timeval;
107-
pub const timezone = arch_bits.timezone;
108105
pub const user_desc = arch_bits.user_desc;
109106

110107
pub const tls = @import("linux/tls.zig");
@@ -1611,6 +1608,8 @@ pub fn flock(fd: fd_t, operation: i32) usize {
16111608
return syscall2(.flock, @as(usize, @bitCast(@as(isize, fd))), @as(usize, @bitCast(@as(isize, operation))));
16121609
}
16131610

1611+
pub const Elf_Symndx = if (native_arch == .s390x) u64 else u32;
1612+
16141613
// We must follow the C calling convention when we call into the VDSO
16151614
const VdsoClockGettime = *align(1) const fn (clockid_t, *timespec) callconv(.c) usize;
16161615
var vdso_clock_gettime: ?VdsoClockGettime = &init_vdso_clock_gettime;
@@ -8360,6 +8359,16 @@ pub const POSIX_FADV = switch (native_arch) {
83608359
},
83618360
};
83628361

8362+
pub const timeval = extern struct {
8363+
tv_sec: isize,
8364+
tv_usec: i64,
8365+
};
8366+
8367+
pub const timezone = extern struct {
8368+
minuteswest: i32,
8369+
dsttime: i32,
8370+
};
8371+
83638372
/// The timespec struct used by the kernel.
83648373
pub const kernel_timespec = extern struct {
83658374
sec: i64,

lib/std/os/linux/aarch64.zig

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -230,15 +230,3 @@ pub const Stat = extern struct {
230230
return self.ctim;
231231
}
232232
};
233-
234-
pub const timeval = extern struct {
235-
sec: isize,
236-
usec: isize,
237-
};
238-
239-
pub const timezone = extern struct {
240-
minuteswest: i32,
241-
dsttime: i32,
242-
};
243-
244-
pub const Elf_Symndx = u32;

lib/std/os/linux/arm.zig

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,3 @@ pub const Stat = extern struct {
266266
return self.ctim;
267267
}
268268
};
269-
270-
pub const timeval = extern struct {
271-
sec: i32,
272-
usec: i32,
273-
};
274-
275-
pub const timezone = extern struct {
276-
minuteswest: i32,
277-
dsttime: i32,
278-
};
279-
280-
pub const Elf_Symndx = u32;

lib/std/os/linux/hexagon.zig

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,6 @@ pub const F = struct {
154154
pub const GETOWNER_UIDS = 17;
155155
};
156156

157-
pub const timeval = extern struct {
158-
sec: time_t,
159-
usec: i32,
160-
};
161-
162157
pub const Flock = extern struct {
163158
type: i16,
164159
whence: i16,
@@ -209,6 +204,4 @@ pub const Stat = extern struct {
209204
}
210205
};
211206

212-
pub const Elf_Symndx = u32;
213-
214207
pub const VDSO = void;

lib/std/os/linux/loongarch64.zig

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,6 @@ pub const Stat = extern struct {
176176
}
177177
};
178178

179-
pub const timeval = extern struct {
180-
tv_sec: time_t,
181-
tv_usec: i64,
182-
};
183-
184179
pub const F = struct {
185180
pub const DUPFD = 0;
186181
pub const GETFD = 1;
@@ -209,5 +204,3 @@ pub const VDSO = struct {
209204
pub const CGT_SYM = "__vdso_clock_gettime";
210205
pub const CGT_VER = "LINUX_5.10";
211206
};
212-
213-
pub const Elf_Symndx = u32;

lib/std/os/linux/m68k.zig

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,6 @@ pub const ino_t = u64;
186186
pub const dev_t = u64;
187187
pub const blkcnt_t = i64;
188188

189-
pub const timeval = extern struct {
190-
sec: time_t,
191-
usec: i32,
192-
};
193-
194189
pub const Flock = extern struct {
195190
type: i16,
196191
whence: i16,
@@ -230,7 +225,5 @@ pub const Stat = extern struct {
230225
}
231226
};
232227

233-
pub const Elf_Symndx = u32;
234-
235228
// No VDSO used as of glibc 112a0ae18b831bf31f44d81b82666980312511d6.
236229
pub const VDSO = void;

lib/std/os/linux/mips.zig

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -336,15 +336,3 @@ pub const Stat = extern struct {
336336
};
337337
}
338338
};
339-
340-
pub const timeval = extern struct {
341-
sec: isize,
342-
usec: isize,
343-
};
344-
345-
pub const timezone = extern struct {
346-
minuteswest: i32,
347-
dsttime: i32,
348-
};
349-
350-
pub const Elf_Symndx = u32;

lib/std/os/linux/mips64.zig

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -315,15 +315,3 @@ pub const Stat = extern struct {
315315
};
316316
}
317317
};
318-
319-
pub const timeval = extern struct {
320-
sec: isize,
321-
usec: isize,
322-
};
323-
324-
pub const timezone = extern struct {
325-
minuteswest: i32,
326-
dsttime: i32,
327-
};
328-
329-
pub const Elf_Symndx = u32;

lib/std/os/linux/powerpc.zig

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -340,15 +340,3 @@ pub const Stat = extern struct {
340340
return self.ctim;
341341
}
342342
};
343-
344-
pub const timeval = extern struct {
345-
sec: time_t,
346-
usec: isize,
347-
};
348-
349-
pub const timezone = extern struct {
350-
minuteswest: i32,
351-
dsttime: i32,
352-
};
353-
354-
pub const Elf_Symndx = u32;

lib/std/os/linux/powerpc64.zig

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -325,15 +325,3 @@ pub const Stat = extern struct {
325325
return self.ctim;
326326
}
327327
};
328-
329-
pub const timeval = extern struct {
330-
sec: isize,
331-
usec: isize,
332-
};
333-
334-
pub const timezone = extern struct {
335-
minuteswest: i32,
336-
dsttime: i32,
337-
};
338-
339-
pub const Elf_Symndx = u32;

0 commit comments

Comments
 (0)