uclibc-ng: bump version from 1.0.6 to 1.0.8
[openwrt/openwrt.git] / toolchain / uClibc / patches-0.9.33.2 / 616-mips_fix_stat_time.patch
1 --- a/libc/sysdeps/linux/common/xstatconv.c
2 +++ b/libc/sysdeps/linux/common/xstatconv.c
3 @@ -39,9 +39,12 @@ void __xstat_conv(struct kernel_stat *kb
4 buf->st_size = kbuf->st_size;
5 buf->st_blksize = kbuf->st_blksize;
6 buf->st_blocks = kbuf->st_blocks;
7 - buf->st_atim = kbuf->st_atim;
8 - buf->st_mtim = kbuf->st_mtim;
9 - buf->st_ctim = kbuf->st_ctim;
10 + buf->st_atim.tv_sec = kbuf->st_atim.tv_sec;
11 + buf->st_atim.tv_nsec = kbuf->st_atim.tv_nsec;
12 + buf->st_mtim.tv_sec = kbuf->st_mtim.tv_sec;
13 + buf->st_mtim.tv_nsec = kbuf->st_mtim.tv_nsec;
14 + buf->st_ctim.tv_sec = kbuf->st_ctim.tv_sec;
15 + buf->st_ctim.tv_nsec = kbuf->st_ctim.tv_nsec;
16 }
17
18 void __xstat32_conv(struct kernel_stat64 *kbuf, struct stat *buf)
19 @@ -58,9 +61,12 @@ void __xstat32_conv(struct kernel_stat64
20 buf->st_size = kbuf->st_size;
21 buf->st_blksize = kbuf->st_blksize;
22 buf->st_blocks = kbuf->st_blocks;
23 - buf->st_atim = kbuf->st_atim;
24 - buf->st_mtim = kbuf->st_mtim;
25 - buf->st_ctim = kbuf->st_ctim;
26 + buf->st_atim.tv_sec = kbuf->st_atim.tv_sec;
27 + buf->st_atim.tv_nsec = kbuf->st_atim.tv_nsec;
28 + buf->st_mtim.tv_sec = kbuf->st_mtim.tv_sec;
29 + buf->st_mtim.tv_nsec = kbuf->st_mtim.tv_nsec;
30 + buf->st_ctim.tv_sec = kbuf->st_ctim.tv_sec;
31 + buf->st_ctim.tv_nsec = kbuf->st_ctim.tv_nsec;
32 }
33
34 #ifdef __UCLIBC_HAS_LFS__
35 @@ -82,9 +88,12 @@ void __xstat64_conv(struct kernel_stat64
36 buf->st_size = kbuf->st_size;
37 buf->st_blksize = kbuf->st_blksize;
38 buf->st_blocks = kbuf->st_blocks;
39 - buf->st_atim = kbuf->st_atim;
40 - buf->st_mtim = kbuf->st_mtim;
41 - buf->st_ctim = kbuf->st_ctim;
42 + buf->st_atim.tv_sec = kbuf->st_atim.tv_sec;
43 + buf->st_atim.tv_nsec = kbuf->st_atim.tv_nsec;
44 + buf->st_mtim.tv_sec = kbuf->st_mtim.tv_sec;
45 + buf->st_mtim.tv_nsec = kbuf->st_mtim.tv_nsec;
46 + buf->st_ctim.tv_sec = kbuf->st_ctim.tv_sec;
47 + buf->st_ctim.tv_nsec = kbuf->st_ctim.tv_nsec;
48 }
49
50 #endif /* __UCLIBC_HAS_LFS__ */
51 --- a/libc/sysdeps/linux/mips/bits/kernel_stat.h
52 +++ b/libc/sysdeps/linux/mips/bits/kernel_stat.h
53 @@ -8,6 +8,18 @@
54 #include <sgidefs.h>
55
56 #if _MIPS_SIM == _MIPS_SIM_ABI64
57 +typedef struct {
58 + unsigned int tv_sec;
59 + unsigned int tv_nsec;
60 +} __ktimespec_t;
61 +#else
62 +typedef struct {
63 + time_t tv_sec;
64 + unsigned long tv_nsec;
65 +} __ktimespec_t;
66 +#endif
67 +
68 +#if _MIPS_SIM == _MIPS_SIM_ABI64
69 /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
70 struct kernel_stat {
71 __kernel_dev_t st_dev;
72 @@ -20,9 +32,9 @@ struct kernel_stat {
73 __kernel_dev_t st_rdev;
74 unsigned int st_pad2[3];
75 __kernel_off_t st_size;
76 - struct timespec st_atim;
77 - struct timespec st_mtim;
78 - struct timespec st_ctim;
79 + __ktimespec_t st_atim;
80 + __ktimespec_t st_mtim;
81 + __ktimespec_t st_ctim;
82 unsigned int st_blksize;
83 unsigned int reserved3;
84 unsigned long st_blocks;
85 @@ -41,9 +53,9 @@ struct kernel_stat {
86 unsigned int st_rdev;
87 unsigned int st_pad2[3];
88 unsigned long long st_size;
89 - struct timespec st_atim;
90 - struct timespec st_mtim;
91 - struct timespec st_ctim;
92 + __ktimespec_t st_atim;
93 + __ktimespec_t st_mtim;
94 + __ktimespec_t st_ctim;
95 unsigned int st_blksize;
96 unsigned int reserved3;
97 unsigned long long st_blocks;
98 @@ -62,9 +74,9 @@ struct kernel_stat {
99 long st_pad2[2];
100 __kernel_off_t st_size;
101 long st_pad3;
102 - struct timespec st_atim;
103 - struct timespec st_mtim;
104 - struct timespec st_ctim;
105 + __ktimespec_t st_atim;
106 + __ktimespec_t st_mtim;
107 + __ktimespec_t st_ctim;
108 long st_blksize;
109 long st_blocks;
110 long st_pad4[14];
111 @@ -81,9 +93,9 @@ struct kernel_stat64 {
112 unsigned long st_rdev;
113 unsigned long st_pad1[3]; /* Reserved for st_rdev expansion */
114 long long st_size;
115 - struct timespec st_atim;
116 - struct timespec st_mtim;
117 - struct timespec st_ctim;
118 + __ktimespec_t st_atim;
119 + __ktimespec_t st_mtim;
120 + __ktimespec_t st_ctim;
121 unsigned long st_blksize;
122 unsigned long st_pad2;
123 long long st_blocks;