eventfd.c 592 B

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