1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief POSIX Signals Support |
---|
5 | * |
---|
6 | * This include file defines internal information about POSIX signals. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-2011. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.com/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef _RTEMS_POSIX_PSIGNALIMPL_H |
---|
19 | #define _RTEMS_POSIX_PSIGNALIMPL_H |
---|
20 | |
---|
21 | /** |
---|
22 | * @defgroup POSIX_SIGNALS POSIX Signals Support |
---|
23 | * |
---|
24 | * @ingroup POSIX |
---|
25 | * |
---|
26 | * @brief Internal Information about POSIX Signals |
---|
27 | * |
---|
28 | * @{ |
---|
29 | */ |
---|
30 | |
---|
31 | #include <rtems/posix/psignal.h> |
---|
32 | #include <rtems/posix/pthread.h> |
---|
33 | #include <rtems/posix/sigset.h> |
---|
34 | #include <rtems/score/apiext.h> |
---|
35 | |
---|
36 | #define _States_Is_interruptible_signal( _states ) \ |
---|
37 | ( ((_states) & \ |
---|
38 | (STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL)) == \ |
---|
39 | (STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL)) |
---|
40 | |
---|
41 | #define SIGACTION_TERMINATE \ |
---|
42 | { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Abnormal_termination_handler} } |
---|
43 | #define SIGACTION_IGNORE \ |
---|
44 | { 0, SIGNAL_ALL_MASK, {SIG_IGN} } |
---|
45 | #define SIGACTION_STOP \ |
---|
46 | { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Stop_handler} } |
---|
47 | #define SIGACTION_CONTINUE \ |
---|
48 | { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Continue_handler} } |
---|
49 | |
---|
50 | #define SIG_ARRAY_MAX (SIGRTMAX + 1) |
---|
51 | |
---|
52 | /* |
---|
53 | * Variables |
---|
54 | */ |
---|
55 | |
---|
56 | extern sigset_t _POSIX_signals_Pending; |
---|
57 | |
---|
58 | extern const struct sigaction _POSIX_signals_Default_vectors[ SIG_ARRAY_MAX ]; |
---|
59 | |
---|
60 | extern struct sigaction _POSIX_signals_Vectors[ SIG_ARRAY_MAX ]; |
---|
61 | |
---|
62 | extern Watchdog_Control _POSIX_signals_Alarm_timer; |
---|
63 | |
---|
64 | extern Watchdog_Control _POSIX_signals_Ualarm_timer; |
---|
65 | |
---|
66 | extern Thread_queue_Control _POSIX_signals_Wait_queue; |
---|
67 | |
---|
68 | extern Chain_Control _POSIX_signals_Inactive_siginfo; |
---|
69 | |
---|
70 | extern Chain_Control _POSIX_signals_Siginfo[ SIG_ARRAY_MAX ]; |
---|
71 | |
---|
72 | extern API_extensions_Post_switch_control _POSIX_signals_Post_switch; |
---|
73 | |
---|
74 | /* |
---|
75 | * Internal routines |
---|
76 | */ |
---|
77 | |
---|
78 | /** |
---|
79 | * @brief POSIX signals manager initialization. |
---|
80 | */ |
---|
81 | void _POSIX_signals_Manager_Initialization(void); |
---|
82 | |
---|
83 | static inline void _POSIX_signals_Add_post_switch_extension(void) |
---|
84 | { |
---|
85 | _API_extensions_Add_post_switch( &_POSIX_signals_Post_switch ); |
---|
86 | } |
---|
87 | |
---|
88 | /** |
---|
89 | * @brief Unlock POSIX signals thread. |
---|
90 | * |
---|
91 | * XXX this routine could probably be cleaned up |
---|
92 | */ |
---|
93 | bool _POSIX_signals_Unblock_thread( |
---|
94 | Thread_Control *the_thread, |
---|
95 | int signo, |
---|
96 | siginfo_t *info |
---|
97 | ); |
---|
98 | |
---|
99 | /** |
---|
100 | * @brief Check POSIX signal. |
---|
101 | */ |
---|
102 | bool _POSIX_signals_Check_signal( |
---|
103 | POSIX_API_Control *api, |
---|
104 | int signo, |
---|
105 | bool is_global |
---|
106 | ); |
---|
107 | |
---|
108 | /** |
---|
109 | * @brief Clear POSIX signals. |
---|
110 | */ |
---|
111 | bool _POSIX_signals_Clear_signals( |
---|
112 | POSIX_API_Control *api, |
---|
113 | int signo, |
---|
114 | siginfo_t *info, |
---|
115 | bool is_global, |
---|
116 | bool check_blocked |
---|
117 | ); |
---|
118 | |
---|
119 | int killinfo( |
---|
120 | pid_t pid, |
---|
121 | int sig, |
---|
122 | const union sigval *value |
---|
123 | ); |
---|
124 | |
---|
125 | /** |
---|
126 | * @brief Set POSIX process signals. |
---|
127 | */ |
---|
128 | void _POSIX_signals_Set_process_signals( |
---|
129 | sigset_t mask |
---|
130 | ); |
---|
131 | |
---|
132 | void _POSIX_signals_Clear_process_signals( |
---|
133 | int signo |
---|
134 | ); |
---|
135 | |
---|
136 | /* |
---|
137 | * Default signal handlers |
---|
138 | */ |
---|
139 | |
---|
140 | #define _POSIX_signals_Stop_handler NULL |
---|
141 | #define _POSIX_signals_Continue_handler NULL |
---|
142 | |
---|
143 | void _POSIX_signals_Abnormal_termination_handler( int signo ); |
---|
144 | |
---|
145 | /** @} */ |
---|
146 | |
---|
147 | #endif |
---|
148 | /* end of file */ |
---|