File: variables.c

package info (click to toggle)
golang-github-cilium-ebpf 0.17.3%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 4,684 kB
  • sloc: ansic: 1,259; makefile: 127; python: 113; awk: 29; sh: 24
file content (33 lines) | stat: -rw-r--r-- 568 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//go:build ignore

#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>

// Remove when toolchain Docker image ships with 5.13+ headers.
#define __hidden __attribute__((visibility("hidden")))

// variables_const {
volatile const __u32 const_u32;

SEC("socket") int const_example() {
	return const_u32;
}
// }

// variables_global {
volatile __u16 global_u16;

SEC("socket") int global_example() {
	global_u16++;
	return global_u16;
}
// }

// variables_hidden {
__hidden __u64 hidden_var;

SEC("socket") int hidden_example() {
	hidden_var++;
	return hidden_var;
}
// }