timer_settime.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * timer_settime.c - set the timer.
  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. #if defined(__NR_timer_settime) || defined(__NR_timer_settime64)
  10. #if defined(__UCLIBC_USE_TIME64__) && defined(__NR_timer_settime64)
  11. #include "internal/time64_helpers.h"
  12. int timer_settime(timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue)
  13. {
  14. struct timer *kt = (struct timer *)timerid;
  15. return INLINE_SYSCALL(timer_settime64, 4, kt->ktimerid, flags, TO_ITS64_P(value), ovalue);
  16. }
  17. #else
  18. #define __NR___syscall_timer_settime __NR_timer_settime
  19. static __inline__ _syscall4(int, __syscall_timer_settime, kernel_timer_t, ktimerid,
  20. int, flags, const void *, value, void *, ovalue);
  21. /* Set the expiration time for a timer */
  22. int timer_settime(timer_t timerid, int flags, const struct itimerspec *value,
  23. struct itimerspec *ovalue)
  24. {
  25. struct timer *kt = (struct timer *)timerid;
  26. /* Set timeout */
  27. return __syscall_timer_settime(kt->ktimerid, flags, value, ovalue);
  28. }
  29. #endif
  30. #endif