siginfo.h 3.0 KB

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