Skip to content

Helper function bpf_current_task_under_cgroup

v4.9

Definition

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

Check whether the probe is being run is the context of a given subset of the cgroup2 hierarchy. The cgroup2 to test is held by map of type BPF_MAP_TYPE_CGROUP_ARRAY, at index.

Returns

The return value depends on the result of the test, and can be:

  • 1, if current task belongs to the cgroup2.
  • 0, if current task does not belong to the cgroup2.
  • A negative error code, if an error occurred.

static long (* const bpf_current_task_under_cgroup)(void *map, __u32 index) = (void *) 37;

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