tools/testing/selftests/bpf/progs/cgrp_ls_sleepable.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/cgrp_ls_sleepable.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/cgrp_ls_sleepable.c- Extension
.c- Size
- 3183 bytes
- Lines
- 144
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
vmlinux.hbpf/bpf_helpers.hbpf/bpf_tracing.hbpf_misc.herr.h
Detected Declarations
function cgroup_iterfunction __no_rcu_lockfunction cgrp1_no_rcu_lockfunction no_rcu_lockfunction yes_rcu_lockfunction BPF_PROG
Annotated Snippet
if (!cgrp) {
bpf_rcu_read_unlock();
return 0;
}
ptr = bpf_cgrp_storage_get(&map_a, cgrp, 0, BPF_LOCAL_STORAGE_GET_F_CREATE);
if (ptr)
cgroup_id = cgrp->kn->id;
bpf_cgroup_release(cgrp);
bpf_rcu_read_unlock();
return 0;
}
bpf_rcu_read_lock();
cgrp = task->cgroups->dfl_cgrp;
/* cgrp is trusted under RCU CS */
ptr = bpf_cgrp_storage_get(&map_a, cgrp, 0, BPF_LOCAL_STORAGE_GET_F_CREATE);
if (ptr)
cgroup_id = cgrp->kn->id;
bpf_rcu_read_unlock();
return 0;
}
SEC("fexit/bpf_local_storage_update")
int BPF_PROG(fexit_update, void *owner, struct bpf_local_storage_map *smap,
void *value, u64 map_flags, bool swap_uptrs,
struct bpf_local_storage_data *ret)
{
struct task_struct *task = bpf_get_current_task_btf();
if (task->pid != target_pid)
return 0;
if (IS_ERR_VALUE(ret))
update_err = PTR_ERR(ret);
return 0;
}
Annotation
- Immediate include surface: `vmlinux.h`, `bpf/bpf_helpers.h`, `bpf/bpf_tracing.h`, `bpf_misc.h`, `err.h`.
- Detected declarations: `function cgroup_iter`, `function __no_rcu_lock`, `function cgrp1_no_rcu_lock`, `function no_rcu_lock`, `function yes_rcu_lock`, `function BPF_PROG`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.