~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/asm-ia64/siginfo.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _ASM_IA64_SIGINFO_H
  2 #define _ASM_IA64_SIGINFO_H
  3 
  4 /*
  5  * Copyright (C) 1998, 1999 Hewlett-Packard Co
  6  * Copyright (C) 1998, 1999 David Mosberger-Tang <davidm@hpl.hp.com>
  7  */
  8 
  9 #include <linux/types.h>
 10 
 11 typedef union sigval {
 12         int sival_int;
 13         void *sival_ptr;
 14 } sigval_t;
 15 
 16 #define SI_MAX_SIZE     128
 17 #define SI_PAD_SIZE     ((SI_MAX_SIZE/sizeof(int)) - 4)
 18 
 19 typedef struct siginfo {
 20         int si_signo;
 21         int si_errno;
 22         int si_code;
 23         int __pad0;
 24 
 25         union {
 26                 int _pad[SI_PAD_SIZE];
 27 
 28                 /* kill() */
 29                 struct {
 30                         pid_t _pid;             /* sender's pid */
 31                         uid_t _uid;             /* sender's uid */
 32                 } _kill;
 33 
 34                 /* POSIX.1b timers */
 35                 struct {
 36                         unsigned int _timer1;
 37                         unsigned int _timer2;
 38                 } _timer;
 39 
 40                 /* POSIX.1b signals */
 41                 struct {
 42                         pid_t _pid;             /* sender's pid */
 43                         uid_t _uid;             /* sender's uid */
 44                         sigval_t _sigval;
 45                 } _rt;
 46 
 47                 /* SIGCHLD */
 48                 struct {
 49                         pid_t _pid;             /* which child */
 50                         uid_t _uid;             /* sender's uid */
 51                         int _status;            /* exit code */
 52                         clock_t _utime;
 53                         clock_t _stime;
 54                 } _sigchld;
 55 
 56                 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
 57                 struct {
 58                         void *_addr;            /* faulting insn/memory ref. */
 59                         int _imm;               /* immediate value for "break" */
 60                         int _pad0;
 61                         unsigned long _isr;     /* isr */
 62                 } _sigfault;
 63 
 64                 /* SIGPOLL */
 65                 struct {
 66                         long _band;     /* POLL_IN, POLL_OUT, POLL_MSG (XPG requires a "long") */
 67                         int _fd;
 68                 } _sigpoll;
 69         } _sifields;
 70 } siginfo_t;
 71 
 72 /*
 73  * How these fields are to be accessed.
 74  */
 75 #define si_pid          _sifields._kill._pid
 76 #define si_uid          _sifields._kill._uid
 77 #define si_status       _sifields._sigchld._status
 78 #define si_utime        _sifields._sigchld._utime
 79 #define si_stime        _sifields._sigchld._stime
 80 #define si_value        _sifields._rt._sigval
 81 #define si_int          _sifields._rt._sigval.sival_int
 82 #define si_ptr          _sifields._rt._sigval.sival_ptr
 83 #define si_addr         _sifields._sigfault._addr
 84 #define si_imm          _sifields._sigfault._imm        /* as per UNIX SysV ABI spec */
 85 #define si_isr          _sifields._sigfault._isr        /* valid if si_code==FPE_FLTxxx */
 86 #define si_band         _sifields._sigpoll._band
 87 #define si_fd           _sifields._sigpoll._fd
 88 
 89 /*
 90  * si_code values
 91  * Positive values for kernel-generated signals.
 92  */
 93 #ifdef __KERNEL__
 94 #define __SI_MASK       0xffff0000
 95 #define __SI_KILL       (0 << 16)
 96 #define __SI_TIMER      (1 << 16)
 97 #define __SI_POLL       (2 << 16)
 98 #define __SI_FAULT      (3 << 16)
 99 #define __SI_CHLD       (4 << 16)
100 #define __SI_RT         (5 << 16)
101 #define __SI_CODE(T,N)  ((T) << 16 | ((N) & 0xffff))
102 #else
103 #define __SI_KILL       0
104 #define __SI_TIMER      0
105 #define __SI_POLL       0
106 #define __SI_FAULT      0
107 #define __SI_CHLD       0
108 #define __SI_RT         0
109 #define __SI_CODE(T,N)  (N)
110 #endif
111 
112 #define SI_USER         0               /* sent by kill, sigsend, raise */
113 #define SI_KERNEL       0x80            /* sent by the kernel from somewhere */
114 #define SI_QUEUE        -1              /* sent by sigqueue */
115 #define SI_TIMER __SI_CODE(__SI_TIMER,-2) /* sent by timer expiration */
116 #define SI_MESGQ        -3              /* sent by real time mesq state change */
117 #define SI_ASYNCIO      -4              /* sent by AIO completion */
118 #define SI_SIGIO        -5              /* sent by queued SIGIO */
119 
120 #define SI_FROMUSER(siptr)      ((siptr)->si_code <= 0)
121 #define SI_FROMKERNEL(siptr)    ((siptr)->si_code > 0)
122 
123 /*
124  * SIGILL si_codes
125  */
126 #define ILL_ILLOPC      (__SI_FAULT|1)  /* illegal opcode */
127 #define ILL_ILLOPN      (__SI_FAULT|2)  /* illegal operand */
128 #define ILL_ILLADR      (__SI_FAULT|3)  /* illegal addressing mode */
129 #define ILL_ILLTRP      (__SI_FAULT|4)  /* illegal trap */
130 #define ILL_PRVOPC      (__SI_FAULT|5)  /* privileged opcode */
131 #define ILL_PRVREG      (__SI_FAULT|6)  /* privileged register */
132 #define ILL_COPROC      (__SI_FAULT|7)  /* coprocessor error */
133 #define ILL_BADSTK      (__SI_FAULT|8)  /* internal stack error */
134 #define ILL_BADIADDR    (__SI_FAULT|9)  /* unimplemented instruction address */
135 #define __ILL_BREAK     (__SI_FAULT|10) /* illegal break */
136 #define NSIGILL         10
137 
138 /*
139  * SIGFPE si_codes
140  */
141 #define FPE_INTDIV      (__SI_FAULT|1)  /* integer divide by zero */
142 #define FPE_INTOVF      (__SI_FAULT|2)  /* integer overflow */
143 #define FPE_FLTDIV      (__SI_FAULT|3)  /* floating point divide by zero */
144 #define FPE_FLTOVF      (__SI_FAULT|4)  /* floating point overflow */
145 #define FPE_FLTUND      (__SI_FAULT|5)  /* floating point underflow */
146 #define FPE_FLTRES      (__SI_FAULT|6)  /* floating point inexact result */
147 #define FPE_FLTINV      (__SI_FAULT|7)  /* floating point invalid operation */
148 #define FPE_FLTSUB      (__SI_FAULT|8)  /* subscript out of range */
149 #define __FPE_DECOVF    (__SI_FAULT|9)  /* decimal overflow */
150 #define __FPE_DECDIV    (__SI_FAULT|10) /* decimal division by zero */
151 #define __FPE_DECERR    (__SI_FAULT|11) /* packed decimal error */
152 #define __FPE_INVASC    (__SI_FAULT|12) /* invalid ASCII digit */
153 #define __FPE_INVDEC    (__SI_FAULT|13) /* invalid decimal digit */
154 #define NSIGFPE         13
155 
156 /*
157  * SIGSEGV si_codes
158  */
159 #define SEGV_MAPERR     (__SI_FAULT|1)  /* address not mapped to object */
160 #define SEGV_ACCERR     (__SI_FAULT|2)  /* invalid permissions for mapped object */
161 #define __SEGV_PSTKOVF  (__SI_FAULT|3)  /* paragraph stack overflow */
162 #define NSIGSEGV        3
163 
164 /*
165  * SIGBUS si_codes
166  */
167 #define BUS_ADRALN      (__SI_FAULT|1)  /* invalid address alignment */
168 #define BUS_ADRERR      (__SI_FAULT|2)  /* non-existant physical address */
169 #define BUS_OBJERR      (__SI_FAULT|3)  /* object specific hardware error */
170 #define NSIGBUS         3
171 
172 /*
173  * SIGTRAP si_codes
174  */
175 #define TRAP_BRKPT      (__SI_FAULT|1)  /* process breakpoint */
176 #define TRAP_TRACE      (__SI_FAULT|2)  /* process trace trap */
177 #define TRAP_BRANCH     (__SI_FAULT|3)  /* process taken branch trap */
178 #define TRAP_HWBKPT     (__SI_FAULT|4)  /* hardware breakpoint or watchpoint */
179 #define NSIGTRAP        4
180 
181 /*
182  * SIGCHLD si_codes
183  */
184 #define CLD_EXITED      (__SI_CHLD|1)   /* child has exited */
185 #define CLD_KILLED      (__SI_CHLD|2)   /* child was killed */
186 #define CLD_DUMPED      (__SI_CHLD|3)   /* child terminated abnormally */
187 #define CLD_TRAPPED     (__SI_CHLD|4)   /* traced child has trapped */
188 #define CLD_STOPPED     (__SI_CHLD|5)   /* child has stopped */
189 #define CLD_CONTINUED   (__SI_CHLD|6)   /* stopped child has continued */
190 #define NSIGCHLD        6
191 
192 /*
193  * SIGPOLL si_codes
194  */
195 #define POLL_IN         (__SI_POLL|1)   /* data input available */
196 #define POLL_OUT        (__SI_POLL|2)   /* output buffers available */
197 #define POLL_MSG        (__SI_POLL|3)   /* input message available */
198 #define POLL_ERR        (__SI_POLL|4)   /* i/o error */
199 #define POLL_PRI        (__SI_POLL|5)   /* high priority input available */
200 #define POLL_HUP        (__SI_POLL|6)   /* device disconnected */
201 #define NSIGPOLL        6
202 
203 /*
204  * sigevent definitions
205  * 
206  * It seems likely that SIGEV_THREAD will have to be handled from 
207  * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
208  * thread manager then catches and does the appropriate nonsense.
209  * However, everything is written out here so as to not get lost.
210  */
211 #define SIGEV_SIGNAL    0       /* notify via signal */
212 #define SIGEV_NONE      1       /* other notification: meaningless */
213 #define SIGEV_THREAD    2       /* deliver via thread creation */
214 
215 #define SIGEV_MAX_SIZE  64
216 #define SIGEV_PAD_SIZE  ((SIGEV_MAX_SIZE/sizeof(int)) - 4)
217 
218 typedef struct sigevent {
219         sigval_t sigev_value;
220         int sigev_signo;
221         int sigev_notify;
222         union {
223                 int _pad[SIGEV_PAD_SIZE];
224 
225                 struct {
226                         void (*_function)(sigval_t);
227                         void *_attribute;       /* really pthread_attr_t */
228                 } _sigev_thread;
229         } _sigev_un;
230 } sigevent_t;
231 
232 #define sigev_notify_function   _sigev_un._sigev_thread._function
233 #define sigev_notify_attributes _sigev_un._sigev_thread._attribute
234 
235 #ifdef __KERNEL__
236 #include <linux/string.h>
237 
238 static inline void
239 copy_siginfo (siginfo_t *to, siginfo_t *from)
240 {
241         if (from->si_code < 0)
242                 memcpy(to, from, sizeof(siginfo_t));
243         else
244                 /* _sigchld is currently the largest know union member */
245                 memcpy(to, from, 3*sizeof(int) + sizeof(from->_sifields._sigchld));
246 }
247 
248 extern int copy_siginfo_to_user(siginfo_t *to, siginfo_t *from);
249 
250 #endif /* __KERNEL__ */
251 
252 #endif /* _ASM_IA64_SIGINFO_H */
253 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.