libbpf ringbuffer callback prototype

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I noticed that the data pointer in the libbpf ringbuffer callback has type void *, without const:

typedef int (*ring_buffer_sample_fn)(void *ctx, void *data, size_t size);

However, if you actually try to write to this data, you'll get a SIGSEGV.

It seems to me the prototype should ideally be const void * so the compiler can throw -Wdiscarded-qualifiers if someone tries to assign it to a non-const type. I'm not sure there's anything to be done about it, as changing it now would break the API. However, I wanted to mention it just in case anyone has thoughts about this.

Thanks,

Martin





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux