Josef Bacik | 965de87 | 2017-12-11 11:36:49 -0500 | [diff] [blame] | 1 | #define _GNU_SOURCE |
| 2 | |
| 3 | #include <stdio.h> |
| 4 | #include <linux/bpf.h> |
| 5 | #include <unistd.h> |
Jakub Kicinski | 2bf3e2e | 2018-05-14 22:35:02 -0700 | [diff] [blame] | 6 | #include <bpf/bpf.h> |
Josef Bacik | 965de87 | 2017-12-11 11:36:49 -0500 | [diff] [blame] | 7 | #include "bpf_load.h" |
| 8 | |
| 9 | int main(int argc, char **argv) |
| 10 | { |
| 11 | FILE *f; |
| 12 | char filename[256]; |
| 13 | char command[256]; |
| 14 | int ret; |
| 15 | |
| 16 | snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]); |
| 17 | |
| 18 | if (load_bpf_file(filename)) { |
| 19 | printf("%s", bpf_log_buf); |
| 20 | return 1; |
| 21 | } |
| 22 | |
| 23 | snprintf(command, 256, "mount %s tmpmnt/", argv[1]); |
| 24 | f = popen(command, "r"); |
| 25 | ret = pclose(f); |
| 26 | |
| 27 | return ret ? 0 : 1; |
| 28 | } |