[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231118024858.1567039-3-yangjihong1@huawei.com>
Date: Sat, 18 Nov 2023 02:48:57 +0000
From: Yang Jihong <yangjihong1@...wei.com>
To: <peterz@...radead.org>, <mingo@...hat.com>, <acme@...nel.org>,
<mark.rutland@....com>, <alexander.shishkin@...ux.intel.com>,
<jolsa@...nel.org>, <namhyung@...nel.org>, <irogers@...gle.com>,
<adrian.hunter@...el.com>, <avagin@...gle.com>,
<daniel.diaz@...aro.org>, <linux-perf-users@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
CC: <yangjihong1@...wei.com>
Subject: [PATCH 2/3] 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: d0c502e46e97 ("perf lock contention: Prepare to handle cgroups")
Signed-off-by: Yang Jihong <yangjihong1@...wei.com>
---
tools/perf/util/bpf_lock_contention.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/bpf_lock_contention.c b/tools/perf/util/bpf_lock_contention.c
index e105245eb905..f1716c089c99 100644
--- a/tools/perf/util/bpf_lock_contention.c
+++ b/tools/perf/util/bpf_lock_contention.c
@@ -12,6 +12,7 @@
#include <linux/zalloc.h>
#include <linux/string.h>
#include <bpf/bpf.h>
+#include <inttypes.h>
#include "bpf_skel/lock_contention.skel.h"
#include "bpf_skel/lock_data.h"
@@ -250,7 +251,7 @@ static const char *lock_contention_get_name(struct lock_contention *con,
if (cgrp)
return cgrp->name;
- snprintf(name_buf, sizeof(name_buf), "cgroup:%lu", cgrp_id);
+ snprintf(name_buf, sizeof(name_buf), "cgroup:%" PRIu64 "", cgrp_id);
return name_buf;
}
--
2.34.1
Powered by blists - more mailing lists