tools/testing/selftests/bpf/prog_tests/core_retro.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/prog_tests/core_retro.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/prog_tests/core_retro.c- Extension
.c- Size
- 913 bytes
- Lines
- 39
- 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.htest_core_retro.skel.h
Detected Declarations
function test_core_retro
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2020 Facebook
#define _GNU_SOURCE
#include <test_progs.h>
#include "test_core_retro.skel.h"
void test_core_retro(void)
{
int err, zero = 0, res, my_pid = getpid();
struct test_core_retro *skel;
/* load program */
skel = test_core_retro__open_and_load();
if (!ASSERT_OK_PTR(skel, "skel_load"))
goto out_close;
err = bpf_map__update_elem(skel->maps.exp_tgid_map, &zero, sizeof(zero),
&my_pid, sizeof(my_pid), 0);
if (!ASSERT_OK(err, "map_update"))
goto out_close;
/* attach probe */
err = test_core_retro__attach(skel);
if (!ASSERT_OK(err, "attach_kprobe"))
goto out_close;
/* trigger */
usleep(1);
err = bpf_map__lookup_elem(skel->maps.results, &zero, sizeof(zero), &res, sizeof(res), 0);
if (!ASSERT_OK(err, "map_lookup"))
goto out_close;
ASSERT_EQ(res, my_pid, "pid_check");
out_close:
test_core_retro__destroy(skel);
}
Annotation
- Immediate include surface: `test_progs.h`, `test_core_retro.skel.h`.
- Detected declarations: `function test_core_retro`.
- 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.