tools/testing/selftests/bpf/progs/test_wakeup_source.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/test_wakeup_source.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/test_wakeup_source.c- Extension
.c- Size
- 2427 bytes
- Lines
- 93
- 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
vmlinux.hbpf/bpf_helpers.hbpf/bpf_core_read.hbpf_experimental.hbpf_misc.hwakeup_source.h
Detected Declarations
struct bpf_ws_lockfunction __retvalfunction bpf_for
Annotated Snippet
if (active) {
s64 curr_time = bpf_ktime_get_ns();
s64 prevent_time = ws->start_prevent_time;
if (curr_time > last_time)
active_time = curr_time - last_time;
total_time += active_time;
if (active_time > max_time)
max_time = active_time;
if (autosleep_enable && curr_time > prevent_time)
prevent_sleep_time += curr_time - prevent_time;
}
e->active_count = ws->active_count;
e->active_time_ns = active_time;
e->event_count = ws->event_count;
e->expire_count = ws->expire_count;
e->last_time_ns = last_time;
e->max_time_ns = max_time;
e->prevent_sleep_time_ns = prevent_sleep_time;
e->total_time_ns = total_time;
e->wakeup_count = ws->wakeup_count;
if (bpf_probe_read_kernel_str(
e->name, WAKEUP_NAME_LEN, ws->name) < 0)
e->name[0] = '\0';
bpf_ringbuf_submit(e, 0);
}
bpf_wakeup_sources_read_unlock(lock);
return 0;
}
char _license[] SEC("license") = "GPL";
Annotation
- Immediate include surface: `vmlinux.h`, `bpf/bpf_helpers.h`, `bpf/bpf_core_read.h`, `bpf_experimental.h`, `bpf_misc.h`, `wakeup_source.h`.
- Detected declarations: `struct bpf_ws_lock`, `function __retval`, `function bpf_for`.
- 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.