Skip to content

Commit e6c3711

Browse files
committed
perf daemon: Fix the build on more 32-bit architectures
JIRA: https://issues.redhat.com/browse/RHEL-29795 upstream ======== commit e162cb2 Author: Arnaldo Carvalho de Melo <acme@kernel.org> Date: Mon Aug 19 21:43:01 2024 -0300 description =========== FYI: I'm carrying this on perf-tools-next. The previous attempt fixed the build on debian:experimental-x-mipsel, but when building on a larger set of containers I noticed it broke the build on some other 32-bit architectures such as: 42 7.87 ubuntu:18.04-x-arm : FAIL gcc version 7.5.0 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) builtin-daemon.c: In function 'cmd_session_list': builtin-daemon.c:692:16: error: format '%llu' expects argument of type 'long long unsigned int', but argument 4 has type 'long int' [-Werror=format=] fprintf(out, "%c%" PRIu64, ^~~~~ builtin-daemon.c:694:13: csv_sep, (curr - daemon->start) / 60); ~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from builtin-daemon.c:3:0: /usr/arm-linux-gnueabihf/include/inttypes.h:105:34: note: format string is defined here # define PRIu64 __PRI64_PREFIX "u" So lets cast that time_t (32-bit/64-bit) to uint64_t to make sure it builds everywhere. Fixes: 4bbe600 ("perf daemon: Fix the build on 32-bit architectures") Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Link: https://lore.kernel.org/r/ZsPmldtJ0D9Cua9_@x1 Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Michael Petlan <mpetlan@redhat.com>
1 parent 3ccfe0b commit e6c3711

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools/perf/builtin-daemon.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out)
691691

692692
fprintf(out, "%c%" PRIu64,
693693
/* session up time */
694-
csv_sep, (curr - daemon->start) / 60);
694+
csv_sep, (uint64_t)((curr - daemon->start) / 60));
695695

696696
fprintf(out, "\n");
697697
} else {
@@ -702,7 +702,7 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out)
702702
fprintf(out, " lock: %s/lock\n",
703703
daemon->base);
704704
fprintf(out, " up: %" PRIu64 " minutes\n",
705-
(curr - daemon->start) / 60);
705+
(uint64_t)((curr - daemon->start) / 60));
706706
}
707707
}
708708

@@ -730,7 +730,7 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out)
730730

731731
fprintf(out, "%c%" PRIu64,
732732
/* session up time */
733-
csv_sep, (curr - session->start) / 60);
733+
csv_sep, (uint64_t)((curr - session->start) / 60));
734734

735735
fprintf(out, "\n");
736736
} else {
@@ -747,7 +747,7 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out)
747747
fprintf(out, " ack: %s/%s\n",
748748
session->base, SESSION_ACK);
749749
fprintf(out, " up: %" PRIu64 " minutes\n",
750-
(curr - session->start) / 60);
750+
(uint64_t)((curr - session->start) / 60));
751751
}
752752
}
753753

0 commit comments

Comments
 (0)