@@ -24,6 +24,7 @@
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/types.h>
+#include <inttypes.h>
#include <time.h>
#include <unistd.h>
@@ -49,9 +50,6 @@
#define DEBUG_HEXDUMP 0
#define MAX_SOCKS 8
-typedef __u64 u64;
-typedef __u32 u32;
-
static unsigned long prev_time;
enum benchmark_type {
@@ -243,7 +241,7 @@ static void hex_dump(void *pkt, size_t length, u64 addr)
if (!DEBUG_HEXDUMP)
return;
- sprintf(buf, "addr=%llu", addr);
+ sprintf(buf, "addr=%" PRIu64, addr);
printf("length = %zu\n", length);
printf("%s | ", buf);
while (length-- > 0) {
Remove duplicate typedef, and use PRIu64 to be both 32 and 64 bit aware. Fix the following error: samples/bpf/xdpsock_user.c:52:15: error: conflicting types for ‘u64’ 52 | typedef __u64 u64; | ^~~ In file included from ./tools/include/linux/compiler.h:87, from ./tools/include/asm/barrier.h:2, from samples/bpf/xdpsock_user.c:4: ./tools/include/linux/types.h:30:18: note: previous declaration of ‘u64’ was here 30 | typedef uint64_t u64; | ^~~ make[2]: *** [scripts/Makefile.host:109: samples/bpf/xdpsock_user.o] Error 1 make[1]: *** [Makefile:1763: samples/bpf/] Error 2 Signed-off-by: Matteo Croce <mcroce@redhat.com> --- samples/bpf/xdpsock_user.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)