timerfd.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* Copyright (C) 2008 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, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 02111-1307 USA. */
  15. #ifndef _SYS_TIMERFD_H
  16. #define _SYS_TIMERFD_H 1
  17. #include <time.h>
  18. /* Bits to be set in the FLAGS parameter of `timerfd_create'. */
  19. enum
  20. {
  21. TFD_CLOEXEC = 02000000,
  22. #define TFD_CLOEXEC TFD_CLOEXEC
  23. TFD_NONBLOCK = 04000
  24. #define TFD_NONBLOCK TFD_NONBLOCK
  25. };
  26. /* Bits to be set in the FLAGS parameter of `timerfd_settime'. */
  27. enum
  28. {
  29. TFD_TIMER_ABSTIME = 1 << 0
  30. #define TFD_TIMER_ABSTIME TFD_TIMER_ABSTIME
  31. };
  32. __BEGIN_DECLS
  33. /* Return file descriptor for new interval timer source. */
  34. extern int timerfd_create (clockid_t __clock_id, int __flags) __THROW;
  35. /* Set next expiration time of interval timer source UFD to UTMR. If
  36. FLAGS has the TFD_TIMER_ABSTIME flag set the timeout value is
  37. absolute. Optionally return the old expiration time in OTMR. */
  38. extern int timerfd_settime (int __ufd, int __flags,
  39. __const struct itimerspec *__utmr,
  40. struct itimerspec *__otmr) __THROW;
  41. /* Return the next expiration time of UFD. */
  42. extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr) __THROW;
  43. __END_DECLS
  44. #endif /* sys/timerfd.h */