authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-12-15 22:15:31-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-12-16 03:01:13-07:00
logbf2bd8e7220b9468c17a8d1415948e1f93a4b8f4
treef32fdffabd5a5d6c569951afdf3b83c93e531da9
parent6a12dce207114842e2e49a3aeb18af01ab207f0b

glibc: patches to make fstatat.c and fstatat64.c compile

instead of importing every header file under the sun, I copied a couple inline functions into these files to make them work.

2 files changed, 32 insertions(+), 2 deletions(-)

lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat.c+19
......@@ -19,10 +19,29 @@
1919#include <sys/stat.h>
2020#include <kernel_stat.h>
2121#include <sysdep.h>
22#include <string.h>
2223
2324#if !XSTAT_IS_XSTAT64
2425# include <kstat_cp.h>
2526
27static inline bool
28in_time_t_range (__time64_t t)
29{
30 time_t s = t;
31 return s == t;
32}
33
34static inline struct timespec
35valid_timespec64_to_timespec (const struct __timespec64 ts64)
36{
37 struct timespec ts;
38
39 ts.tv_sec = (time_t) ts64.tv_sec;
40 ts.tv_nsec = ts64.tv_nsec;
41
42 return ts;
43}
44
2645int
2746__fstatat (int fd, const char *file, struct stat *buf, int flag)
2847{
lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat64.c+13-2
......@@ -53,8 +53,8 @@ fstatat64_time64_statx (int fd, const char *file, struct __stat64_t64 *buf,
5353 return r;
5454
5555 *buf = (struct __stat64_t64) {
56 .st_dev = __gnu_dev_makedev (tmp.stx_dev_major, tmp.stx_dev_minor),
57 .st_rdev = __gnu_dev_makedev (tmp.stx_rdev_major, tmp.stx_rdev_minor),
56 .st_dev = gnu_dev_makedev (tmp.stx_dev_major, tmp.stx_dev_minor),
57 .st_rdev = gnu_dev_makedev (tmp.stx_rdev_major, tmp.stx_rdev_minor),
5858 .st_ino = tmp.stx_ino,
5959 .st_mode = tmp.stx_mode,
6060 .st_nlink = tmp.stx_nlink,
......@@ -74,6 +74,17 @@ fstatat64_time64_statx (int fd, const char *file, struct __stat64_t64 *buf,
7474 return r;
7575}
7676
77static inline struct __timespec64
78valid_timespec_to_timespec64 (const struct timespec ts)
79{
80 struct __timespec64 ts64;
81
82 ts64.tv_sec = ts.tv_sec;
83 ts64.tv_nsec = ts.tv_nsec;
84
85 return ts64;
86}
87
7788static inline int
7889fstatat64_time64_stat (int fd, const char *file, struct __stat64_t64 *buf,
7990 int flag)