1 | /** |
---|
2 | * @file rtems/posix/psignal.h |
---|
3 | */ |
---|
4 | |
---|
5 | /* |
---|
6 | * COPYRIGHT (c) 1989-2007. |
---|
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 0xffffffff |
---|
27 | |
---|
28 | #define signo_to_mask( _sig ) (1 << ((_sig) - 1)) |
---|
29 | |
---|
30 | #define is_valid_signo( _sig ) \ |
---|
31 | ((_sig) >= 1 && (_sig) <= 32 ) |
---|
32 | |
---|
33 | #define _States_Is_interruptible_signal( _states ) \ |
---|
34 | ( ((_states) & \ |
---|
35 | (STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL)) == \ |
---|
36 | (STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL)) |
---|
37 | |
---|
38 | #define SIGACTION_TERMINATE \ |
---|
39 | { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Abnormal_termination_handler} } |
---|
40 | #define SIGACTION_IGNORE \ |
---|
41 | { 0, SIGNAL_ALL_MASK, {SIG_IGN} } |
---|
42 | #define SIGACTION_STOP \ |
---|
43 | { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Stop_handler} } |
---|
44 | #define SIGACTION_CONTINUE \ |
---|
45 | { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Continue_handler} } |
---|
46 | |
---|
47 | #define SIG_ARRAY_MAX (SIGRTMAX + 1) |
---|
48 | |
---|
49 | /* |
---|
50 | * Variables |
---|
51 | */ |
---|
52 | |
---|
53 | extern sigset_t _POSIX_signals_Pending; |
---|
54 | |
---|
55 | extern const struct sigaction _POSIX_signals_Default_vectors[ SIG_ARRAY_MAX ]; |
---|
56 | |
---|
57 | extern struct sigaction _POSIX_signals_Vectors[ SIG_ARRAY_MAX ]; |
---|
58 | |
---|
59 | extern Watchdog_Control _POSIX_signals_Alarm_timer; |
---|
60 | |
---|
61 | extern Thread_queue_Control _POSIX_signals_Wait_queue; |
---|
62 | |
---|
63 | extern Chain_Control _POSIX_signals_Inactive_siginfo; |
---|
64 | |
---|
65 | extern Chain_Control _POSIX_signals_Siginfo[ SIG_ARRAY_MAX ]; |
---|
66 | |
---|
67 | /* |
---|
68 | * POSIX internal siginfo structure |
---|
69 | */ |
---|
70 | |
---|
71 | typedef struct { |
---|
72 | Chain_Node Node; |
---|
73 | siginfo_t Info; |
---|
74 | } POSIX_signals_Siginfo_node; |
---|
75 | |
---|
76 | /* |
---|
77 | * Internal routines |
---|
78 | */ |
---|
79 | |
---|
80 | void _POSIX_signals_Manager_Initialization( |
---|
81 | int maximum_queued_signals |
---|
82 | ); |
---|
83 | |
---|
84 | void _POSIX_signals_Post_switch_extension( |
---|
85 | Thread_Control *the_thread |
---|
86 | ); |
---|
87 | |
---|
88 | boolean _POSIX_signals_Unblock_thread( |
---|
89 | Thread_Control *the_thread, |
---|
90 | int signo, |
---|
91 | siginfo_t *info |
---|
92 | ); |
---|
93 | |
---|
94 | boolean _POSIX_signals_Check_signal( |
---|
95 | POSIX_API_Control *api, |
---|
96 | int signo, |
---|
97 | boolean is_global |
---|
98 | ); |
---|
99 | |
---|
100 | boolean _POSIX_signals_Clear_signals( |
---|
101 | POSIX_API_Control *api, |
---|
102 | int signo, |
---|
103 | siginfo_t *info, |
---|
104 | boolean is_global, |
---|
105 | boolean check_blocked |
---|
106 | ); |
---|
107 | |
---|
108 | int killinfo( |
---|
109 | pid_t pid, |
---|
110 | int sig, |
---|
111 | const union sigval *value |
---|
112 | ); |
---|
113 | |
---|
114 | void _POSIX_signals_Set_process_signals( |
---|
115 | sigset_t mask |
---|
116 | ); |
---|
117 | |
---|
118 | void _POSIX_signals_Clear_process_signals( |
---|
119 | sigset_t mask |
---|
120 | ); |
---|
121 | |
---|
122 | /* |
---|
123 | * Default signal handlers |
---|
124 | */ |
---|
125 | |
---|
126 | #define _POSIX_signals_Stop_handler NULL |
---|
127 | #define _POSIX_signals_Continue_handler NULL |
---|
128 | |
---|
129 | void _POSIX_signals_Abnormal_termination_handler( int signo ); |
---|
130 | |
---|
131 | #endif |
---|
132 | /* end of file */ |
---|