1 | /** |
---|
2 | * @file rtems/posix/psignal.h |
---|
3 | */ |
---|
4 | |
---|
5 | /* |
---|
6 | * COPYRIGHT (c) 1989-2008. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in the file LICENSE in this distribution or at |
---|
11 | * http://www.rtems.com/license/LICENSE. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef _RTEMS_POSIX_PSIGNAL_H |
---|
17 | #define _RTEMS_POSIX_PSIGNAL_H |
---|
18 | |
---|
19 | #include <rtems/posix/pthread.h> |
---|
20 | |
---|
21 | /* |
---|
22 | * Currently 32 signals numbered 1-32 are defined |
---|
23 | */ |
---|
24 | |
---|
25 | #define SIGNAL_EMPTY_MASK 0x00000000 |
---|
26 | #define SIGNAL_ALL_MASK 0xffffffffL |
---|
27 | |
---|
28 | static inline sigset_t signo_to_mask( |
---|
29 | uint32_t sig |
---|
30 | ) |
---|
31 | { |
---|
32 | return 1u << (sig - 1); |
---|
33 | } |
---|
34 | |
---|
35 | #define is_valid_signo( _sig ) \ |
---|
36 | ((_sig) >= 1 && (_sig) <= 32 ) |
---|
37 | |
---|
38 | #define _States_Is_interruptible_signal( _states ) \ |
---|
39 | ( ((_states) & \ |
---|
40 | (STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL)) == \ |
---|
41 | (STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL)) |
---|
42 | |
---|
43 | #define SIGACTION_TERMINATE \ |
---|
44 | { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Abnormal_termination_handler} } |
---|
45 | #define SIGACTION_IGNORE \ |
---|
46 | { 0, SIGNAL_ALL_MASK, {SIG_IGN} } |
---|
47 | #define SIGACTION_STOP \ |
---|
48 | { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Stop_handler} } |
---|
49 | #define SIGACTION_CONTINUE \ |
---|
50 | { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Continue_handler} } |
---|
51 | |
---|
52 | #define SIG_ARRAY_MAX (SIGRTMAX + 1) |
---|
53 | |
---|
54 | /* |
---|
55 | * Variables |
---|
56 | */ |
---|
57 | |
---|
58 | extern sigset_t _POSIX_signals_Pending; |
---|
59 | |
---|
60 | extern const struct sigaction _POSIX_signals_Default_vectors[ SIG_ARRAY_MAX ]; |
---|
61 | |
---|
62 | extern struct sigaction _POSIX_signals_Vectors[ SIG_ARRAY_MAX ]; |
---|
63 | |
---|
64 | extern Watchdog_Control _POSIX_signals_Alarm_timer; |
---|
65 | |
---|
66 | extern Watchdog_Control _POSIX_signals_Ualarm_timer; |
---|
67 | |
---|
68 | extern Thread_queue_Control _POSIX_signals_Wait_queue; |
---|
69 | |
---|
70 | extern Chain_Control _POSIX_signals_Inactive_siginfo; |
---|
71 | |
---|
72 | extern Chain_Control _POSIX_signals_Siginfo[ SIG_ARRAY_MAX ]; |
---|
73 | |
---|
74 | /* |
---|
75 | * POSIX internal siginfo structure |
---|
76 | */ |
---|
77 | |
---|
78 | typedef struct { |
---|
79 | Chain_Node Node; |
---|
80 | siginfo_t Info; |
---|
81 | } POSIX_signals_Siginfo_node; |
---|
82 | |
---|
83 | /* |
---|
84 | * Internal routines |
---|
85 | */ |
---|
86 | |
---|
87 | void _POSIX_signals_Manager_Initialization(void); |
---|
88 | |
---|
89 | void _POSIX_signals_Post_switch_extension( |
---|
90 | Thread_Control *the_thread |
---|
91 | ); |
---|
92 | |
---|
93 | bool _POSIX_signals_Unblock_thread( |
---|
94 | Thread_Control *the_thread, |
---|
95 | int signo, |
---|
96 | siginfo_t *info |
---|
97 | ); |
---|
98 | |
---|
99 | bool _POSIX_signals_Check_signal( |
---|
100 | POSIX_API_Control *api, |
---|
101 | int signo, |
---|
102 | bool is_global |
---|
103 | ); |
---|
104 | |
---|
105 | bool _POSIX_signals_Clear_signals( |
---|
106 | POSIX_API_Control *api, |
---|
107 | int signo, |
---|
108 | siginfo_t *info, |
---|
109 | bool is_global, |
---|
110 | bool check_blocked |
---|
111 | ); |
---|
112 | |
---|
113 | int killinfo( |
---|
114 | pid_t pid, |
---|
115 | int sig, |
---|
116 | const union sigval *value |
---|
117 | ); |
---|
118 | |
---|
119 | void _POSIX_signals_Set_process_signals( |
---|
120 | sigset_t mask |
---|
121 | ); |
---|
122 | |
---|
123 | void _POSIX_signals_Clear_process_signals( |
---|
124 | int signo |
---|
125 | ); |
---|
126 | |
---|
127 | /* |
---|
128 | * Default signal handlers |
---|
129 | */ |
---|
130 | |
---|
131 | #define _POSIX_signals_Stop_handler NULL |
---|
132 | #define _POSIX_signals_Continue_handler NULL |
---|
133 | |
---|
134 | void _POSIX_signals_Abnormal_termination_handler( int signo ); |
---|
135 | |
---|
136 | #endif |
---|
137 | /* end of file */ |
---|