signal.c 725 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2019 Arm Limited
  4. * Original author: Dave Martin <[email protected]>
  5. */
  6. #include "system.h"
  7. #include "signal.h"
  8. int sigemptyset(sigset_t *s)
  9. {
  10. unsigned int i;
  11. for (i = 0; i < _NSIG_WORDS; ++i)
  12. s->sig[i] = 0;
  13. return 0;
  14. }
  15. int sigaddset(sigset_t *s, int n)
  16. {
  17. if (n < 1 || n > _NSIG)
  18. return -EINVAL;
  19. s->sig[(n - 1) / _NSIG_BPW] |= 1UL << (n - 1) % _NSIG_BPW;
  20. return 0;
  21. }
  22. int sigaction(int n, struct sigaction *sa, const struct sigaction *old)
  23. {
  24. return syscall(__NR_rt_sigaction, n, sa, old, sizeof(sa->sa_mask));
  25. }
  26. int sigprocmask(int how, const sigset_t *mask, sigset_t *old)
  27. {
  28. return syscall(__NR_rt_sigprocmask, how, mask, old, sizeof(*mask));
  29. }