1 /* Prototypes for System Event Framework (SEF) functions. */
8 /* SEF entry points for system processes. */
9 void sef_startup(void);
10 int sef_receive_status(endpoint_t src
, message
*m_ptr
, int *status_ptr
);
11 void sef_cancel(void);
12 void sef_exit(int status
);
13 #define sef_receive(src, m_ptr) sef_receive_status(src, m_ptr, NULL)
17 #define sef_dprint printf
18 #define sef_debug_begin() (void)(NULL)
19 #define sef_debug_end() (void)(NULL)
21 /*===========================================================================*
23 *===========================================================================*/
24 /* What to intercept. */
25 #define INTERCEPT_SEF_INIT_REQUESTS 1
26 #define IS_SEF_INIT_REQUEST(mp) ((mp)->m_type == RS_INIT \
27 && (mp)->m_source == RS_PROC_NR)
29 /* Type definitions. */
31 cp_grant_id_t rproctab_gid
;
33 endpoint_t old_endpoint
;
36 /* Callback type definitions. */
37 typedef int(*sef_cb_init_t
)(int type
, sef_init_info_t
*info
);
38 typedef int(*sef_cb_init_response_t
)(message
*m_ptr
);
40 /* Callback registration helpers. */
41 void sef_setcb_init_fresh(sef_cb_init_t cb
);
42 void sef_setcb_init_lu(sef_cb_init_t cb
);
43 void sef_setcb_init_restart(sef_cb_init_t cb
);
44 void sef_setcb_init_response(sef_cb_init_response_t cb
);
46 /* Predefined callback implementations. */
47 int sef_cb_init_null(int type
, sef_init_info_t
*info
);
48 int sef_cb_init_response_null(message
*m_ptr
);
50 int sef_cb_init_fail(int type
, sef_init_info_t
*info
);
51 int sef_cb_init_reset(int type
, sef_init_info_t
*info
);
52 int sef_cb_init_crash(int type
, sef_init_info_t
*info
);
53 int sef_cb_init_response_rs_reply(message
*m_ptr
);
55 /* Macros for predefined callback implementations. */
56 #define SEF_CB_INIT_FRESH_NULL sef_cb_init_null
57 #define SEF_CB_INIT_LU_NULL sef_cb_init_null
58 #define SEF_CB_INIT_RESTART_NULL sef_cb_init_null
59 #define SEF_CB_INIT_RESPONSE_NULL sef_cb_init_response_null
61 #define SEF_CB_INIT_FRESH_DEFAULT sef_cb_init_null
62 #define SEF_CB_INIT_LU_DEFAULT sef_cb_init_null
63 #define SEF_CB_INIT_RESTART_DEFAULT sef_cb_init_reset
64 #define SEF_CB_INIT_RESPONSE_DEFAULT sef_cb_init_response_rs_reply
67 #define SEF_INIT_FRESH 0 /* init fresh */
68 #define SEF_INIT_LU 1 /* init after live update */
69 #define SEF_INIT_RESTART 2 /* init after restart */
72 #define SEF_INIT_DEBUG_DEFAULT 0
74 #ifndef SEF_INIT_DEBUG
75 #define SEF_INIT_DEBUG SEF_INIT_DEBUG_DEFAULT
78 #define sef_init_dprint sef_dprint
79 #define sef_init_debug_begin sef_debug_begin
80 #define sef_init_debug_end sef_debug_end
82 /*===========================================================================*
84 *===========================================================================*/
85 /* What to intercept. */
86 #define INTERCEPT_SEF_PING_REQUESTS 1
87 #define IS_SEF_PING_REQUEST(mp, status) (is_ipc_notify(status) \
88 && (mp)->m_source == RS_PROC_NR)
90 /* Callback type definitions. */
91 typedef void(*sef_cb_ping_reply_t
)(endpoint_t source
);
93 /* Callback registration helpers. */
94 void sef_setcb_ping_reply(sef_cb_ping_reply_t cb
);
96 /* Predefined callback implementations. */
97 void sef_cb_ping_reply_null(endpoint_t source
);
99 void sef_cb_ping_reply_pong(endpoint_t source
);
101 /* Macros for predefined callback implementations. */
102 #define SEF_CB_PING_REPLY_NULL sef_cb_ping_reply_null
104 #define SEF_CB_PING_REPLY_DEFAULT sef_cb_ping_reply_pong
107 #define SEF_PING_DEBUG_DEFAULT 0
109 #ifndef SEF_PING_DEBUG
110 #define SEF_PING_DEBUG SEF_PING_DEBUG_DEFAULT
113 #define sef_ping_dprint sef_dprint
114 #define sef_ping_debug_begin sef_debug_begin
115 #define sef_ping_debug_end sef_debug_end
117 /*===========================================================================*
119 *===========================================================================*/
120 /* What to intercept. */
121 #define INTERCEPT_SEF_LU_REQUESTS 1
122 #define IS_SEF_LU_REQUEST(mp, status) ((mp)->m_type == RS_LU_PREPARE \
123 && (mp)->m_source == RS_PROC_NR)
125 /* Callback type definitions. */
126 typedef int(*sef_cb_lu_prepare_t
)(int);
127 typedef int(*sef_cb_lu_state_isvalid_t
)(int);
128 typedef void(*sef_cb_lu_state_changed_t
)(int, int);
129 typedef void(*sef_cb_lu_state_dump_t
)(int);
130 typedef int(*sef_cb_lu_state_save_t
)(int);
131 typedef int(*sef_cb_lu_response_t
)(message
*m_ptr
);
133 /* Callback registration helpers. */
134 void sef_setcb_lu_prepare(sef_cb_lu_prepare_t cb
);
135 void sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_t cb
);
136 void sef_setcb_lu_state_changed(sef_cb_lu_state_changed_t cb
);
137 void sef_setcb_lu_state_dump(sef_cb_lu_state_dump_t cb
);
138 void sef_setcb_lu_state_save(sef_cb_lu_state_save_t cb
);
139 void sef_setcb_lu_response(sef_cb_lu_response_t cb
);
141 /* Predefined callback implementations. */
142 int sef_cb_lu_prepare_null(int state
);
143 int sef_cb_lu_state_isvalid_null(int state
);
144 void sef_cb_lu_state_changed_null(int old_state
, int state
);
145 void sef_cb_lu_state_dump_null(int state
);
146 int sef_cb_lu_state_save_null(int state
);
147 int sef_cb_lu_response_null(message
*m_ptr
);
149 int sef_cb_lu_prepare_always_ready(int state
);
150 int sef_cb_lu_prepare_never_ready(int state
);
151 int sef_cb_lu_prepare_crash(int state
);
152 int sef_cb_lu_state_isvalid_standard(int state
);
153 int sef_cb_lu_state_isvalid_workfree(int state
);
154 int sef_cb_lu_response_rs_reply(message
*m_ptr
);
156 /* Macros for predefined callback implementations. */
157 #define SEF_CB_LU_PREPARE_NULL sef_cb_lu_prepare_null
158 #define SEF_CB_LU_STATE_ISVALID_NULL sef_cb_lu_state_isvalid_null
159 #define SEF_CB_LU_STATE_CHANGED_NULL sef_cb_lu_state_changed_null
160 #define SEF_CB_LU_STATE_DUMP_NULL sef_cb_lu_state_dump_null
161 #define SEF_CB_LU_STATE_SAVE_NULL sef_cb_lu_state_save_null
162 #define SEF_CB_LU_RESPONSE_NULL sef_cb_lu_response_null
164 #define SEF_CB_LU_PREPARE_DEFAULT sef_cb_lu_prepare_null
165 #define SEF_CB_LU_STATE_ISVALID_DEFAULT sef_cb_lu_state_isvalid_null
166 #define SEF_CB_LU_STATE_CHANGED_DEFAULT sef_cb_lu_state_changed_null
167 #define SEF_CB_LU_STATE_DUMP_DEFAULT sef_cb_lu_state_dump_null
168 #define SEF_CB_LU_STATE_SAVE_DEFAULT sef_cb_lu_state_save_null
169 #define SEF_CB_LU_RESPONSE_DEFAULT sef_cb_lu_response_rs_reply
171 /* Standard live update states. */
172 #define SEF_LU_STATE_NULL 0 /* null state */
173 #define SEF_LU_STATE_WORK_FREE 1 /* no work in progress */
174 #define SEF_LU_STATE_REQUEST_FREE 2 /* no request in progress */
175 #define SEF_LU_STATE_PROTOCOL_FREE 3 /* no protocol in progress */
176 #define SEF_LU_STATE_CUSTOM_BASE (SEF_LU_STATE_PROTOCOL_FREE+1)
177 #define SEF_LU_STATE_IS_STANDARD(s) ((s) > SEF_LU_STATE_NULL \
178 && (s) < SEF_LU_STATE_CUSTOM_BASE)
181 #define SEF_LU_DEBUG_DEFAULT 1
184 #define SEF_LU_DEBUG SEF_LU_DEBUG_DEFAULT
187 #define sef_lu_dprint sef_dprint
188 #define sef_lu_debug_begin sef_debug_begin
189 #define sef_lu_debug_end sef_debug_end
191 /*===========================================================================*
193 *===========================================================================*/
194 /* What to intercept. */
195 #define INTERCEPT_SEF_SIGNAL_REQUESTS 1
196 #define IS_SEF_SIGNAL_REQUEST(mp, status) \
197 (((mp)->m_type == SIGS_SIGNAL_RECEIVED && (mp)->m_source < INIT_PROC_NR) \
198 || (is_ipc_notify(status) && (mp)->m_source == SYSTEM))
200 /* Callback type definitions. */
201 typedef void(*sef_cb_signal_handler_t
)(int signo
);
202 typedef int(*sef_cb_signal_manager_t
)(endpoint_t target
, int signo
);
203 typedef int(*sef_cb_gcov_t
)(message
*msg
);
205 /* Callback registration helpers. */
206 void sef_setcb_signal_handler(sef_cb_signal_handler_t cb
);
207 void sef_setcb_signal_manager(sef_cb_signal_manager_t cb
);
208 void sef_setcb_gcov(sef_cb_gcov_t cb
);
210 /* Predefined callback implementations. */
211 void sef_cb_signal_handler_null(int signo
);
212 int sef_cb_signal_manager_null(endpoint_t target
, int signo
);
214 void sef_cb_signal_handler_term(int signo
);
215 void sef_cb_signal_handler_posix_default(int signo
);
217 /* Macros for predefined callback implementations. */
218 #define SEF_CB_SIGNAL_HANDLER_NULL sef_cb_signal_handler_null
219 #define SEF_CB_SIGNAL_MANAGER_NULL sef_cb_signal_manager_null
221 #define SEF_CB_SIGNAL_HANDLER_DEFAULT sef_cb_signal_handler_null
222 #define SEF_CB_SIGNAL_MANAGER_DEFAULT sef_cb_signal_manager_null
225 #define SEF_SIGNAL_DEBUG_DEFAULT 0
227 #ifndef SEF_SIGNAL_DEBUG
228 #define SEF_SIGNAL_DEBUG SEF_SIGNAL_DEBUG_DEFAULT
231 #define sef_signal_dprint sef_dprint
232 #define sef_signal_debug_begin sef_debug_begin
233 #define sef_signal_debug_end sef_debug_end
235 #if !defined(USE_LIVEUPDATE)
236 #undef INTERCEPT_SEF_LU_REQUESTS