authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-03 18:46:04+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-03 18:46:04+02:00
logd71076c9826ddd66bfcc04b9a6ded9dbf540d239
treedfa089b196eacda8b07df4a221ed709f22e289f7
parent624fa8523a2c4158ddc9fce231181a9e8583a633
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.os.linux: Replace `@hasDecl()` with `!= void` check for VDSO.

If there is a VDSO, it will have clock_gettime(). The main thing we're concerned about is architectures that don't have a VDSO at all, of which there are a few.

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

lib/std/os/linux.zig+1-1
......@@ -1399,7 +1399,7 @@ const VdsoClockGettime = *align(1) const fn (clockid_t, *timespec) callconv(.C)
13991399var vdso_clock_gettime: ?VdsoClockGettime = &init_vdso_clock_gettime;
14001400
14011401pub fn clock_gettime(clk_id: clockid_t, tp: *timespec) usize {
1402 if (@hasDecl(VDSO, "CGT_SYM")) {
1402 if (VDSO != void) {
14031403 const ptr = @atomicLoad(?VdsoClockGettime, &vdso_clock_gettime, .unordered);
14041404 if (ptr) |f| {
14051405 const rc = f(clk_id, tp);