sigaction.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* The proper definitions for Linux's sigaction.
  2. Copyright (C) 1993-2021 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. <https://www.gnu.org/licenses/>. */
  15. #ifndef _BITS_SIGACTION_H
  16. #define _BITS_SIGACTION_H 1
  17. #ifndef _SIGNAL_H
  18. # error "Never include <bits/sigaction.h> directly; use <signal.h> instead."
  19. #endif
  20. /* Structure describing the action to be taken when a signal arrives. */
  21. struct sigaction
  22. {
  23. /* Signal handler. */
  24. #if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED
  25. union
  26. {
  27. /* Used if SA_SIGINFO is not set. */
  28. __sighandler_t sa_handler;
  29. /* Used if SA_SIGINFO is set. */
  30. void (*sa_sigaction) (int, siginfo_t *, void *);
  31. }
  32. __sigaction_handler;
  33. # define sa_handler __sigaction_handler.sa_handler
  34. # define sa_sigaction __sigaction_handler.sa_sigaction
  35. #else
  36. __sighandler_t sa_handler;
  37. #endif
  38. /* Additional set of signals to be blocked. */
  39. __sigset_t sa_mask;
  40. /* Special flags. */
  41. int sa_flags;
  42. /* Restore handler. */
  43. void (*sa_restorer) (void);
  44. };
  45. /* Bits in `sa_flags'. */
  46. #define SA_NOCLDSTOP 1 /* Don't send SIGCHLD when children stop. */
  47. #define SA_NOCLDWAIT 2 /* Don't create zombie on child death. */
  48. #define SA_SIGINFO 4 /* Invoke signal-catching function with
  49. three arguments instead of one. */
  50. #if defined __USE_XOPEN_EXTENDED || defined __USE_MISC
  51. # define SA_ONSTACK 0x08000000 /* Use signal stack by using `sa_restorer'. */
  52. #endif
  53. #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
  54. # define SA_RESTART 0x10000000 /* Restart syscall on signal return. */
  55. # define SA_NODEFER 0x40000000 /* Don't automatically block the signal when
  56. its handler is being executed. */
  57. # define SA_RESETHAND 0x80000000 /* Reset to SIG_DFL on entry to handler. */
  58. #endif
  59. #ifdef __USE_MISC
  60. # define SA_INTERRUPT 0x20000000 /* Historical no-op. */
  61. /* Some aliases for the SA_ constants. */
  62. # define SA_NOMASK SA_NODEFER
  63. # define SA_ONESHOT SA_RESETHAND
  64. # define SA_STACK SA_ONSTACK
  65. #endif
  66. /* Values for the HOW argument to `sigprocmask'. */
  67. #define SIG_BLOCK 0 /* Block signals. */
  68. #define SIG_UNBLOCK 1 /* Unblock signals. */
  69. #define SIG_SETMASK 2 /* Set the set of blocked signals. */
  70. #endif