#ifndef ERROR_H #define ERROR_H enum { LT_ERROR_FILTER_TYPE_NTH, LT_ERROR_FILTER_TYPE_SEQ, LT_ERROR_FILTER_TYPE_STACK, LT_ERROR_FILTER_TYPE_INTERACTIVE, }; struct lt_error_config_filter { int type; }; struct lt_error_sym { /* * It is 'symbol' for normal usage and 'index' for * file storage in names section (see struct * lt_error_config definition */ union { char *symbol; int index; } name; #define LT_MAXRET 20 long ret; long call_current; long call_configured; int handle_sigsegv; int keep; }; /* * stored in file like: * * struct lt_error_config * struct lt_error_config_sym array * names.. */ struct lt_error_config { unsigned long n; int type; int sym_cnt; int names_size; struct lt_error_sym sym[0]; }; struct lt_error_app_return_sym { char *name; #define LT_MAX_SYM_RETURNS 10 union { long val; long vals[LT_MAX_SYM_RETURNS]; }; int val_idx; int val_cnt; /* When the symbol return is changed, * set SIGSEGV handlers. */ int handle_sigsegv; /* Do not change the return value. */ int keep; struct lt_list_head list; }; struct lt_error_app_filter { int type; }; struct lt_error_app_return { char *name; struct lt_error_app_filter filter; struct lt_list_head head_sym; struct lt_list_head list_app; struct lt_list_head list_run; }; struct lt_error_start { long n; }; enum { LT_ERROR_RUN_TYPE_SEQ, LT_ERROR_RUN_TYPE_AUTO, LT_ERROR_RUN_TYPE_REPLAY, }; struct lt_error_app_run { char *name; char **args; int type; struct lt_error_start start; struct lt_list_head head_return; struct lt_list_head list_go; struct lt_list_head list_app; }; struct lt_error_app_go { char *name; struct lt_list_head head_run; struct lt_list_head list; }; struct lt_error_app { char *name; char *dir; int no_storage; char *prog; struct lt_list_head head_run; struct lt_list_head head_go; struct lt_list_head head_return; struct lt_list_head list; }; struct lt_config_app; struct lt_config_audit; #ifdef CONFIG_ARCH_HAVE_ERROR_SIM int lt_error_app(struct lt_config_app *cfg, struct lt_error_app *error_app); int lt_error_go(struct lt_config_app *cfg, struct lt_error_app_go **go, struct lt_error_app *error_app, char *name, struct lt_list_head *runs); int lt_error_run_return(struct lt_config_app *cfg, struct lt_error_app_run **run, struct lt_error_app *error_app, struct lt_list_head *ret); int lt_error_run_args(struct lt_config_app *cfg, struct lt_error_app_run **run, struct lt_list_head *args); int lt_error_run_type(struct lt_config_app *cfg, struct lt_error_app_run **run, int type); int lt_error_return_ass(struct lt_config_app *cfg, struct lt_error_app_return **ret, char *name, struct lt_list_head *list_vals, int handle_sigsegv, int keep); int lt_error_return_filter(struct lt_config_app *cfg, struct lt_error_app_return **ret, int type, void *data); int lt_error_app_init(struct lt_error_app *app); int lt_error_config_write(struct lt_config_app *cfg, int fd); int lt_error_config_read(struct lt_config_audit *cfg, int fd); #else static inline int lt_error_app(struct lt_config_app *cfg, struct lt_error_app *error_app) { return -1; } static int lt_error_go(struct lt_config_app *cfg, struct lt_error_app_go **go, struct lt_error_app *error_app, char *name, struct lt_list_head *runs) { return -1; } static inline int lt_error_run_return(struct lt_config_app *cfg, struct lt_error_app_run **run, struct lt_error_app *error_app, struct lt_list_head *ret) { return -1; } static inline int lt_error_run_args(struct lt_config_app *cfg, struct lt_error_app_run **run, struct lt_list_head *args) { return -1; } static inline int lt_error_run_type(struct lt_config_app *cfg, struct lt_error_app_run **run, int type); { return -1; } static inline int lt_error_app_init(struct lt_error_app *app) { return -1; } static inline int lt_error_return_ass(struct lt_config_app *cfg, struct lt_error_app_return **ret, char *name, struct lt_list_head *list_vals, int handle_sigsegv, int keep) { return -1; } static inline int lt_error_return_filter(struct lt_config_app *cfg, struct lt_error_app_return **ret, int type, void *data) { return -1; } static inline int lt_error_config_write(struct lt_config_app *cfg, int fd) { return 0; } #endif #endif /* ERROR_H */