sigprocmask.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. static inline
  15. _syscall4(int, __rt_sigprocmask, int, how, const sigset_t *, set,
  16. sigset_t *, oldset, size_t, size);
  17. int attribute_hidden __sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
  18. {
  19. if (set &&
  20. #if (SIG_BLOCK == 0) && (SIG_UNBLOCK == 1) && (SIG_SETMASK == 2)
  21. (((unsigned int) how) > 2)
  22. #else
  23. #warning "compile time assumption violated.. slow path..."
  24. ((how != SIG_BLOCK) && (how != SIG_UNBLOCK)
  25. && (how != SIG_SETMASK))
  26. #endif
  27. ) {
  28. __set_errno(EINVAL);
  29. return -1;
  30. }
  31. return __rt_sigprocmask(how, set, oldset, _NSIG / 8);
  32. }
  33. #else
  34. #define __NR___syscall_sigprocmask __NR_sigprocmask
  35. static inline
  36. _syscall3(int, __syscall_sigprocmask, int, how, const sigset_t *, set,
  37. sigset_t *, oldset);
  38. int attribute_hidden __sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
  39. {
  40. if (set &&
  41. #if (SIG_BLOCK == 0) && (SIG_UNBLOCK == 1) && (SIG_SETMASK == 2)
  42. (((unsigned int) how) > 2)
  43. #else
  44. #warning "compile time assumption violated.. slow path..."
  45. ((how != SIG_BLOCK) && (how != SIG_UNBLOCK)
  46. && (how != SIG_SETMASK))
  47. #endif
  48. ) {
  49. __set_errno(EINVAL);
  50. return -1;
  51. }
  52. return (__syscall_sigprocmask(how, set, oldset));
  53. }
  54. #endif
  55. strong_alias(__sigprocmask,sigprocmask)