From 4abab5ad6c8465a7528ccdd5f49367da05f78bbd Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Tue, 1 Oct 2024 15:47:05 +0200 Subject: Initial version --- src/sched/sched_rr_get_interval.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/sched/sched_rr_get_interval.c (limited to 'src/sched/sched_rr_get_interval.c') diff --git a/src/sched/sched_rr_get_interval.c b/src/sched/sched_rr_get_interval.c new file mode 100644 index 0000000..33a3d1a --- /dev/null +++ b/src/sched/sched_rr_get_interval.c @@ -0,0 +1,21 @@ +#include +#include "syscall.h" + +int sched_rr_get_interval(pid_t pid, struct timespec *ts) +{ +#ifdef SYS_sched_rr_get_interval_time64 + /* On a 32-bit arch, use the old syscall if it exists. */ + if (SYS_sched_rr_get_interval != SYS_sched_rr_get_interval_time64) { + long ts32[2]; + int r = __syscall(SYS_sched_rr_get_interval, pid, ts32); + if (!r) { + ts->tv_sec = ts32[0]; + ts->tv_nsec = ts32[1]; + } + return __syscall_ret(r); + } +#endif + /* If reaching this point, it's a 64-bit arch or time64-only + * 32-bit arch and we can get result directly into timespec. */ + return syscall(SYS_sched_rr_get_interval, pid, ts); +} -- cgit v1.2.3