~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/bpf/prog_tests/fentry_fexit.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /* Copyright (c) 2019 Facebook */
  3 #include <test_progs.h>
  4 #include "fentry_test.lskel.h"
  5 #include "fexit_test.lskel.h"
  6 
  7 void test_fentry_fexit(void)
  8 {
  9         struct fentry_test_lskel *fentry_skel = NULL;
 10         struct fexit_test_lskel *fexit_skel = NULL;
 11         __u64 *fentry_res, *fexit_res;
 12         int err, prog_fd, i;
 13         LIBBPF_OPTS(bpf_test_run_opts, topts);
 14 
 15         fentry_skel = fentry_test_lskel__open_and_load();
 16         if (!ASSERT_OK_PTR(fentry_skel, "fentry_skel_load"))
 17                 goto close_prog;
 18         fexit_skel = fexit_test_lskel__open_and_load();
 19         if (!ASSERT_OK_PTR(fexit_skel, "fexit_skel_load"))
 20                 goto close_prog;
 21 
 22         err = fentry_test_lskel__attach(fentry_skel);
 23         if (!ASSERT_OK(err, "fentry_attach"))
 24                 goto close_prog;
 25         err = fexit_test_lskel__attach(fexit_skel);
 26         if (!ASSERT_OK(err, "fexit_attach"))
 27                 goto close_prog;
 28 
 29         prog_fd = fexit_skel->progs.test1.prog_fd;
 30         err = bpf_prog_test_run_opts(prog_fd, &topts);
 31         ASSERT_OK(err, "ipv6 test_run");
 32         ASSERT_OK(topts.retval, "ipv6 test retval");
 33 
 34         fentry_res = (__u64 *)fentry_skel->bss;
 35         fexit_res = (__u64 *)fexit_skel->bss;
 36         printf("%lld\n", fentry_skel->bss->test1_result);
 37         for (i = 0; i < 8; i++) {
 38                 ASSERT_EQ(fentry_res[i], 1, "fentry result");
 39                 ASSERT_EQ(fexit_res[i], 1, "fexit result");
 40         }
 41 
 42 close_prog:
 43         fentry_test_lskel__destroy(fentry_skel);
 44         fexit_test_lskel__destroy(fexit_skel);
 45 }
 46 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php