eventfd.c 608 B

123456789101112131415161718192021222324252627282930
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * eventfd() for uClibc
  4. *
  5. * Copyright (C) 2011 Jean-Christian de Rivaz <jc@eclis.ch>
  6. *
  7. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  8. */
  9. #include <errno.h>
  10. #include <sys/syscall.h>
  11. #include <sys/eventfd.h>
  12. /*
  13. * eventfd()
  14. */
  15. #if defined __NR_eventfd || defined __NR_eventfd2
  16. int eventfd (int count, int flags)
  17. {
  18. #if defined __NR_eventfd2
  19. return INLINE_SYSCALL (eventfd2, 2, count, flags);
  20. #elif defined __NR_eventfd
  21. if (flags != 0) {
  22. __set_errno (EINVAL);
  23. return -1;
  24. }
  25. return INLINE_SYSCALL (eventfd, 1, count);
  26. #endif
  27. }
  28. #endif