Skip to content

Commit e1d380e

Browse files
Leo Yanacmel
authored andcommitted
perf tools: Change fields type in perf_record_time_conv
C standard claims "An object declared as type _Bool is large enough to store the values 0 and 1", bool type size can be 1 byte or larger than 1 byte. Thus it's uncertian for bool type size with different compilers. This patch changes the bool type in structure perf_record_time_conv to __u8 type, and pads extra bytes for 8-byte alignment; this can give reliable structure size. Fixes: d110162 ("perf tsc: Support cap_user_time_short for event TIME_CONV") Suggested-by: Adrian Hunter <[email protected]> Signed-off-by: Leo Yan <[email protected]> Acked-by: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Gustavo A. R. Silva <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steve MacLean <[email protected]> Cc: Yonatan Goldschmidt <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 56d32d4 commit e1d380e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/lib/perf/include/perf/event.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,9 @@ struct perf_record_time_conv {
346346
__u64 time_zero;
347347
__u64 time_cycles;
348348
__u64 time_mask;
349-
bool cap_user_time_zero;
350-
bool cap_user_time_short;
349+
__u8 cap_user_time_zero;
350+
__u8 cap_user_time_short;
351+
__u8 reserved[6]; /* For alignment */
351352
};
352353

353354
struct perf_record_header_feature {

0 commit comments

Comments
 (0)