internal-signals.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* Special use of signals internally. Stub version.
  2. Copyright (C) 2014-2019 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef __INTERNAL_SIGNALS_H
  16. # define __INTERNAL_SIGNALS_H
  17. #include <signal.h>
  18. #include <sigsetops.h>
  19. #include <stdbool.h>
  20. static inline bool
  21. __is_internal_signal (int sig)
  22. {
  23. return false;
  24. }
  25. static inline void
  26. __clear_internal_signals (sigset_t *set)
  27. {
  28. }
  29. static inline int
  30. __libc_signal_block_all (sigset_t *set)
  31. {
  32. sigset_t allset;
  33. __sigfillset (&allset);
  34. return __sigprocmask (SIG_BLOCK, &allset, set);
  35. }
  36. static inline int
  37. __libc_signal_block_app (sigset_t *set)
  38. {
  39. sigset_t allset;
  40. __sigfillset (&allset);
  41. __clear_internal_signals (&allset);
  42. return __sigprocmask (SIG_BLOCK, &allset, set);
  43. }
  44. /* Restore current process signal mask. */
  45. static inline int
  46. __libc_signal_restore_set (const sigset_t *set)
  47. {
  48. return __sigprocmask (SIG_SETMASK, set, NULL);
  49. }
  50. #endif /* __INTERNAL_SIGNALS_H */