Skip to content

Commit 29b8e94

Browse files
Yang Jihongnamhyung
authored andcommitted
perf lock contention: Fix a build error on 32-bit
Fix a build error on 32-bit system: util/bpf_lock_contention.c: In function 'lock_contention_get_name': util/bpf_lock_contention.c:253:50: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'u64 {aka long long unsigned int}' [-Werror=format=] snprintf(name_buf, sizeof(name_buf), "cgroup:%lu", cgrp_id); ~~^ %llu cc1: all warnings being treated as errors Fixes: d0c502e ("perf lock contention: Prepare to handle cgroups") Signed-off-by: Yang Jihong <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent a6dda77 commit 29b8e94

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/perf/util/bpf_lock_contention.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/zalloc.h>
1313
#include <linux/string.h>
1414
#include <bpf/bpf.h>
15+
#include <inttypes.h>
1516

1617
#include "bpf_skel/lock_contention.skel.h"
1718
#include "bpf_skel/lock_data.h"
@@ -250,7 +251,7 @@ static const char *lock_contention_get_name(struct lock_contention *con,
250251
if (cgrp)
251252
return cgrp->name;
252253

253-
snprintf(name_buf, sizeof(name_buf), "cgroup:%lu", cgrp_id);
254+
snprintf(name_buf, sizeof(name_buf), "cgroup:%" PRIu64 "", cgrp_id);
254255
return name_buf;
255256
}
256257

0 commit comments

Comments
 (0)