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