github.com/cilium/ebpf@v0.10.0/testdata/map_spin_lock.c (about)

     1  /* This file excercises bpf_spin_lock. */
     2  
     3  #include "common.h"
     4  
     5  struct bpf_spin_lock {
     6  	uint32_t val;
     7  };
     8  
     9  struct hash_elem {
    10  	int cnt;
    11  	struct bpf_spin_lock lock;
    12  };
    13  
    14  #if __clang_major__ >= 9
    15  struct {
    16  	__uint(type, BPF_MAP_TYPE_HASH);
    17  	__type(key, uint32_t);
    18  	__type(value, struct hash_elem);
    19  	__uint(max_entries, 2);
    20  } spin_lock_map __section(".maps");
    21  #else
    22  #error This file required clang >= 9
    23  #endif