timerfd.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Copyright (C) 2008-2021 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <https://www.gnu.org/licenses/>. */
  14. #ifndef _SYS_TIMERFD_H
  15. #define _SYS_TIMERFD_H 1
  16. #include <time.h>
  17. #include <bits/types/struct_itimerspec.h>
  18. /* Get the platform-dependent flags. */
  19. #include <bits/timerfd.h>
  20. /* Bits to be set in the FLAGS parameter of `timerfd_settime'. */
  21. enum
  22. {
  23. TFD_TIMER_ABSTIME = 1 << 0,
  24. #define TFD_TIMER_ABSTIME TFD_TIMER_ABSTIME
  25. TFD_TIMER_CANCEL_ON_SET = 1 << 1
  26. #define TFD_TIMER_CANCEL_ON_SET TFD_TIMER_CANCEL_ON_SET
  27. };
  28. __BEGIN_DECLS
  29. /* Return file descriptor for new interval timer source. */
  30. extern int timerfd_create (__clockid_t __clock_id, int __flags) __THROW;
  31. /* Set next expiration time of interval timer source UFD to UTMR. If
  32. FLAGS has the TFD_TIMER_ABSTIME flag set the timeout value is
  33. absolute. Optionally return the old expiration time in OTMR. */
  34. extern int timerfd_settime (int __ufd, int __flags,
  35. const struct itimerspec *__utmr,
  36. struct itimerspec *__otmr) __THROW;
  37. /* Return the next expiration time of UFD. */
  38. extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr) __THROW;
  39. __END_DECLS
  40. #endif /* sys/timerfd.h */