Home | History | Annotate | Download | only in minijail
      1 /* syscall_filter.h
      2  * Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
      3  * Use of this source code is governed by a BSD-style license that can be
      4  * found in the LICENSE file.
      5  *
      6  * Syscall filter functions.
      7  */
      8 
      9 #ifndef SYSCALL_FILTER_H
     10 #define SYSCALL_FILTER_H
     11 
     12 #include "bpf.h"
     13 
     14 #define NO_LOGGING  0
     15 #define USE_LOGGING 1
     16 
     17 struct filter_block {
     18 	struct sock_filter *instrs;
     19 	size_t len;
     20 
     21 	struct filter_block *next;
     22 	struct filter_block *last;
     23 	size_t total_len;
     24 };
     25 
     26 struct bpf_labels;
     27 
     28 struct filter_block *compile_section(int nr, const char *policy_line,
     29 		unsigned int label_id, struct bpf_labels *labels);
     30 int compile_filter(FILE *policy_file, struct sock_fprog *prog,
     31 		int log_failures);
     32 
     33 int flatten_block_list(struct filter_block *head, struct sock_filter *filter,
     34 		size_t index, size_t cap);
     35 void free_block_list(struct filter_block *head);
     36 
     37 #endif /* SYSCALL_FILTER_H */
     38