History

delayacct: fix uapi timespec64 definition

The custom definition of 'struct timespec64' is incompatible with both the kernel's internal definition and the glibc type, at least on big-endian targets that have the tv_nsec field in a different place, and the definition clashes with any userspace that also defines a timespec64 structure. Running the header check with -Wpadding enabled produces this output that warns about the incorrect padding: usr/include/linux/taskstats.h:25:1: error: padding struct size to alignment boundary with 4 bytes [-Werror=padded] Remove the hack and instead use the regular __kernel_timespec type that is meant to be used in uapi definitions.

Arnd Bergmann committed 9 months ago

Commit 90079791 parent 2e171ab2 files · +13 −20Browse files

Showing the changes to include/uapi (1 of 2 files). Show all

Unified · Split

include/uapi/linux/taskstats.h+9−18
@@ -18,16 +18,7 @@ · 17 unmodified lines
1818 #define _LINUX_TASKSTATS_H
1919
2020 #include <linux/types.h>
21−#ifdef __KERNEL__
22−#include <linux/time64.h>
23−#else
24−#ifndef _LINUX_TIME64_H
25−struct timespec64 {
26− __s64 tv_sec; /* seconds */
27− long tv_nsec; /* nanoseconds */
28−};
29−#endif
30−#endif
21+#include <linux/time_types.h>
3122
3223 /* Format for per-task data returned to userland when
3324 * - a task exits
@@ -242,14 +233,14 @@ struct taskstats { · 208 unmodified lines
242233 __u64 irq_delay_min;
243234
244235 /*v17: delay max timestamp record*/
245− struct timespec64 cpu_delay_max_ts;
246− struct timespec64 blkio_delay_max_ts;
247− struct timespec64 swapin_delay_max_ts;
248− struct timespec64 freepages_delay_max_ts;
249− struct timespec64 thrashing_delay_max_ts;
250− struct timespec64 compact_delay_max_ts;
251− struct timespec64 wpcopy_delay_max_ts;
252− struct timespec64 irq_delay_max_ts;
236+ struct __kernel_timespec cpu_delay_max_ts;
237+ struct __kernel_timespec blkio_delay_max_ts;
238+ struct __kernel_timespec swapin_delay_max_ts;
239+ struct __kernel_timespec freepages_delay_max_ts;
240+ struct __kernel_timespec thrashing_delay_max_ts;
241+ struct __kernel_timespec compact_delay_max_ts;
242+ struct __kernel_timespec wpcopy_delay_max_ts;
243+ struct __kernel_timespec irq_delay_max_ts;
253244 };
254245
255246