1 // SPDX-License-Identifier: GPL-2.0 2 #include <linux/bpf.h> 3 #include <bpf/bpf_helpers.h> 4 5 struct __bpf_stdout__ { 6 __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); 7 __type(key, int); 8 __type(value, __u32); 9 __uint(max_entries, __NR_CPUS__); 10 } __bpf_stdout__ SEC(".maps"); 11 12 #define puts(from) \ 13 ({ const int __len = sizeof(from); \ 14 char __from[sizeof(from)] = from; \ 15 bpf_perf_event_output(args, &__bpf_stdout__, BPF_F_CURRENT_CPU, \ 16 &__from, __len & (sizeof(from) - 1)); }) 17 18 struct syscall_enter_args; 19 20 SEC("raw_syscalls:sys_enter") sys_enter(struct syscall_enter_args * args)21int sys_enter(struct syscall_enter_args *args) 22 { 23 puts("Hello, world\n"); 24 return 0; 25 } 26 27 char _license[] SEC("license") = "GPL"; 28