tools/testing/selftests/bpf/prog_tests/get_func_args_test.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/prog_tests/get_func_args_test.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/prog_tests/get_func_args_test.c- Extension
.c- Size
- 2223 bytes
- Lines
- 72
- 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.hget_func_args_test.skel.hget_func_args_fsession_test.skel.h
Detected Declarations
function test_get_func_args_testfunction test_get_func_args_fsession_test
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include "get_func_args_test.skel.h"
#include "get_func_args_fsession_test.skel.h"
void test_get_func_args_test(void)
{
struct get_func_args_test *skel = NULL;
int err, prog_fd;
LIBBPF_OPTS(bpf_test_run_opts, topts);
skel = get_func_args_test__open_and_load();
if (!ASSERT_OK_PTR(skel, "get_func_args_test__open_and_load"))
return;
err = get_func_args_test__attach(skel);
if (!ASSERT_OK(err, "get_func_args_test__attach"))
goto cleanup;
/* This runs bpf_fentry_test* functions and triggers
* fentry/fexit programs.
*/
prog_fd = bpf_program__fd(skel->progs.test1);
err = bpf_prog_test_run_opts(prog_fd, &topts);
ASSERT_OK(err, "test_run");
ASSERT_EQ(topts.retval, 0, "test_run");
/* This runs bpf_modify_return_test function and triggers
* fmod_ret_test and fexit_test programs.
*/
prog_fd = bpf_program__fd(skel->progs.fmod_ret_test);
err = bpf_prog_test_run_opts(prog_fd, &topts);
ASSERT_OK(err, "test_run");
ASSERT_EQ(topts.retval >> 16, 1, "test_run");
ASSERT_EQ(topts.retval & 0xffff, 1234 + 29, "test_run");
ASSERT_OK(trigger_module_test_read(1), "trigger_read");
ASSERT_EQ(skel->bss->test1_result, 1, "test1_result");
ASSERT_EQ(skel->bss->test2_result, 1, "test2_result");
ASSERT_EQ(skel->bss->test3_result, 1, "test3_result");
ASSERT_EQ(skel->bss->test4_result, 1, "test4_result");
ASSERT_EQ(skel->bss->test5_result, 1, "test5_result");
ASSERT_EQ(skel->bss->test6_result, 1, "test6_result");
cleanup:
get_func_args_test__destroy(skel);
}
void test_get_func_args_fsession_test(void)
{
struct get_func_args_fsession_test *skel = NULL;
int err;
LIBBPF_OPTS(bpf_test_run_opts, topts);
skel = get_func_args_fsession_test__open_and_load();
if (!ASSERT_OK_PTR(skel, "get_func_args_fsession_test__open_and_load"))
return;
err = get_func_args_fsession_test__attach(skel);
if (!ASSERT_OK(err, "get_func_args_fsession_test__attach"))
goto cleanup;
err = bpf_prog_test_run_opts(bpf_program__fd(skel->progs.test1), &topts);
ASSERT_OK(err, "test_run");
ASSERT_EQ(topts.retval, 0, "test_run");
ASSERT_EQ(skel->bss->test1_result, 1, "test1_result");
cleanup:
get_func_args_fsession_test__destroy(skel);
}
Annotation
- Immediate include surface: `test_progs.h`, `get_func_args_test.skel.h`, `get_func_args_fsession_test.skel.h`.
- Detected declarations: `function test_get_func_args_test`, `function test_get_func_args_fsession_test`.
- 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.