summaryrefslogtreecommitdiffstats
path: root/src/error.h
blob: 042d594987461fd75ee2595873977cd0090994f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#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_def_filter {
	int type;
};

struct lt_error_def_sym {
#define LT_MAXNAME 20
	char symbol[LT_MAXNAME];
	long ret;
	struct lt_error_def_filter filter;
};

struct lt_error_def {
#define LT_ERROR_MAXSYM 50
	struct lt_error_def_sym sym[LT_ERROR_MAXSYM];

	/* call number */
	unsigned long n;
};

struct lt_error_audit_filter {
	int type;
	union {
		int **nth;
	};
};

struct lt_error_sym {
	char *name;
	unsigned long ret;
	unsigned long call;
	struct lt_error_audit_filter filter;

	struct lt_list_head list;
};

struct lt_error_app_return_sym {
	char *name;
	long val;

	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_app_run {
	char *name;
	char **args;

	struct lt_list_head head_return;
	struct lt_list_head list_go;
	struct lt_list_head list_app;
};

struct lt_error_app_go {
	int n;
	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;

#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, int n,
		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_return_ass(struct lt_config_app *cfg,
			struct lt_error_app_return **ret,
			char *name, unsigned long val);
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);
#else
static inline int lt_error_app(struct lt_config_app *cfg,
		 struct lt_error_app *error_app)
{
	return -1;
}

static inline int lt_error_go(struct lt_config_app *cfg,
		struct lt_error_app_go **go,
		struct lt_error_app *error_app,
		char *name, int n,
		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_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, unsigned long val)
{
	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;
}

#endif

#endif /* ERROR_H */