BpfRingbuf: support 32 bit userspace

Both consumer and producer position are wrapped in an std::atomic and
extended to uint64_t to enforce atomic access.

See resulting assembly instructions for aosp_cf_x86_phone-userdebug:

frameworks/libs/net/common/native/bpf_headers/include/bpf/BpfRingbuf.h:212
  2d:   8b 41 18                mov    0x18(%ecx),%eax
external/libcxx/include/atomic:926 (discriminator 4)
  30:   f3 0f 7e 00             movq   (%eax),%xmm0

This will not work on a 32 bit kernel (so we might want to explicitly
check for that in the test).

Test: atest BpfRingbufTest
Change-Id: I7fec435cbe49d392363d05f7e702d82ecacb9e91
2 files changed
tree: b7da8675ace7fb2ce82787e09617c1da21c759fc
  1. staticlibs/