tools/testing/selftests/bpf/prog_tests/fentry_fexit.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/prog_tests/fentry_fexit.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/prog_tests/fentry_fexit.c- Extension
.c- Size
- 1651 bytes
- Lines
- 57
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
test_progs.hfentry_test.lskel.hfexit_test.lskel.h
Detected Declarations
function test_fentry_fexit
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2019 Facebook */
#include <test_progs.h>
#include "fentry_test.lskel.h"
#include "fexit_test.lskel.h"
void test_fentry_fexit(void)
{
struct fentry_test_lskel *fentry_skel = NULL;
struct fexit_test_lskel *fexit_skel = NULL;
__u64 *fentry_res, *fexit_res;
int err, prog_fd, i;
LIBBPF_OPTS(bpf_test_run_opts, topts);
fentry_skel = fentry_test_lskel__open();
if (!ASSERT_OK_PTR(fentry_skel, "fentry_skel_load"))
goto close_prog;
fentry_skel->keyring_id = KEY_SPEC_SESSION_KEYRING;
err = fentry_test_lskel__load(fentry_skel);
if (!ASSERT_OK(err, "fentry_skel_load"))
goto close_prog;
fexit_skel = fexit_test_lskel__open();
if (!ASSERT_OK_PTR(fexit_skel, "fexit_skel_load"))
goto close_prog;
fexit_skel->keyring_id = KEY_SPEC_SESSION_KEYRING;
err = fexit_test_lskel__load(fexit_skel);
if (!ASSERT_OK(err, "fexit_skel_load"))
goto close_prog;
err = fentry_test_lskel__attach(fentry_skel);
if (!ASSERT_OK(err, "fentry_attach"))
goto close_prog;
err = fexit_test_lskel__attach(fexit_skel);
if (!ASSERT_OK(err, "fexit_attach"))
goto close_prog;
prog_fd = fexit_skel->progs.test1.prog_fd;
err = bpf_prog_test_run_opts(prog_fd, &topts);
ASSERT_OK(err, "ipv6 test_run");
ASSERT_OK(topts.retval, "ipv6 test retval");
fentry_res = (__u64 *)fentry_skel->bss;
fexit_res = (__u64 *)fexit_skel->bss;
printf("%lld\n", fentry_skel->bss->test1_result);
for (i = 0; i < 8; i++) {
ASSERT_EQ(fentry_res[i], 1, "fentry result");
ASSERT_EQ(fexit_res[i], 1, "fexit result");
}
close_prog:
fentry_test_lskel__destroy(fentry_skel);
fexit_test_lskel__destroy(fexit_skel);
}
Annotation
- Immediate include surface: `test_progs.h`, `fentry_test.lskel.h`, `fexit_test.lskel.h`.
- Detected declarations: `function test_fentry_fexit`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.