]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/bpf-program.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
6 #include <sys/syscall.h>
11 typedef struct BPFProgram BPFProgram
;
19 size_t n_instructions
;
21 struct bpf_insn
*instructions
;
25 uint32_t attached_flags
;
28 int bpf_program_new(uint32_t prog_type
, BPFProgram
**ret
);
29 BPFProgram
*bpf_program_unref(BPFProgram
*p
);
30 BPFProgram
*bpf_program_ref(BPFProgram
*p
);
32 int bpf_program_add_instructions(BPFProgram
*p
, const struct bpf_insn
*insn
, size_t count
);
33 int bpf_program_load_kernel(BPFProgram
*p
, char *log_buf
, size_t log_size
);
35 int bpf_program_cgroup_attach(BPFProgram
*p
, int type
, const char *path
, uint32_t flags
);
36 int bpf_program_cgroup_detach(BPFProgram
*p
);
38 int bpf_map_new(enum bpf_map_type type
, size_t key_size
, size_t value_size
, size_t max_entries
, uint32_t flags
);
39 int bpf_map_update_element(int fd
, const void *key
, void *value
);
40 int bpf_map_lookup_element(int fd
, const void *key
, void *value
);
42 DEFINE_TRIVIAL_CLEANUP_FUNC(BPFProgram
*, bpf_program_unref
);