signal.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. #ifndef _ASMPPC_SIGNAL_H
  2. #define _ASMPPC_SIGNAL_H
  3. #ifdef __KERNEL__
  4. #include <linux/types.h>
  5. #endif /* __KERNEL__ */
  6. /* Avoid too many header ordering problems. */
  7. struct siginfo;
  8. /* Most things should be clean enough to redefine this at will, if care
  9. is taken to make libc match. */
  10. #define _NSIG 64
  11. #define _NSIG_BPW 32
  12. #define _NSIG_WORDS (_NSIG / _NSIG_BPW)
  13. typedef unsigned long old_sigset_t; /* at least 32 bits */
  14. typedef struct {
  15. unsigned long sig[_NSIG_WORDS];
  16. } sigset_t;
  17. #define SIGHUP 1
  18. #define SIGINT 2
  19. #define SIGQUIT 3
  20. #define SIGILL 4
  21. #define SIGTRAP 5
  22. #define SIGABRT 6
  23. #define SIGIOT 6
  24. #define SIGBUS 7
  25. #define SIGFPE 8
  26. #define SIGKILL 9
  27. #define SIGUSR1 10
  28. #define SIGSEGV 11
  29. #define SIGUSR2 12
  30. #define SIGPIPE 13
  31. #define SIGALRM 14
  32. #define SIGTERM 15
  33. #define SIGSTKFLT 16
  34. #define SIGCHLD 17
  35. #define SIGCONT 18
  36. #define SIGSTOP 19
  37. #define SIGTSTP 20
  38. #define SIGTTIN 21
  39. #define SIGTTOU 22
  40. #define SIGURG 23
  41. #define SIGXCPU 24
  42. #define SIGXFSZ 25
  43. #define SIGVTALRM 26
  44. #define SIGPROF 27
  45. #define SIGWINCH 28
  46. #define SIGIO 29
  47. #define SIGPOLL SIGIO
  48. /*
  49. #define SIGLOST 29
  50. */
  51. #define SIGPWR 30
  52. #define SIGSYS 31
  53. #define SIGUNUSED 31
  54. /* These should not be considered constants from userland. */
  55. #define SIGRTMIN 32
  56. #define SIGRTMAX _NSIG
  57. /*
  58. * SA_FLAGS values:
  59. *
  60. * SA_ONSTACK is not currently supported, but will allow sigaltstack(2).
  61. * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
  62. * SA_RESTART flag to get restarting signals (which were the default long ago)
  63. * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
  64. * SA_RESETHAND clears the handler when the signal is delivered.
  65. * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
  66. * SA_NODEFER prevents the current signal from being masked in the handler.
  67. *
  68. * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
  69. * Unix names RESETHAND and NODEFER respectively.
  70. */
  71. #define SA_NOCLDSTOP 0x00000001
  72. #define SA_NOCLDWAIT 0x00000002
  73. #define SA_SIGINFO 0x00000004
  74. #define SA_ONSTACK 0x08000000
  75. #define SA_RESTART 0x10000000
  76. #define SA_NODEFER 0x40000000
  77. #define SA_RESETHAND 0x80000000
  78. #define SA_NOMASK SA_NODEFER
  79. #define SA_ONESHOT SA_RESETHAND
  80. #define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
  81. #define SA_RESTORER 0x04000000
  82. /*
  83. * sigaltstack controls
  84. */
  85. #define SS_ONSTACK 1
  86. #define SS_DISABLE 2
  87. #define MINSIGSTKSZ 2048
  88. #define SIGSTKSZ 8192
  89. #ifdef __KERNEL__
  90. /*
  91. * These values of sa_flags are used only by the kernel as part of the
  92. * irq handling routines.
  93. *
  94. * SA_INTERRUPT is also used by the irq handling routines.
  95. * SA_SHIRQ is for shared interrupt support on PCI and EISA.
  96. */
  97. #define SA_PROBE SA_ONESHOT
  98. #define SA_SAMPLE_RANDOM SA_RESTART
  99. #define SA_SHIRQ 0x04000000
  100. #endif /* __KERNEL__ */
  101. #define SIG_BLOCK 0 /* for blocking signals */
  102. #define SIG_UNBLOCK 1 /* for unblocking signals */
  103. #define SIG_SETMASK 2 /* for setting the signal mask */
  104. /* Type of a signal handler. */
  105. typedef void __signalfn_t(int);
  106. typedef __signalfn_t __user *__sighandler_t;
  107. typedef void __restorefn_t(void);
  108. typedef __restorefn_t __user *__sigrestore_t;
  109. #define SIG_DFL ((__sighandler_t)0) /* default signal handling */
  110. #define SIG_IGN ((__sighandler_t)1) /* ignore signal */
  111. #define SIG_ERR ((__sighandler_t)-1) /* error return from signal */
  112. struct old_sigaction {
  113. __sighandler_t sa_handler;
  114. old_sigset_t sa_mask;
  115. unsigned long sa_flags;
  116. __sigrestore_t sa_restorer;
  117. };
  118. struct sigaction {
  119. __sighandler_t sa_handler;
  120. unsigned long sa_flags;
  121. __sigrestore_t sa_restorer;
  122. sigset_t sa_mask; /* mask last for extensibility */
  123. };
  124. struct k_sigaction {
  125. struct sigaction sa;
  126. };
  127. typedef struct sigaltstack {
  128. void __user *ss_sp;
  129. int ss_flags;
  130. size_t ss_size;
  131. } stack_t;
  132. #ifdef __KERNEL__
  133. #include <asm/sigcontext.h>
  134. #define ptrace_signal_deliver(regs, cookie) do { } while (0)
  135. #endif /* __KERNEL__ */
  136. /*
  137. * These are parameters to dbg_sigreturn syscall. They enable or
  138. * disable certain debugging things that can be done from signal
  139. * handlers. The dbg_sigreturn syscall *must* be called from a
  140. * SA_SIGINFO signal so the ucontext can be passed to it. It takes an
  141. * array of struct sig_dbg_op, which has the debug operations to
  142. * perform before returning from the signal.
  143. */
  144. struct sig_dbg_op {
  145. int dbg_type;
  146. unsigned long dbg_value;
  147. };
  148. /* Enable or disable single-stepping. The value sets the state. */
  149. #define SIG_DBG_SINGLE_STEPPING 1
  150. /* Enable or disable branch tracing. The value sets the state. */
  151. #define SIG_DBG_BRANCH_TRACING 2
  152. #endif