Improve compiler logging
This change adds line numbers to the logs emitted when compiling syscall
filter policy files.
Bug: None
Test: See filenames+line numbers in syslog
Change-Id: Id6fb7d097f60e317269b5abd03b5a6929db6cd40
diff --git a/syscall_filter.h b/syscall_filter.h
index d15e8a9..737ef49 100644
--- a/syscall_filter.h
+++ b/syscall_filter.h
@@ -24,17 +24,24 @@
size_t total_len;
};
+struct parser_state {
+ const char *filename;
+ size_t line_number;
+};
+
struct bpf_labels;
-struct filter_block *compile_policy_line(int nr, const char *policy_line,
+struct filter_block *compile_policy_line(struct parser_state *state, int nr,
+ const char *policy_line,
unsigned int label_id,
struct bpf_labels *labels,
int do_ret_trap);
-int compile_file(FILE *policy_file, struct filter_block *head,
- struct filter_block **arg_blocks, struct bpf_labels *labels,
- int use_ret_trap, int allow_logging,
+int compile_file(const char *filename, FILE *policy_file,
+ struct filter_block *head, struct filter_block **arg_blocks,
+ struct bpf_labels *labels, int use_ret_trap, int allow_logging,
unsigned int include_level);
-int compile_filter(FILE *policy_file, struct sock_fprog *prog, int do_ret_trap,
+int compile_filter(const char *filename, FILE *policy_file,
+ struct sock_fprog *prog, int do_ret_trap,
int add_logging_syscalls);
struct filter_block *new_filter_block(void);