Skip to content

Helper function bpf_sysctl_get_name

v5.2

Definition

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

Get name of sysctl in /proc/sys/ and copy it into provided by program buffer buf of size buf_len.

The buffer is always NUL terminated, unless it's zero-sized.

If flags is zero, full name (e.g. "net/ipv4/tcp_mem") is copied. Use BPF_F_SYSCTL_BASE_NAME flag to copy base name only (e.g. "tcp_mem").

Returns

Number of character copied (not including the trailing NUL).

-E2BIG if the buffer wasn't big enough (buf will contain truncated name in this case).

static long (* const bpf_sysctl_get_name)(struct bpf_sysctl *ctx, char *buf, unsigned long buf_len, __u64 flags) = (void *) 101;

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