Update.
[platform/upstream/glibc.git] / bits / siginfo.h
1 /* siginfo_t, sigevent and constants.  Stub version.
2    Copyright (C) 1997 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Library General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    License, or (at your option) any later version.
9
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Library General Public License for more details.
14
15    You should have received a copy of the GNU Library General Public
16    License along with the GNU C Library; see the file COPYING.LIB.  If not,
17    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18    Boston, MA 02111-1307, USA.  */
19
20 #ifndef _SIGNAL_H
21 # error "Never include this file directly.  Use <signal.h> instead"
22 #endif
23
24 typedef struct siginfo
25   {
26     int si_signo;               /* Signal number.  */
27     int si_errno;               /* If non-zero, an errno value associated with
28                                    this signal, as defined in <errno.h>.  */
29     int si_code;                /* Signal code.  */
30     __pid_t si_pid;             /* Sending process ID.  */
31     __uid_t si_uid;             /* Real user ID of sending process.  */
32     void *si_addr;              /* Address of faulting instruction.  */
33     int si_status;              /* Exit value or signal.  */
34     long int si_band;           /* Band event for SIGPOLL.  */
35     union sigval si_value;      /* Signal value.  */
36   } siginfo_t;
37
38
39 /* Values for `si_code'.  Positive values are reserved for kernel-generated
40    signals.  */
41 enum
42 {
43   SI_ASYNCIO = -4,              /* Sent by AIO completion.  */
44 #define SI_ASYNCIO      SI_ASYNCIO
45   SI_MESGQ,                     /* Sent by real time mesq state change.  */
46 #define SI_MESGQ        SI_MESGQ
47   SI_TIMER,                     /* Sent by timer expiration.  */
48 #define SI_TIMER        SI_TIMER
49   SI_QUEUE,                     /* Sent by sigqueue.  */
50 #define SI_QUEUE        SI_QUEUE
51   SI_USER                       /* Sent by kill, sigsend, raise.  */
52 #define SI_USER         SI_USER
53 };
54
55
56 /* `si_code' values for SIGILL signal.  */
57 enum
58 {
59   ILL_ILLOPC = 1,               /* Illegal opcode.  */
60 #define ILL_ILLOPC      ILL_ILLOPC
61   ILL_ILL_OPN,                  /* Illegal operand.  */
62 #define ILL_ILLOPN      ILL_ILLOPN
63   ILL_ILLADR,                   /* Illegal addressing mode.  */
64 #define ILL_ILLADR      ILL_ILLADR
65   ILL_ILLTRP,                   /* Illegal trap. */
66 #define ILL_ILLTRP      ILL_ILLTRP
67   ILL_PRVOPC,                   /* Privileged opcode.  */
68 #define ILL_PRVOPC      ILL_PRVOPC
69   ILL_PRVREG,                   /* Privileged register.  */
70 #define ILL_PRVREG      ILL_PRVREG
71   ILL_COPROC,                   /* Coprocessor error.  */
72 #define ILL_COPROC      ILL_COPROC
73   ILL_BADSTK                    /* Internal stack error.  */
74 #define ILL_BADSTK      ILL_BADSTK
75 };
76
77 /* `si_code' values for SIGFPE signal.  */
78 enum
79 {
80   FPE_INTDIV = 1,               /* Integer divide by zero.  */
81 #define FPE_INTDIV      FPE_INTDIV
82   FPE_INTOVF,                   /* Integer overflow.  */
83 #define FPE_INTOVF      FPE_INTOVF
84   FPE_FLTDIV,                   /* Floating point divide by zero.  */
85 #define FPE_FLTDIV      FPE_FLTDIV
86   FPE_FLTOVF,                   /* Floating point overflow.  */
87 #define FPE_FLTOVF      FPE_FLTOVF
88   FPE_FLTUND,                   /* Floating point underflow.  */
89 #define FPE_FLTUND      FPE_FLTUND
90   FPE_FLTRES,                   /* Floating point inexact result.  */
91 #define FPE_FLTRES      FPE_FLTRES
92   FPE_FLTINV,                   /* Floating point invalid operation.  */
93 #define FPE_FLTINV      FPE_FLTINV
94   FPE_FLTSUB                    /* Subscript out of range.  */
95 #define FPE_FLTSUB      FPE_FLTSUB
96 };
97
98 /* `si_code' values for SIGSEGV signal.  */
99 enum
100 {
101   SEGV_MAPERR = 1,              /* Address not mapped to object.  */
102 #define SEGV_MAPERR     SEGV_MAPERR
103   SEGV_ACCERR                   /* Invalid permissions for mapped object.  */
104 #define SEGV_ACCERR     SEGV_ACCERR
105 };
106
107 /* `si_code' values for SIGBUS signal.  */
108 enum
109 {
110   BUS_ADRALN = 1,               /* Invalid address alignment.  */
111 #define BUS_ADRALN      BUS_ADRALN
112   BUS_ADRERR,                   /* Non-existant physical address.  */
113 #define BUS_ADRERR      BUS_ADRERR
114   BUS_OBJERR                    /* Object specific hardware error.  */
115 #define BUS_OBJERR      BUS_OBJERR
116 };
117
118 /* `si_code' values for SIGTRAP signal.  */
119 enum
120 {
121   TRAP_BRKPT = 1,               /* Process breakpoint.  */
122 #define TRAP_BRKPT      TRAP_BRKPT
123   TRAP_TRACE                    /* Process trace trap.  */
124 #define TRAP_TRACE      TRAP_TRACE
125 };
126
127 /* `si_code' values for SIGCHLD signal.  */
128 enum
129 {
130   CLD_EXITED = 1,               /* Child has exited.  */
131 #define CLD_EXITED      CLD_EXITED
132   CLD_KILLED,                   /* Child was killed.  */
133 #define CLD_KILLED      CLD_KILLED
134   CLD_DUMPED,                   /* Child terminated abnormally.  */
135 #define CLD_DUMPED      CLD_DUMPED
136   CLD_TRAPPED,                  /* Traced child has trapped.  */
137 #define CLD_TRAPPED     CLD_TRAPPED
138   CLD_STOPPED,                  /* Child has stopped.  */
139 #define CLD_STOPPED     CLD_STOPPED
140   CLD_CONTINUED                 /* Stopped child has continued.  */
141 #define CLD_CONTINUED   CLD_CONTINUED
142 };
143
144 /* `si_code' values for SIGPOLL signal.  */
145 enum
146 {
147   POLL_IN = 1,                  /* Data input available.  */
148 #define POLL_IN         POLL_IN
149   POLL_OUT,                     /* Output buffers available.  */
150 #define POLL_OUT        POLL_OUT
151   POLL_MSG,                     /* Input message available.   */
152 #define POLL_MSG        POLL_MSG
153   POLL_ERR,                     /* I/O error.  */
154 #define POLL_ERR        POLL_ERR
155   POLL_PRI,                     /* High priority input available.  */
156 #define POLL_PRI        POLL_PRI
157   POLL_HUP                      /* Device disconnected.  */
158 #define POLL_HUP        POLL_HUP
159 };
160
161
162 /* Structure to transport application-defined values with signals.  */
163 #define SIGEV_MAX_SIZE  64
164 #define SIGEV_PAD_SIZE  ((SIGEV_MAX_SIZE / sizeof (int)) - 3)
165
166 typedef struct sigevent
167   {
168     sigval_t sigev_value;
169     int sigev_signo;
170     int sigev_notify;
171     void (*sigev_notify_function) __P ((sigval_t)); /* Function to start.  */
172     void *sigev_notify_attributes;                  /* Really pthread_attr_t.*/
173   } sigevent_t;
174
175 /* `sigev_notify' values.  */
176 enum
177 {
178   SIGEV_SIGNAL = 0,             /* Notify via signal.  */
179 #define SIGEV_SIGNAL    SIGEV_SIGNAL
180   SIGEV_NONE,                   /* Other notification: meaningless.  */
181 #define SIGEV_NONE      SIGEV_NONE
182   SIGEV_THREAD                  /* Deliver via thread creation.  */
183 #define SIGEV_THREAD    SIGEV_THREAD
184 };