1 |
39 |
lampret |
/*
|
2 |
56 |
joel |
* $Id: siginfo.h,v 1.1.1.2 2000-08-30 19:04:15 joel Exp $
|
3 |
39 |
lampret |
*/
|
4 |
|
|
|
5 |
|
|
#ifndef __POSIX_SYS_SIGNAL_INFORMATION_h
|
6 |
|
|
#define __POSIX_SYS_SIGNAL_INFORMATION_h
|
7 |
|
|
|
8 |
56 |
joel |
#ifdef __cplusplus
|
9 |
|
|
extern "C" {
|
10 |
|
|
#endif
|
11 |
|
|
|
12 |
39 |
lampret |
#if defined(_POSIX_THREADS)
|
13 |
|
|
#include <sys/types.h>
|
14 |
|
|
#endif
|
15 |
|
|
|
16 |
|
|
/*
|
17 |
|
|
* 3.3 Signal Concepts, P1003.1b-1993, p. 60
|
18 |
|
|
*/
|
19 |
|
|
|
20 |
|
|
typedef __uint32_t sigset_t;
|
21 |
|
|
|
22 |
|
|
#define SIG_DFL ((void (*)())0) /* Request for default signal handling */
|
23 |
|
|
#define SIG_IGN ((void (*)())1) /* Request that signal be ignored */
|
24 |
|
|
|
25 |
|
|
#define SIG_ERR ((void (*)())-1) /* Returned by signal() on error */
|
26 |
|
|
|
27 |
|
|
/*
|
28 |
|
|
* Required Signals.
|
29 |
|
|
*
|
30 |
|
|
* The default action is in parentheses and is one of the
|
31 |
|
|
* following actions:
|
32 |
|
|
*
|
33 |
|
|
* (1) abnormal termination of process
|
34 |
|
|
* (2) ignore the signal
|
35 |
|
|
* (3) stop the process
|
36 |
|
|
* (4) continue the process if it is currently stopped, otherwise
|
37 |
|
|
* ignore the signal
|
38 |
|
|
*/
|
39 |
|
|
|
40 |
|
|
#define SIGHUP 1 /* (1) hangup detected on controlling terminal */
|
41 |
|
|
#define SIGINT 2 /* (1) interactive attention signal */
|
42 |
|
|
#define SIGQUIT 3 /* (1) interactive termination signal */
|
43 |
|
|
#define SIGILL 4 /* (1) illegal instruction */
|
44 |
|
|
#define SIGTRAP 5 /* (1) trace trap (not reset) */
|
45 |
|
|
#define SIGIOT 6 /* (1) IOT instruction */
|
46 |
|
|
#define SIGABRT 6 /* (1) abnormal terminal signal */
|
47 |
|
|
#define SIGEMT 7 /* (1) EMT instruction */
|
48 |
|
|
#define SIGFPE 8 /* (1) erroneous arithmetic operation */
|
49 |
|
|
#define SIGKILL 9 /* (1) termination signal */
|
50 |
|
|
#define SIGBUS 10 /* (1) bus error */
|
51 |
|
|
#define SIGSEGV 11 /* (1) invalid memory reference */
|
52 |
|
|
#define SIGSYS 12 /* (1) bad argument to system call */
|
53 |
|
|
#define SIGPIPE 13 /* (1) write on pipe with no readers */
|
54 |
|
|
#define SIGALRM 14 /* (1) timeout signal, such as initiated by alarm() */
|
55 |
|
|
#define SIGTERM 15 /* (1) termination signal */
|
56 |
|
|
#define SIGUSR1 16 /* (1) reserved as application defined signal 1 */
|
57 |
|
|
#define SIGUSR2 17 /* (1) reserved as application defined signal 2 */
|
58 |
|
|
|
59 |
|
|
#define __SIGFIRSTNOTRT SIGHUP
|
60 |
|
|
#define __SIGLASTNOTRT SIGUSR2
|
61 |
|
|
|
62 |
|
|
/*
|
63 |
|
|
* RTEMS does not support job control, hence no Job Control Signals are
|
64 |
|
|
* defined per P1003.1b-1993, p. 60-61.
|
65 |
|
|
*/
|
66 |
|
|
|
67 |
|
|
/*
|
68 |
|
|
* RTEMS does not support memory protection, hence no Memory Protection
|
69 |
|
|
* Signals are defined per P1003.1b-1993, p. 60-61.
|
70 |
|
|
*/
|
71 |
|
|
|
72 |
|
|
/*
|
73 |
|
|
* Real-Time Signals Range, P1003.1b-1993, p. 61
|
74 |
|
|
*
|
75 |
|
|
* NOTE: This should be at least RTSIG_MAX (which is a minimum of 8) signals.
|
76 |
|
|
*/
|
77 |
|
|
|
78 |
|
|
#define SIGRTMIN 18
|
79 |
|
|
#define SIGRTMAX 32
|
80 |
|
|
|
81 |
|
|
/* sigev_notify values
|
82 |
|
|
*
|
83 |
|
|
* NOTE: P1003.1c/D10, p. 34 adds SIGEV_THREAD.
|
84 |
|
|
*/
|
85 |
|
|
|
86 |
|
|
#define SIGEV_NONE 1 /* No asynchronous notification shall be delivered */
|
87 |
|
|
/* when the event of interest occurs. */
|
88 |
|
|
#define SIGEV_SIGNAL 2 /* A queued signal, with an application defined */
|
89 |
|
|
/* value, shall be delivered when the event of */
|
90 |
|
|
/* interest occurs. */
|
91 |
|
|
#define SIGEV_THREAD 3 /* A notification function shall be called to */
|
92 |
|
|
/* perform notification. */
|
93 |
|
|
/*
|
94 |
|
|
* 3.3.1.2 Signal Generation and Delivery, P1003.1b-1993, p. 63
|
95 |
|
|
*
|
96 |
|
|
* NOTE: P1003.1c/D10, p. 34 adds sigev_notify_function and
|
97 |
|
|
* sigev_notify_attributes to the sigevent structure.
|
98 |
|
|
*/
|
99 |
|
|
|
100 |
|
|
union sigval {
|
101 |
|
|
int sival_int; /* Integer signal value */
|
102 |
|
|
void *sival_ptr; /* Pointer signal value */
|
103 |
|
|
};
|
104 |
|
|
|
105 |
|
|
struct sigevent {
|
106 |
|
|
int sigev_notify; /* Notification type */
|
107 |
|
|
int sigev_signo; /* Signal number */
|
108 |
|
|
union sigval sigev_value; /* Signal value */
|
109 |
|
|
|
110 |
|
|
#if defined(_POSIX_THREADS)
|
111 |
|
|
void (*sigev_notify_function)( union sigval );
|
112 |
|
|
/* Notification function */
|
113 |
|
|
pthread_attr_t *sigev_notify_attributes; /* Notification Attributes */
|
114 |
|
|
#endif
|
115 |
|
|
};
|
116 |
|
|
|
117 |
|
|
/*
|
118 |
|
|
* 3.3.1.3 Signal Actions, P1003.1b-1993, p. 64
|
119 |
|
|
*/
|
120 |
|
|
|
121 |
|
|
/* si_code values, p. 66 */
|
122 |
|
|
|
123 |
|
|
#define SI_USER 1 /* Sent by a user. kill(), abort(), etc */
|
124 |
|
|
#define SI_QUEUE 2 /* Sent by sigqueue() */
|
125 |
|
|
#define SI_TIMER 3 /* Sent by expiration of a timer_settime() timer */
|
126 |
|
|
#define SI_ASYNCIO 4 /* Indicates completion of asycnhronous IO */
|
127 |
|
|
#define SI_MESGQ 5 /* Indicates arrival of a message at an empty queue */
|
128 |
|
|
|
129 |
|
|
typedef struct {
|
130 |
|
|
int si_signo; /* Signal number */
|
131 |
|
|
int si_code; /* Cause of the signal */
|
132 |
|
|
union sigval si_value; /* Signal value */
|
133 |
|
|
} siginfo_t;
|
134 |
|
|
|
135 |
|
|
/*
|
136 |
|
|
* 3.3.4 Examine and Change Signal Action, P1003.1b-1993, p. 70
|
137 |
|
|
*/
|
138 |
|
|
|
139 |
|
|
/* sa_flags values */
|
140 |
|
|
|
141 |
|
|
#define SA_NOCLDSTOP 1 /* Do not generate SIGCHLD when children stop */
|
142 |
|
|
#define SA_SIGINFO 2 /* Invoke the signal catching function with */
|
143 |
|
|
/* three arguments instead of one. */
|
144 |
|
|
|
145 |
|
|
/*
|
146 |
|
|
* Data Structure Notes:
|
147 |
|
|
*
|
148 |
|
|
* (1) Routines stored in sa_handler should take a single int as
|
149 |
|
|
* there argument although the POSIX standard does not require this.
|
150 |
|
|
* (2) The fields sa_handler and sa_sigaction may overlap, and a conforming
|
151 |
|
|
* application should not use both simultaneously.
|
152 |
|
|
*
|
153 |
|
|
* NOTE: In this implementation, macros are provided to access into the
|
154 |
|
|
* union.
|
155 |
|
|
*/
|
156 |
|
|
|
157 |
|
|
struct sigaction {
|
158 |
|
|
int sa_flags; /* Special flags to affect behavior of signal */
|
159 |
|
|
sigset_t sa_mask; /* Additional set of signals to be blocked */
|
160 |
|
|
/* during execution of signal-catching */
|
161 |
|
|
/* function. */
|
162 |
|
|
union {
|
163 |
|
|
void (*_handler)(); /* SIG_DFL, SIG_IGN, or pointer to a function */
|
164 |
|
|
void (*_sigaction)( int, siginfo_t *, void * );
|
165 |
|
|
} _signal_handlers;
|
166 |
|
|
};
|
167 |
|
|
|
168 |
|
|
#define sa_handler _signal_handlers._handler
|
169 |
|
|
#define sa_sigaction _signal_handlers._sigaction
|
170 |
|
|
|
171 |
56 |
joel |
#ifdef __cplusplus
|
172 |
|
|
}
|
173 |
|
|
#endif
|
174 |
|
|
|
175 |
39 |
lampret |
#endif
|
176 |
|
|
/* end of include file */
|