Skip to content

Commit 4bbe600

Browse files
acmelnamhyung
authored andcommitted
perf daemon: Fix the build on 32-bit architectures
Noticed with: 1 6.22 debian:experimental-x-mipsel : FAIL gcc version 13.2.0 (Debian 13.2.0-25) builtin-daemon.c: In function 'cmd_session_list': builtin-daemon.c:691:35: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'time_t' {aka 'long long int'} [-Werror=format=] Use inttypes.h's PRIu64 to deal with that. Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Link: https://lore.kernel.org/r/ZplvH21aQ8pzmza_@x1 Signed-off-by: Namhyung Kim <[email protected]>
1 parent d5b8548 commit 4bbe600

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tools/perf/builtin-daemon.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#include <internal/lib.h>
3+
#include <inttypes.h>
34
#include <subcmd/parse-options.h>
45
#include <api/fd/array.h>
56
#include <api/fs/fs.h>
@@ -688,7 +689,7 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out)
688689
/* lock */
689690
csv_sep, daemon->base, "lock");
690691

691-
fprintf(out, "%c%lu",
692+
fprintf(out, "%c%" PRIu64,
692693
/* session up time */
693694
csv_sep, (curr - daemon->start) / 60);
694695

@@ -700,7 +701,7 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out)
700701
daemon->base, SESSION_OUTPUT);
701702
fprintf(out, " lock: %s/lock\n",
702703
daemon->base);
703-
fprintf(out, " up: %lu minutes\n",
704+
fprintf(out, " up: %" PRIu64 " minutes\n",
704705
(curr - daemon->start) / 60);
705706
}
706707
}
@@ -727,7 +728,7 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out)
727728
/* session ack */
728729
csv_sep, session->base, SESSION_ACK);
729730

730-
fprintf(out, "%c%lu",
731+
fprintf(out, "%c%" PRIu64,
731732
/* session up time */
732733
csv_sep, (curr - session->start) / 60);
733734

@@ -745,7 +746,7 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out)
745746
session->base, SESSION_CONTROL);
746747
fprintf(out, " ack: %s/%s\n",
747748
session->base, SESSION_ACK);
748-
fprintf(out, " up: %lu minutes\n",
749+
fprintf(out, " up: %" PRIu64 " minutes\n",
749750
(curr - session->start) / 60);
750751
}
751752
}

0 commit comments

Comments
 (0)