timer_gettime.c 610 B

1234567891011121314151617181920212223242526
  1. /*
  2. * timer_gettime.c - get the timer value.
  3. */
  4. #include <errno.h>
  5. #include <stdlib.h>
  6. #include <time.h>
  7. #include <sys/syscall.h>
  8. #include "kernel-posix-timers.h"
  9. #ifdef __NR_timer_gettime
  10. #define __NR___syscall_timer_gettime __NR_timer_gettime
  11. static inline _syscall2(int, __syscall_timer_gettime, kernel_timer_t, ktimerid, void *, value);
  12. /* Get the amount of time left on a timer */
  13. int timer_gettime(timer_t timerid, struct itimerspec *value)
  14. {
  15. struct timer *kt = (struct timer *) timerid;
  16. /* Get timeout from the kernel */
  17. return __syscall_timer_gettime(kt->ktimerid, value);
  18. }
  19. #endif