Debian Codegraph @

src/bpf/sysctl-write-event.h

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2
3 #pragma once
4
5 #ifdef __bpf__
6 #include "vmlinux.h"
7 #else
8 #include <stdint.h>
9 #include <sys/types.h>
10 #endif
11
12 #ifndef TASK_COMM_LEN
13 #define TASK_COMM_LEN 16
14 #endif
15
16 /* It would be nice to size these members to bigger values, but the stack
17 * in BPF programs is limited to 512 bytes, and allocating bigger structures
18 * leads to this compile time error:
19 * error: Looks like the BPF stack limit is exceeded.
20 * Please move large on stack variables into BPF per-cpu array map.
21 * For non-kernel uses, the stack can be increased using -mllvm -bpf-stack-size. */
22 struct sysctl_write_event {
23 /* Used to track changes in the struct layout */
24 int version;
25
26 /* Error code returned to userspace to handle eventual failures. */
27 int errorcode;
28
29 /* The PID of the process which is writing the sysctl. */
30 pid_t pid;
31
32 /* The cgroup id of the process. */
33 uint64_t cgroup_id;
34
35 /* The name of the binary. */
36 char comm[TASK_COMM_LEN];
37
38 /* The path of the sysctl, relative to /proc/sys/.
39 * The longest path observed is 64 bytes:
40 * net/ipv4/conf/123456789012345/igmpv3_unsolicited_report_interval
41 * so set it to 100 gives us lot of headroom */
42 char path[100];
43
44 /* The value of the sysctl just before the write.
45 * The longest value observed is net.core.netdev_rss_key which
46 * contains 155 bytes, so set it to 160 to have some headroom
47 * even in this corner case. */
48 char current[160];
49
50 /* The new value being written into the sysctl.
51 * same sizing as 'current' */
52 char newvalue[160];
53 };