Skip to content

Helper function bpf_get_current_ancestor_cgroup_id

v5.7

Definition

Copyright (c) 2015 The Libbpf Authors. All rights reserved.

Return id of cgroup v2 that is ancestor of the cgroup associated with the current task at the ancestor_level. The root cgroup is at ancestor_level zero and each step down the hierarchy increments the level. If ancestor_level == level of cgroup associated with the current task, then return value will be the same as that of bpf_get_current_cgroup_id().

The helper is useful to implement policies based on cgroups that are upper in hierarchy than immediate cgroup associated with the current task.

The format of returned id and helper limitations are same as in bpf_get_current_cgroup_id().

Returns

The id is returned or 0 in case the id could not be retrieved.

static __u64 (* const bpf_get_current_ancestor_cgroup_id)(int ancestor_level) = (void *) 123;

Usage

Docs could be improved

This part of the docs is incomplete, contributions are very welcome

Program types

This helper call can be used in the following program types:

Example

Docs could be improved

This part of the docs is incomplete, contributions are very welcome