authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-08-31 03:24:55+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-09-06 20:03:00+02:00
log804319799586961052a9e4f283ad94d5018ce5fa
tree4b29081cdb8df2f1d1cae757e1776e6124a91816
parent68bb788df57d6725c783adb2b9018cc7db789dd8
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.os.linux: Add clock_nanosleep() syscall wrapper.


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

lib/std/os/linux.zig+15
...@@ -1456,6 +1456,16 @@ pub fn clock_settime(clk_id: i32, tp: *const timespec) usize {...@@ -1456,6 +1456,16 @@ pub fn clock_settime(clk_id: i32, tp: *const timespec) usize {
1456 return syscall2(.clock_settime, @as(usize, @bitCast(@as(isize, clk_id))), @intFromPtr(tp));1456 return syscall2(.clock_settime, @as(usize, @bitCast(@as(isize, clk_id))), @intFromPtr(tp));
1457}1457}
14581458
1459pub fn clock_nanosleep(clockid: clockid_t, flags: TIMER, request: *const timespec, remain: ?*timespec) usize {
1460 return syscall4(
1461 .clock_nanosleep,
1462 @intFromEnum(clockid),
1463 @as(u32, @bitCast(flags)),
1464 @intFromPtr(request),
1465 @intFromPtr(remain),
1466 );
1467}
1468
1459pub fn gettimeofday(tv: ?*timeval, tz: ?*timezone) usize {1469pub fn gettimeofday(tv: ?*timeval, tz: ?*timezone) usize {
1460 return syscall2(.gettimeofday, @intFromPtr(tv), @intFromPtr(tz));1470 return syscall2(.gettimeofday, @intFromPtr(tv), @intFromPtr(tz));
1461}1471}
...@@ -4527,6 +4537,11 @@ pub const clockid_t = enum(u32) {...@@ -4527,6 +4537,11 @@ pub const clockid_t = enum(u32) {
4527 _,4537 _,
4528};4538};
45294539
4540pub const TIMER = packed struct(u32) {
4541 ABSTIME: bool,
4542 _: u31 = 0,
4543};
4544
4530pub const CSIGNAL = 0x000000ff;4545pub const CSIGNAL = 0x000000ff;
45314546
4532pub const CLONE = struct {4547pub const CLONE = struct {