1 #ifndef RESTART_H 2 #define RESTART_H 3 4 #define RESTART_TAG_MAXLEN 255 5 6 // Track the pointer size for restart fiddling. 7 #if SIZEOF_VOID_P == 8 8 typedef uint64_t mc_ptr_t; 9 #else 10 typedef uint32_t mc_ptr_t; 11 #endif 12 13 enum restart_get_kv_ret { 14 RESTART_OK=0, RESTART_NOTAG, RESTART_BADLINE, RESTART_DONE 15 }; 16 17 typedef int (*restart_check_cb)(const char *tag, void *ctx, void *data); 18 typedef int (*restart_save_cb)(const char *tag, void *ctx, void *data); 19 void restart_register(const char *tag, restart_check_cb ccb, restart_save_cb scb, void *data); 20 21 void restart_set_kv(void *ctx, const char *key, const char *fmt, ...); 22 enum restart_get_kv_ret restart_get_kv(void *ctx, char **key, char **val); 23 24 bool restart_mmap_open(const size_t limit, const char *file, void **mem_base); 25 void restart_mmap_close(void); 26 unsigned int restart_fixup(void *old_base); 27 28 #endif 29