sigprocmask.c 1.5 KB

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