Skip to content

Helper function bpf_sk_cgroup_id

v5.8

Definition

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

Return the cgroup v2 id of the socket sk.

sk must be a non-NULL pointer to a socket, e.g. one returned from bpf_sk_lookup_xxx(), bpf_sk_fullsock(), etc. The format of returned id is same as in bpf_skb_cgroup_id().

This helper is available only if the kernel was compiled with the CONFIG_SOCK_CGROUP_DATA configuration option.

Returns

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

static __u64 (* const bpf_sk_cgroup_id)(void *sk) = (void *) 128;

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