signum-generic.h 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //
  2. // Copyright 2026 Aarav Ravindra Kharade
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. /* Signal number constants. Generic template.
  17. Copyright (C) 1991-2026 Free Software Foundation, Inc.
  18. This file is part of the GNU C Library.
  19. The GNU C Library is free software; you can redistribute it and/or
  20. modify it under the terms of the GNU Lesser General Public
  21. License as published by the Free Software Foundation; either
  22. version 2.1 of the License, or (at your option) any later version.
  23. The GNU C Library is distributed in the hope that it will be useful,
  24. but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  26. Lesser General Public License for more details.
  27. You should have received a copy of the GNU Lesser General Public
  28. License along with the GNU C Library; if not, see
  29. <https://www.gnu.org/licenses/>. */
  30. #ifndef _BITS_SIGNUM_GENERIC_H
  31. #define _BITS_SIGNUM_GENERIC_H 1
  32. #ifndef _SIGNAL_H
  33. #error "Never include <bits/signum-generic.h> directly; use <signal.h> instead."
  34. #endif
  35. /* Fake signal functions. */
  36. #define SIG_ERR ((__sighandler_t) -1) /* Error return. */
  37. #define SIG_DFL ((__sighandler_t) 0) /* Default action. */
  38. #define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */
  39. #ifdef __USE_XOPEN
  40. # define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */
  41. #endif
  42. /* We define here all the signal names listed in POSIX (1003.1-2008);
  43. as of 1003.1-2013, no additional signals have been added by POSIX.
  44. We also define here signal names that historically exist in every
  45. real-world POSIX variant (e.g. SIGWINCH).
  46. Signals in the 1-15 range are defined with their historical numbers.
  47. For other signals, we use the BSD numbers.
  48. There are two unallocated signal numbers in the 1-31 range: 7 and 29.
  49. Signal number 0 is reserved for use as kill(pid, 0), to test whether
  50. a process exists without sending it a signal. */
  51. /* ISO C99 signals. */
  52. #define SIGINT 2 /* Interactive attention signal. */
  53. #define SIGILL 4 /* Illegal instruction. */
  54. #define SIGABRT 6 /* Abnormal termination. */
  55. #define SIGFPE 8 /* Erroneous arithmetic operation. */
  56. #define SIGSEGV 11 /* Invalid access to storage. */
  57. #define SIGTERM 15 /* Termination request. */
  58. /* Historical signals specified by POSIX. */
  59. #define SIGHUP 1 /* Hangup. */
  60. #define SIGQUIT 3 /* Quit. */
  61. #define SIGTRAP 5 /* Trace/breakpoint trap. */
  62. #define SIGKILL 9 /* Killed. */
  63. #define SIGPIPE 13 /* Broken pipe. */
  64. #define SIGALRM 14 /* Alarm clock. */
  65. /* Archaic names for compatibility. */
  66. #define SIGIO SIGPOLL /* I/O now possible (4.2 BSD). */
  67. #define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11. */
  68. #define SIGCLD SIGCHLD /* Old System V name */
  69. /* Not all systems support real-time signals. bits/signum.h indicates
  70. that they are supported by overriding __SIGRTMAX to a value greater
  71. than __SIGRTMIN. These constants give the kernel-level hard limits,
  72. but some real-time signals may be used internally by glibc. Do not
  73. use these constants in application code; use SIGRTMIN and SIGRTMAX
  74. (defined in signal.h) instead. */
  75. /* Include system specific bits. */
  76. #include <bits/signum-arch.h>
  77. /* Biggest signal number + 1 (including real-time signals). */
  78. #define _NSIG (__SIGRTMAX + 1)
  79. #endif /* bits/signum-generic.h. */