commit a6e4f31c161be443ea37ddc059eca540a7dead80
parent 2014cf19d8a8510e45cbf7f46a6c529003203ae7
Author: Curtis Arthaud <uku82@gmx.fr>
Date: Mon, 27 May 2024 13:45:05 +0200
syscalls: add clock_settime
Signed-off-by: Curtis Arthaud <uku82@gmx.fr>
Diffstat:
4 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/rt/+freebsd/syscalls.ha b/rt/+freebsd/syscalls.ha
@@ -413,6 +413,11 @@ export fn clock_gettime(clock_id: int, tp: *timespec) (void | errno) = {
clock_id: u64, tp: uintptr: u64))?;
};
+export fn clock_settime(clock_id: int, tp: *const timespec) (void | errno) = {
+ wrap_return(syscall2(SYS_clock_settime,
+ clock_id: u64, tp: uintptr: u64))?;
+};
+
export fn nanosleep(req: *const timespec, rem: *timespec) (void | errno) = {
wrap_return(syscall2(SYS_nanosleep,
req: uintptr: u64, rem: uintptr: u64))?;
diff --git a/rt/+linux/syscalls.ha b/rt/+linux/syscalls.ha
@@ -479,6 +479,11 @@ export fn clock_gettime(clock_id: int, tp: *timespec) (void | errno) = {
clock_id: u64, tp: uintptr: u64))?;
};
+export fn clock_settime(clock_id: int, tp: *const timespec) (void | errno) = {
+ wrap_return(syscall2(SYS_clock_settime,
+ clock_id: u64, tp: uintptr: u64))?;
+};
+
export fn nanosleep(req: *const timespec, rem: *timespec) (void | errno) = {
wrap_return(syscall2(SYS_nanosleep,
req: uintptr: u64, rem: uintptr: u64))?;
diff --git a/rt/+netbsd/syscalls.ha b/rt/+netbsd/syscalls.ha
@@ -299,6 +299,11 @@ export fn clock_gettime(clock_id: int, tp: *timespec) (void | errno) = {
clock_id: u64, tp: uintptr: u64))?;
};
+export fn clock_settime(clock_id: int, tp: *const timespec) (void | errno) = {
+ wrap_return(syscall2(SYS___clock_settime50,
+ clock_id: u64, tp: uintptr: u64))?;
+};
+
export fn faccessat(
dirfd: int,
path: path,
diff --git a/rt/+openbsd/syscalls.ha b/rt/+openbsd/syscalls.ha
@@ -617,6 +617,7 @@ export fn futimens(fd: int, ts: *[2]timespec) (void | errno) = {
// kbind
// clock_gettime
+// clock_settime
@symbol("clock_gettime") fn libc_clock_gettime(clock: int, now: *timespec) int;
@@ -627,7 +628,15 @@ export fn clock_gettime(clock: int, now: *timespec) (void | errno) = {
};
};
-// clock_settime
+@symbol("clock_settime") fn libc_clock_settime(clock: int, now: *const timespec) int;
+
+export fn clock_settime(clock: int, now: *const timespec) (void | errno) = {
+ let res = libc_clock_settime(clock, now);
+ if (res == -1) {
+ return *__errno(): errno;
+ };
+};
+
// clock_getres
// dup2