tracex7_user.c 484 B

12345678910111213141516171819202122232425262728
  1. #define _GNU_SOURCE
  2. #include <stdio.h>
  3. #include <linux/bpf.h>
  4. #include <unistd.h>
  5. #include <bpf/bpf.h>
  6. #include "bpf_load.h"
  7. int main(int argc, char **argv)
  8. {
  9. FILE *f;
  10. char filename[256];
  11. char command[256];
  12. int ret;
  13. snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]);
  14. if (load_bpf_file(filename)) {
  15. printf("%s", bpf_log_buf);
  16. return 1;
  17. }
  18. snprintf(command, 256, "mount %s tmpmnt/", argv[1]);
  19. f = popen(command, "r");
  20. ret = pclose(f);
  21. return ret ? 0 : 1;
  22. }