1 /* Prototypes for System Event Framework (SEF) functions. */
8 /* SEF entry points for system processes. */
9 _PROTOTYPE( void sef_startup
, (void) );
10 _PROTOTYPE( int sef_receive_status
, (endpoint_t src
, message
*m_ptr
,
12 _PROTOTYPE( 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() fflush(stdout)
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
;
34 /* Callback type definitions. */
35 typedef int(*sef_cb_init_t
)(int type
, sef_init_info_t
*info
);
37 /* Callback registration helpers. */
38 _PROTOTYPE( void sef_setcb_init_fresh
, (sef_cb_init_t cb
));
39 _PROTOTYPE( void sef_setcb_init_lu
, (sef_cb_init_t cb
));
40 _PROTOTYPE( void sef_setcb_init_restart
, (sef_cb_init_t cb
));
42 /* Predefined callback implementations. */
43 _PROTOTYPE( int sef_cb_init_null
, (int type
, sef_init_info_t
*info
) );
45 _PROTOTYPE( int sef_cb_init_fail
, (int type
, sef_init_info_t
*info
) );
46 _PROTOTYPE( int sef_cb_init_crash
, (int type
, sef_init_info_t
*info
) );
48 /* Macros for predefined callback implementations. */
49 #define SEF_CB_INIT_FRESH_NULL sef_cb_init_null
50 #define SEF_CB_INIT_LU_NULL sef_cb_init_null
51 #define SEF_CB_INIT_RESTART_NULL sef_cb_init_null
53 #define SEF_CB_INIT_FRESH_DEFAULT sef_cb_init_null
54 #define SEF_CB_INIT_LU_DEFAULT sef_cb_init_null
55 #define SEF_CB_INIT_RESTART_DEFAULT sef_cb_init_null
58 #define SEF_INIT_FRESH 0 /* init fresh */
59 #define SEF_INIT_LU 1 /* init after live update */
60 #define SEF_INIT_RESTART 2 /* init after restart */
63 #define SEF_INIT_DEBUG_DEFAULT 0
65 #ifndef SEF_INIT_DEBUG
66 #define SEF_INIT_DEBUG SEF_INIT_DEBUG_DEFAULT
69 #define sef_init_dprint sef_dprint
70 #define sef_init_debug_begin sef_debug_begin
71 #define sef_init_debug_end sef_debug_end
73 /*===========================================================================*
75 *===========================================================================*/
76 /* What to intercept. */
77 #define INTERCEPT_SEF_PING_REQUESTS 1
78 #define IS_SEF_PING_REQUEST(mp, status) (is_ipc_notify(status) \
79 && (mp)->m_source == RS_PROC_NR)
81 /* Callback type definitions. */
82 typedef void(*sef_cb_ping_reply_t
)(endpoint_t source
);
84 /* Callback registration helpers. */
85 _PROTOTYPE( void sef_setcb_ping_reply
, (sef_cb_ping_reply_t cb
));
87 /* Predefined callback implementations. */
88 _PROTOTYPE( void sef_cb_ping_reply_null
, (endpoint_t source
) );
90 _PROTOTYPE( void sef_cb_ping_reply_pong
, (endpoint_t source
) );
92 /* Macros for predefined callback implementations. */
93 #define SEF_CB_PING_REPLY_NULL sef_cb_ping_reply_null
95 #define SEF_CB_PING_REPLY_DEFAULT sef_cb_ping_reply_pong
98 #define SEF_PING_DEBUG_DEFAULT 0
100 #ifndef SEF_PING_DEBUG
101 #define SEF_PING_DEBUG SEF_PING_DEBUG_DEFAULT
104 #define sef_ping_dprint sef_dprint
105 #define sef_ping_debug_begin sef_debug_begin
106 #define sef_ping_debug_end sef_debug_end
108 /*===========================================================================*
110 *===========================================================================*/
111 /* What to intercept. */
112 #define INTERCEPT_SEF_LU_REQUESTS 1
113 #define IS_SEF_LU_REQUEST(mp, status) ((mp)->m_type == RS_LU_PREPARE \
114 && (mp)->m_source == RS_PROC_NR)
116 /* Callback type definitions. */
117 typedef int(*sef_cb_lu_prepare_t
)(int);
118 typedef int(*sef_cb_lu_state_isvalid_t
)(int);
119 typedef void(*sef_cb_lu_state_changed_t
)(int, int);
120 typedef void(*sef_cb_lu_state_dump_t
)(int);
121 typedef int(*sef_cb_lu_state_save_t
)(int);
123 /* Callback registration helpers. */
124 _PROTOTYPE( void sef_setcb_lu_prepare
, (sef_cb_lu_prepare_t cb
) );
125 _PROTOTYPE( void sef_setcb_lu_state_isvalid
, (sef_cb_lu_state_isvalid_t cb
) );
126 _PROTOTYPE( void sef_setcb_lu_state_changed
, (sef_cb_lu_state_changed_t cb
) );
127 _PROTOTYPE( void sef_setcb_lu_state_dump
, (sef_cb_lu_state_dump_t cb
) );
128 _PROTOTYPE( void sef_setcb_lu_state_save
, (sef_cb_lu_state_save_t cb
) );
130 /* Predefined callback implementations. */
131 _PROTOTYPE( int sef_cb_lu_prepare_null
, (int state
) );
132 _PROTOTYPE( int sef_cb_lu_state_isvalid_null
, (int state
) );
133 _PROTOTYPE( void sef_cb_lu_state_changed_null
, (int old_state
, int state
) );
134 _PROTOTYPE( void sef_cb_lu_state_dump_null
, (int state
) );
135 _PROTOTYPE( int sef_cb_lu_state_save_null
, (int state
) );
137 _PROTOTYPE( int sef_cb_lu_prepare_always_ready
, (int state
) );
138 _PROTOTYPE( int sef_cb_lu_prepare_never_ready
, (int state
) );
139 _PROTOTYPE( int sef_cb_lu_prepare_crash
, (int state
) );
140 _PROTOTYPE( int sef_cb_lu_state_isvalid_standard
, (int state
) );
141 _PROTOTYPE( int sef_cb_lu_state_isvalid_workfree
, (int state
) );
143 /* Macros for predefined callback implementations. */
144 #define SEF_CB_LU_PREPARE_NULL sef_cb_lu_prepare_null
145 #define SEF_CB_LU_STATE_ISVALID_NULL sef_cb_lu_state_isvalid_null
146 #define SEF_CB_LU_STATE_CHANGED_NULL sef_cb_lu_state_changed_null
147 #define SEF_CB_LU_STATE_DUMP_NULL sef_cb_lu_state_dump_null
148 #define SEF_CB_LU_STATE_SAVE_NULL sef_cb_lu_state_save_null
150 #define SEF_CB_LU_PREPARE_DEFAULT sef_cb_lu_prepare_null
151 #define SEF_CB_LU_STATE_ISVALID_DEFAULT sef_cb_lu_state_isvalid_null
152 #define SEF_CB_LU_STATE_CHANGED_DEFAULT sef_cb_lu_state_changed_null
153 #define SEF_CB_LU_STATE_DUMP_DEFAULT sef_cb_lu_state_dump_null
154 #define SEF_CB_LU_STATE_SAVE_DEFAULT sef_cb_lu_state_save_null
156 /* Standard live update states. */
157 #define SEF_LU_STATE_NULL 0 /* null state */
158 #define SEF_LU_STATE_WORK_FREE 1 /* no work in progress */
159 #define SEF_LU_STATE_REQUEST_FREE 2 /* no request in progress */
160 #define SEF_LU_STATE_PROTOCOL_FREE 3 /* no protocol in progress */
161 #define SEF_LU_STATE_CUSTOM_BASE (SEF_LU_STATE_PROTOCOL_FREE+1)
162 #define SEF_LU_STATE_IS_STANDARD(s) ((s) > SEF_LU_STATE_NULL \
163 && (s) < SEF_LU_STATE_CUSTOM_BASE)
166 #define SEF_LU_DEBUG_DEFAULT 1
169 #define SEF_LU_DEBUG SEF_LU_DEBUG_DEFAULT
172 #define sef_lu_dprint sef_dprint
173 #define sef_lu_debug_begin sef_debug_begin
174 #define sef_lu_debug_end sef_debug_end
176 /*===========================================================================*
178 *===========================================================================*/
179 /* What to intercept. */
180 #define INTERCEPT_SEF_SIGNAL_REQUESTS 1
181 #define IS_SEF_SIGNAL_REQUEST(mp, status) \
182 (((mp)->m_type == SIGS_SIGNAL_RECEIVED && (mp)->m_source < INIT_PROC_NR) \
183 || (is_ipc_notify(status) && (mp)->m_source == SYSTEM))
185 /* Callback type definitions. */
186 typedef void(*sef_cb_signal_handler_t
)(int signo
);
187 typedef int(*sef_cb_signal_manager_t
)(endpoint_t target
, int signo
);
189 /* Callback registration helpers. */
190 _PROTOTYPE( void sef_setcb_signal_handler
, (sef_cb_signal_handler_t cb
));
191 _PROTOTYPE( void sef_setcb_signal_manager
, (sef_cb_signal_manager_t cb
));
193 /* Predefined callback implementations. */
194 _PROTOTYPE( void sef_cb_signal_handler_null
, (int signo
) );
195 _PROTOTYPE( int sef_cb_signal_manager_null
, (endpoint_t target
, int signo
) );
197 _PROTOTYPE( void sef_cb_signal_handler_term
, (int signo
) );
198 _PROTOTYPE( void sef_cb_signal_handler_posix_default
, (int signo
) );
200 /* Macros for predefined callback implementations. */
201 #define SEF_CB_SIGNAL_HANDLER_NULL sef_cb_signal_handler_null
202 #define SEF_CB_SIGNAL_MANAGER_NULL sef_cb_signal_manager_null
204 #define SEF_CB_SIGNAL_HANDLER_DEFAULT sef_cb_signal_handler_null
205 #define SEF_CB_SIGNAL_MANAGER_DEFAULT sef_cb_signal_manager_null
208 #define SEF_SIGNAL_DEBUG_DEFAULT 0
210 #ifndef SEF_SIGNAL_DEBUG
211 #define SEF_SIGNAL_DEBUG SEF_SIGNAL_DEBUG_DEFAULT
214 #define sef_signal_dprint sef_dprint
215 #define sef_signal_debug_begin sef_debug_begin
216 #define sef_signal_debug_end sef_debug_end