github.com/cilium/ebpf@v0.15.1-0.20240517100537-8079b37aa138/docs/examples/docs.c (about)

     1  //go:build ignore
     2  
     3  // DocMyMapProgram {
     4  #include <linux/bpf.h>
     5  #include <bpf/bpf_helpers.h>
     6  
     7  // Declare a hash map called 'my_map' with a u32 key and a u64 value.
     8  // The __uint, __type and SEC macros are from libbpf's bpf_helpers.h.
     9  struct {
    10  	__uint(type, BPF_MAP_TYPE_HASH);
    11  	__type(key, __u32);
    12  	__type(value, __u64);
    13  	__uint(max_entries, 1);
    14  } my_map SEC(".maps");
    15  
    16  // Declare a dummy socket program called 'my_prog'.
    17  SEC("socket") int my_prog() {
    18  	return 0;
    19  }
    20  // }