sigprocmask.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * sigprocmask() for uClibc
  4. *
  5. * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
  6. *
  7. * GNU Library General Public License (LGPL) version 2 or later.
  8. */
  9. #include "syscalls.h"
  10. #include <signal.h>
  11. #undef sigprocmask
  12. #ifdef __NR_rt_sigprocmask
  13. #define __NR___rt_sigprocmask __NR_rt_sigprocmask
  14. _syscall4(int, __rt_sigprocmask, int, how, const sigset_t *, set,
  15. sigset_t *, oldset, size_t, size);
  16. int sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
  17. {
  18. if (set &&
  19. #if (SIG_BLOCK == 0) && (SIG_UNBLOCK == 1) && (SIG_SETMASK == 2)
  20. (((unsigned int) how) > 2)
  21. #else
  22. #warning "compile time assumption violated.. slow path..."
  23. ((how != SIG_BLOCK) && (how != SIG_UNBLOCK)
  24. && (how != SIG_SETMASK))
  25. #endif
  26. ) {
  27. __set_errno(EINVAL);
  28. return -1;
  29. }
  30. return __rt_sigprocmask(how, set, oldset, _NSIG / 8);
  31. }
  32. #else
  33. #define __NR___syscall_sigprocmask __NR_sigprocmask
  34. static inline
  35. _syscall3(int, __syscall_sigprocmask, int, how, const sigset_t *, set,
  36. sigset_t *, oldset);
  37. int sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
  38. {
  39. if (set &&
  40. #if (SIG_BLOCK == 0) && (SIG_UNBLOCK == 1) && (SIG_SETMASK == 2)
  41. (((unsigned int) how) > 2)
  42. #else
  43. #warning "compile time assumption violated.. slow path..."
  44. ((how != SIG_BLOCK) && (how != SIG_UNBLOCK)
  45. && (how != SIG_SETMASK))
  46. #endif
  47. ) {
  48. __set_errno(EINVAL);
  49. return -1;
  50. }
  51. return (__syscall_sigprocmask(how, set, oldset));
  52. }
  53. #endif