xsignal.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* Support functionality for using signals.
  2. Copyright (C) 2016-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 SUPPORT_SIGNAL_H
  16. #define SUPPORT_SIGNAL_H
  17. #include <signal.h>
  18. #include <sys/cdefs.h>
  19. __BEGIN_DECLS
  20. /* The following functions call the corresponding libc functions and
  21. terminate the process on error. */
  22. void xraise (int sig);
  23. sighandler_t xsignal (int sig, sighandler_t handler);
  24. void xsigaction (int sig, const struct sigaction *newact,
  25. struct sigaction *oldact);
  26. /* The following functions call the corresponding libpthread functions
  27. and terminate the process on error. */
  28. void xpthread_sigmask (int how, const sigset_t *set, sigset_t *oldset);
  29. /* Allocate and activate an alternate signal stack. This stack will
  30. have SIZE + MINSIGSTKSZ bytes of space, rounded up to a whole
  31. number of pages. There will be large (at least 1 MiB) inaccessible
  32. guard bands on either side of it. The return value is a cookie
  33. that can be passed to xfree_sigstack to deactivate and deallocate
  34. the stack again. It is not necessary to call sigaltstack after
  35. calling this function. Terminates the process on error. */
  36. void *xalloc_sigstack (size_t size);
  37. /* Deactivate and deallocate a signal stack created by xalloc_sigstack. */
  38. void xfree_sigstack (void *stack);
  39. /* Extract the actual address and size of the alternate signal stack from
  40. the cookie returned by xalloc_sigstack. */
  41. void xget_sigstack_location (const void *stack, unsigned char **addrp,
  42. size_t *sizep);
  43. __END_DECLS
  44. #endif /* SUPPORT_SIGNAL_H */