Skip to content
Advertisement

Trying to create map with char array field invalid field error

I like to know how to create ebpf map with char array value

I tried like this

JavaScript

and this is full code for the ebpf program

JavaScript

and this is my user function I assigned to perf_buffer_opts

JavaScript

and this is the full code. so can anyone please tell what I am doing wrong why is saying invalid argument

JavaScript

full userspace code

JavaScript

Advertisement

Answer

The key and value should be __u32:

JavaScript

And you can then push your events to that map as usual:

JavaScript

The bpf_perf_event_output helper takes the size of events as argument, so it doesn’t need to be a static parameter in the map.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement