Helper function bpf_current_task_under_cgroup
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:
BPF_PROG_TYPE_CGROUP_DEVICEv6.16BPF_PROG_TYPE_CGROUP_SKBv6.16BPF_PROG_TYPE_CGROUP_SOCKv6.16BPF_PROG_TYPE_CGROUP_SOCKOPTv6.16BPF_PROG_TYPE_CGROUP_SOCK_ADDRv6.16BPF_PROG_TYPE_CGROUP_SYSCTLv6.16BPF_PROG_TYPE_FLOW_DISSECTORv6.16BPF_PROG_TYPE_KPROBEBPF_PROG_TYPE_LSMBPF_PROG_TYPE_LWT_INv6.16BPF_PROG_TYPE_LWT_OUTv6.16BPF_PROG_TYPE_LWT_SEG6LOCALv6.16BPF_PROG_TYPE_LWT_XMITv6.16BPF_PROG_TYPE_NETFILTERv6.16BPF_PROG_TYPE_PERF_EVENTBPF_PROG_TYPE_RAW_TRACEPOINTBPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLEBPF_PROG_TYPE_SCHED_ACTv6.16BPF_PROG_TYPE_SCHED_CLSv6.16BPF_PROG_TYPE_SK_LOOKUPv6.16BPF_PROG_TYPE_SK_MSGv6.16BPF_PROG_TYPE_SK_REUSEPORTv6.16BPF_PROG_TYPE_SK_SKBv6.16BPF_PROG_TYPE_SOCKET_FILTERv6.16BPF_PROG_TYPE_SOCK_OPSv6.16BPF_PROG_TYPE_STRUCT_OPSv6.16BPF_PROG_TYPE_SYSCALLBPF_PROG_TYPE_TRACEPOINTBPF_PROG_TYPE_TRACINGBPF_PROG_TYPE_XDPv6.16
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome