siginfo.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 1998, 1999, 2001, 2003 Ralf Baechle
  7. * Copyright (C) 2000, 2001 Silicon Graphics, Inc.
  8. */
  9. #ifndef _ASM_SIGINFO_H
  10. #define _ASM_SIGINFO_H
  11. #define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(long) + 2*sizeof(int))
  12. #undef __ARCH_SI_TRAPNO /* exception code needs to fill this ... */
  13. #define HAVE_ARCH_SIGINFO_T
  14. /*
  15. * We duplicate the generic versions - <asm-generic/siginfo.h> is just borked
  16. * by design ...
  17. */
  18. #define HAVE_ARCH_COPY_SIGINFO
  19. struct siginfo;
  20. /*
  21. * Careful to keep union _sifields from shifting ...
  22. */
  23. #ifdef CONFIG_32BIT
  24. #define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
  25. #endif
  26. #ifdef CONFIG_64BIT
  27. #define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
  28. #endif
  29. #include <asm-generic/siginfo.h>
  30. typedef struct siginfo {
  31. int si_signo;
  32. int si_code;
  33. int si_errno;
  34. int __pad0[SI_MAX_SIZE / sizeof(int) - SI_PAD_SIZE - 3];
  35. union {
  36. int _pad[SI_PAD_SIZE];
  37. /* kill() */
  38. struct {
  39. pid_t _pid; /* sender's pid */
  40. __ARCH_SI_UID_T _uid; /* sender's uid */
  41. } _kill;
  42. /* POSIX.1b timers */
  43. struct {
  44. timer_t _tid; /* timer id */
  45. int _overrun; /* overrun count */
  46. char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
  47. sigval_t _sigval; /* same as below */
  48. int _sys_private; /* not to be passed to user */
  49. } _timer;
  50. /* POSIX.1b signals */
  51. struct {
  52. pid_t _pid; /* sender's pid */
  53. __ARCH_SI_UID_T _uid; /* sender's uid */
  54. sigval_t _sigval;
  55. } _rt;
  56. /* SIGCHLD */
  57. struct {
  58. pid_t _pid; /* which child */
  59. __ARCH_SI_UID_T _uid; /* sender's uid */
  60. int _status; /* exit code */
  61. clock_t _utime;
  62. clock_t _stime;
  63. } _sigchld;
  64. /* IRIX SIGCHLD */
  65. struct {
  66. pid_t _pid; /* which child */
  67. clock_t _utime;
  68. int _status; /* exit code */
  69. clock_t _stime;
  70. } _irix_sigchld;
  71. /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
  72. struct {
  73. void __user *_addr; /* faulting insn/memory ref. */
  74. #ifdef __ARCH_SI_TRAPNO
  75. int _trapno; /* TRAP # which caused the signal */
  76. #endif
  77. } _sigfault;
  78. /* SIGPOLL, SIGXFSZ (To do ...) */
  79. struct {
  80. __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  81. int _fd;
  82. } _sigpoll;
  83. } _sifields;
  84. } siginfo_t;
  85. /*
  86. * si_code values
  87. * Again these have been choosen to be IRIX compatible.
  88. */
  89. #undef SI_ASYNCIO
  90. #undef SI_TIMER
  91. #undef SI_MESGQ
  92. #define SI_ASYNCIO -2 /* sent by AIO completion */
  93. #define SI_TIMER __SI_CODE(__SI_TIMER, -3) /* sent by timer expiration */
  94. #define SI_MESGQ __SI_CODE(__SI_MESGQ, -4) /* sent by real time mesq state change */
  95. #ifdef __KERNEL__
  96. /*
  97. * Duplicated here because of <asm-generic/siginfo.h> braindamage ...
  98. */
  99. #include <linux/string.h>
  100. static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
  101. {
  102. if (from->si_code < 0)
  103. memcpy(to, from, sizeof(*to));
  104. else
  105. /* _sigchld is currently the largest know union member */
  106. memcpy(to, from, 3*sizeof(int) + sizeof(from->_sifields._sigchld));
  107. }
  108. #endif
  109. #endif /* _ASM_SIGINFO_H */