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

     1  // /* This file excercises freplace. */
     2  
     3  #include "common.h"
     4  
     5  char __license[] __section("license") = "MIT";
     6  
     7  struct bpf_args {
     8  	uint64_t args[0];
     9  };
    10  
    11  __attribute__((noinline)) int subprog() {
    12  	volatile int ret = 0;
    13  	return ret;
    14  }
    15  
    16  __section("raw_tracepoint/sched_process_exec") int sched_process_exec(struct bpf_args *ctx) {
    17  	return subprog();
    18  }
    19  
    20  __section("freplace/subprog") int replacement() {
    21  	return 0;
    22  }