In this post i will give an introduction into the minix 3 OS System Event Framework (SEF), and its usage and the benefits behind it. If you are not familiar with the minix 3 OS you may need to have a look at this post.
Agenda
Live update
Signal (Not included in the minix wiki, i got it from the code)
Triggered to intercept process signals (e.g., SIGTERM). The API and the predefined callback implementations are declared in <minix/sef.h> and defined in lib/libsys/sef_signal.c.
Callbacks (This section is totally extracted (by me) from the component code)
Initialization callbacks
void sef_setcb_init_fresh(sef_cb_init_t cb)
Set the start up init callback, if cb is null then the default init callback is assumed.
void sef_setcb_init_lu(sef_cb_init_t cb)
Set the live update init callback, if cb is null then the default live update init callback is assumed.
void sef_setcb_init_restart(sef_cb_init_t cb)
Set the restart init callback, if cb is null then the default restart init callback is assumed.
sef_setcb_init_response(sef_cb_init_response_t cb)
Set the init response callback for example (notify the Reincarnation Server that we completed init)
Ping callbacks
void sef_setcb_ping_reply(sef_cb_ping_reply_t cb)
Set the ping reply callback, two default implementations introduced either do nothing (sef_cb_ping_reply_null), or ack (sef_cb_ping_reply_pong).
Live update callbacks
void sef_setcb_lu_prepare(sef_cb_lu_prepare_t cb)
Set the live update prepare callback, if cb is null default callback is assumed.
void sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_t cb)
Set the live update is valid state callback, when a live update encountered the RS must assure that the driver/server is in a valid state for live update.
void sef_setcb_lu_state_changed(sef_cb_lu_state_changed_t cb)
Set the live update changed state callback.
void sef_setcb_lu_state_dump(sef_cb_lu_state_dump_t cb)
Set the live update state dump callback -> I think its for debugging information or something like that.
void sef_setcb_lu_state_save(sef_cb_lu_state_save_t cb)
Set the live update stat save callback.
void sef_setcb_lu_response(sef_cb_lu_response_t cb)
Set the live update response callback, for example telling the RS that we are up and running.
Signal callbacks
void sef_setcb_signal_handler(sef_cb_signal_handler_t cb)
Set the signal handler callback. Default implementation is either to ignore all signals, or handling the term signal (Terminate in this case), Also it provide a case to handle posix signals.
void sef_setcb_signal_manager(sef_cb_signal_manager_t cb)
Still can't know its purpose till now.
References
Feed backs are more than welcomed.
Agenda
- Introduction
- Event types
- Call-backs
- References
SEF is a component of the system library that deals with system events in a centralized and convenient way. In MINIX 3 every driver and system server has to deal with the System Event Framework (SEF) which handles live up-dates and failure recovery.
Every system service (server or device driver) must call sef_startup() at startup time to handle initialization and sef_receive()
when receiving a message. The developer can register callbacks to
provide handlers for each particular type of event. When no callback is
registered for one particular event, the default behavior is assumed. The developer can also reuse some predefined callback implementations provided by SEF for each particular event type.
Event types
Initialization
Triggered by initialization messages sent by the Reincarnation Server when a service is started. The API and the predefined callback implementations are declared in <minix/sef.h> and defined in lib/syslib/sef_init.c.
Ping
Triggered by keep-a-live messages sent by the Reincarnation Server periodically to check the status of a system service. The API and the predefined callback implementations are declared in <minix/sef.h> and defined in lib/libsys/sef_ping.c.
Triggered by keep-a-live messages sent by the Reincarnation Server periodically to check the status of a system service. The API and the predefined callback implementations are declared in <minix/sef.h> and defined in lib/libsys/sef_ping.c.
Live update
Triggered by live update messages sent by the Reincarnation Server
when an update is available for a particular system service. The API
and the predefined callback implementations are declared in <minix/sef.h> and defined in lib/libsys/sef_liveupdate.c.
Signal (Not included in the minix wiki, i got it from the code)
Triggered to intercept process signals (e.g., SIGTERM). The API and the predefined callback implementations are declared in <minix/sef.h> and defined in lib/libsys/sef_signal.c.
Callbacks (This section is totally extracted (by me) from the component code)
void sef_setcb_init_fresh(sef_cb_init_t cb)
Set the start up init callback, if cb is null then the default init callback is assumed.
void sef_setcb_init_lu(sef_cb_init_t cb)
Set the live update init callback, if cb is null then the default live update init callback is assumed.
void sef_setcb_init_restart(sef_cb_init_t cb)
Set the restart init callback, if cb is null then the default restart init callback is assumed.
sef_setcb_init_response(sef_cb_init_response_t cb)
Set the init response callback for example (notify the Reincarnation Server that we completed init)
Ping callbacks
void sef_setcb_ping_reply(sef_cb_ping_reply_t cb)
Set the ping reply callback, two default implementations introduced either do nothing (sef_cb_ping_reply_null), or ack (sef_cb_ping_reply_pong).
Live update callbacks
void sef_setcb_lu_prepare(sef_cb_lu_prepare_t cb)
Set the live update prepare callback, if cb is null default callback is assumed.
void sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_t cb)
Set the live update is valid state callback, when a live update encountered the RS must assure that the driver/server is in a valid state for live update.
void sef_setcb_lu_state_changed(sef_cb_lu_state_changed_t cb)
Set the live update changed state callback.
void sef_setcb_lu_state_dump(sef_cb_lu_state_dump_t cb)
Set the live update state dump callback -> I think its for debugging information or something like that.
void sef_setcb_lu_state_save(sef_cb_lu_state_save_t cb)
Set the live update stat save callback.
void sef_setcb_lu_response(sef_cb_lu_response_t cb)
Set the live update response callback, for example telling the RS that we are up and running.
Signal callbacks
void sef_setcb_signal_handler(sef_cb_signal_handler_t cb)
Set the signal handler callback. Default implementation is either to ignore all signals, or handling the term signal (Terminate in this case), Also it provide a case to handle posix signals.
void sef_setcb_signal_manager(sef_cb_signal_manager_t cb)
Still can't know its purpose till now.
References
Feed backs are more than welcomed.