Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 
0003 #include <bpf.h>
0004 
0005 struct bpf_map SEC("maps") __bpf_stdout__ = {
0006        .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
0007        .key_size = sizeof(int),
0008        .value_size = sizeof(u32),
0009        .max_entries = __NR_CPUS__,
0010 };
0011 
0012 #define puts(from) \
0013     ({ const int __len = sizeof(from); \
0014        char __from[__len] = from; \
0015        perf_event_output(args, &__bpf_stdout__, BPF_F_CURRENT_CPU, \
0016               &__from, __len & (sizeof(from) - 1)); })