timerfd.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * timerfd_create() / timerfd_settime() / timerfd_gettime() for uClibc
  3. *
  4. * Copyright (C) 2009 Stephan Raue <stephan@openelec.tv>
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. */
  8. #include <sys/syscall.h>
  9. #include <sys/timerfd.h>
  10. #if defined(__UCLIBC_USE_TIME64__)
  11. #include "internal/time64_helpers.h"
  12. #endif
  13. /*
  14. * timerfd_create()
  15. */
  16. #ifdef __NR_timerfd_create
  17. _syscall2(int, timerfd_create, int, clockid, int, flags)
  18. #endif
  19. /*
  20. * timerfd_settime()
  21. */
  22. #if defined(__NR_timerfd_settime) || defined(__NR_timerfd_settime64)
  23. #if defined(__UCLIBC_USE_TIME64__) && defined(__NR_timerfd_settime64)
  24. int timerfd_settime(int ufd, int flags, const struct itimerspec *utmr, struct itimerspec *otmr)
  25. {
  26. return INLINE_SYSCALL(timerfd_settime64, 4, ufd, flags, TO_ITS64_P(utmr), otmr);
  27. }
  28. #else
  29. _syscall4(int, timerfd_settime, int, ufd, int, flags, const struct itimerspec *, utmr, struct itimerspec *, otmr)
  30. #endif
  31. #endif
  32. /*
  33. * timerfd_gettime()
  34. */
  35. #if defined(__NR_timerfd_gettime) || defined(__NR_timerfd_gettime64)
  36. #if defined(__UCLIBC_USE_TIME64__) && defined(__NR_timerfd_gettime64)
  37. _syscall2_64(int, timerfd_gettime, int, ufd, struct itimerspec *, otmr)
  38. #else
  39. _syscall2(int, timerfd_gettime, int, ufd, struct itimerspec *, otmr)
  40. #endif
  41. #endif