signalfd.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * signalfd() for uClibc
  3. *
  4. * Copyright (C) 2008 Bernhard Reutner-Fischer <uclibc@uclibc.org>
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. */
  8. #include <sys/syscall.h>
  9. #include <signal.h>
  10. #include <sys/signalfd.h>
  11. #if defined __NR_signalfd4
  12. #define __NR___syscall_signalfd4 __NR_signalfd4
  13. static __inline__ _syscall4(int, __syscall_signalfd4, int, fd,
  14. const sigset_t *, mask, size_t, sizemask, int, flags)
  15. #elif defined __NR_signalfd
  16. #define __NR___syscall_signalfd __NR_signalfd
  17. static __inline__ _syscall3(int, __syscall_signalfd, int, fd,
  18. const sigset_t *, mask, size_t, sizemask)
  19. #endif
  20. #if defined __NR_signalfd4 || defined __NR_signalfd
  21. int signalfd (int fd, const sigset_t *mask, int flags)
  22. {
  23. #if defined __NR___syscall_signalfd4
  24. return __syscall_signalfd4(fd, mask, __SYSCALL_SIGSET_T_SIZE, flags);
  25. #elif defined __NR___syscall_signalfd
  26. if (flags != 0) {
  27. __set_errno(EINVAL);
  28. return -1;
  29. }
  30. return __syscall_signalfd(fd, mask, __SYSCALL_SIGSET_T_SIZE);
  31. #endif
  32. }
  33. #endif