| ... | ... | @@ -865,13 +865,19 @@ pub fn flock(fd: fd_t, operation: i32) usize { |
| 865 | 865 | return syscall2(.flock, @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, operation))); |
| 866 | 866 | } |
| 867 | 867 | |
| 868 | | var vdso_clock_gettime = @ptrCast(?*const anyopaque, init_vdso_clock_gettime); |
| 868 | var vdso_clock_gettime = if (builtin.zig_backend == .stage1) |
| 869 | @ptrCast(?*const anyopaque, init_vdso_clock_gettime) |
| 870 | else |
| 871 | @ptrCast(?*const anyopaque, &init_vdso_clock_gettime); |
| 869 | 872 | |
| 870 | 873 | // We must follow the C calling convention when we call into the VDSO |
| 871 | | const vdso_clock_gettime_ty = fn (i32, *timespec) callconv(.C) usize; |
| 874 | const vdso_clock_gettime_ty = if (builtin.zig_backend == .stage1) |
| 875 | fn (i32, *timespec) callconv(.C) usize |
| 876 | else |
| 877 | *const fn (i32, *timespec) callconv(.C) usize; |
| 872 | 878 | |
| 873 | 879 | pub fn clock_gettime(clk_id: i32, tp: *timespec) usize { |
| 874 | | if (@hasDecl(VDSO, "CGT_SYM") and builtin.zig_backend == .stage1) { |
| 880 | if (@hasDecl(VDSO, "CGT_SYM")) { |
| 875 | 881 | const ptr = @atomicLoad(?*const anyopaque, &vdso_clock_gettime, .Unordered); |
| 876 | 882 | if (ptr) |fn_ptr| { |
| 877 | 883 | const f = @ptrCast(vdso_clock_gettime_ty, fn_ptr); |