siginfo.h 3.1 KB

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