int sef_cb_init_reset(int type, sef_init_info_t *info);
int sef_cb_init_crash(int type, sef_init_info_t *info);
int sef_cb_init_timeout(int type, sef_init_info_t *info);
+int sef_cb_init_restart_generic(int type, sef_init_info_t *info);
int sef_cb_init_identity_state_transfer(int type, sef_init_info_t *info);
int sef_cb_init_lu_identity_as_restart(int type, sef_init_info_t *info);
int sef_cb_init_lu_generic(int type, sef_init_info_t *info);
#define SEF_CB_INIT_LU_NULL sef_cb_init_null
#define SEF_CB_INIT_RESTART_NULL sef_cb_init_null
#define SEF_CB_INIT_RESPONSE_NULL sef_cb_init_response_null
-#define SEF_CB_INIT_RESTART_STATEFUL sef_cb_init_identity_state_transfer
+#define SEF_CB_INIT_RESTART_STATEFUL sef_cb_init_restart_generic
#define SEF_CB_INIT_FRESH_DEFAULT sef_cb_init_null
#define SEF_CB_INIT_LU_DEFAULT sef_cb_init_lu_generic
int sef_llvm_ltckpt_enabled(void);
int sef_llvm_get_ltckpt_offset(void);
+int sef_llvm_ltckpt_restart(int type, sef_init_info_t *info);
#if !defined(USE_LIVEUPDATE)
#undef INTERCEPT_SEF_LU_REQUESTS
return EBADCALL;
}
+/*===========================================================================*
+ * sef_cb_init_restart_generic *
+ *===========================================================================*/
+int sef_cb_init_restart_generic(int type, sef_init_info_t *info)
+{
+ /* Always resort to simple identity transfer for self updates. */
+ if (type == SEF_INIT_LU && (info->flags & SEF_LU_SELF))
+ return sef_cb_init_identity_state_transfer(type, info);
+
+ /* Can only handle restart otherwise. */
+ if(type != SEF_INIT_RESTART) {
+ printf("sef_cb_init_restart_generic: init failed\n");
+ return ENOSYS;
+ }
+
+ /* Perform instrumentation-supported checkpoint-restart. */
+ return sef_llvm_ltckpt_restart(type, info);
+}
+
/*===========================================================================*
* sef_cb_init_identity_state_transfer *
*===========================================================================*/
*===========================================================================*/
int sef_llvm_ltckpt_enabled()
{
- extern int __attribute__((weak)) ltckpt_get_offset();
- if (!ltckpt_get_offset)
+ extern int __attribute__((weak)) ltckpt_mechanism_enabled(void);
+ if (!sef_llvm_get_ltckpt_offset() || !ltckpt_mechanism_enabled())
return 0;
return 1;
}
return ltckpt_get_offset();
}
+/*===========================================================================*
+ * sef_llvm_ltckpt_restart *
+ *===========================================================================*/
+int sef_llvm_ltckpt_restart(int type, sef_init_info_t *info)
+{
+ extern int __attribute__((weak)) ltckpt_restart(void *);
+
+ if(!sef_llvm_ltckpt_enabled())
+ return sef_cb_init_identity_state_transfer(type, info);
+
+ assert(ltckpt_restart);
+ return ltckpt_restart(info);
+}
+