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.
Showing the changes to include/uapi (1 of 2 files). Show all
Unified · Split
| @@ -18,16 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | #define _LINUX_TASKSTATS_H |
| 19 | 19 | |
| 20 | 20 | #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> | |
| 31 | 22 | |
| 32 | 23 | /* Format for per-task data returned to userland when |
| 33 | 24 | * - a task exits |
| @@ -242,14 +233,14 @@ struct taskstats { · 208 unmodified lines | ||
| 242 | 233 | __u64 irq_delay_min; |
| 243 | 234 | |
| 244 | 235 | /*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; | |
| 253 | 244 | }; |
| 254 | 245 | |
| 255 | 246 | |