1 #include <sched.h> 2 #include "syscall.h" 3 sched_rr_get_interval(pid_t pid,struct timespec * ts)4int sched_rr_get_interval(pid_t pid, struct timespec *ts) 5 { 6 #ifdef SYS_sched_rr_get_interval_time64 7 /* On a 32-bit arch, use the old syscall if it exists. */ 8 if (SYS_sched_rr_get_interval != SYS_sched_rr_get_interval_time64) { 9 long ts32[2]; 10 int r = __syscall(SYS_sched_rr_get_interval, pid, ts32); 11 if (!r) { 12 ts->tv_sec = ts32[0]; 13 ts->tv_nsec = ts32[1]; 14 } 15 return __syscall_ret(r); 16 } 17 #endif 18 /* If reaching this point, it's a 64-bit arch or time64-only 19 * 32-bit arch and we can get result directly into timespec. */ 20 return syscall(SYS_sched_rr_get_interval, pid, ts); 21 } 22