zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit bf2bd8e7220b9468c17a8d1415948e1f93a4b8f4 (tree)
parent 6a12dce207114842e2e49a3aeb18af01ab207f0b
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Wed, 15 Dec 2021 22:15:31 -0700

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.

Diffstat:
Mlib/libc/glibc/sysdeps/unix/sysv/linux/fstatat.c | 19+++++++++++++++++++
Mlib/libc/glibc/sysdeps/unix/sysv/linux/fstatat64.c | 15+++++++++++++--
2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat.c b/lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat.c @@ -19,10 +19,29 @@ #include <sys/stat.h> #include <kernel_stat.h> #include <sysdep.h> +#include <string.h> #if !XSTAT_IS_XSTAT64 # include <kstat_cp.h> +static inline bool +in_time_t_range (__time64_t t) +{ + time_t s = t; + return s == t; +} + +static inline struct timespec +valid_timespec64_to_timespec (const struct __timespec64 ts64) +{ + struct timespec ts; + + ts.tv_sec = (time_t) ts64.tv_sec; + ts.tv_nsec = ts64.tv_nsec; + + return ts; +} + int __fstatat (int fd, const char *file, struct stat *buf, int flag) { diff --git a/lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat64.c b/lib/libc/glibc/sysdeps/unix/sysv/linux/fstatat64.c @@ -53,8 +53,8 @@ fstatat64_time64_statx (int fd, const char *file, struct __stat64_t64 *buf, return r; *buf = (struct __stat64_t64) { - .st_dev = __gnu_dev_makedev (tmp.stx_dev_major, tmp.stx_dev_minor), - .st_rdev = __gnu_dev_makedev (tmp.stx_rdev_major, tmp.stx_rdev_minor), + .st_dev = gnu_dev_makedev (tmp.stx_dev_major, tmp.stx_dev_minor), + .st_rdev = gnu_dev_makedev (tmp.stx_rdev_major, tmp.stx_rdev_minor), .st_ino = tmp.stx_ino, .st_mode = tmp.stx_mode, .st_nlink = tmp.stx_nlink, @@ -74,6 +74,17 @@ fstatat64_time64_statx (int fd, const char *file, struct __stat64_t64 *buf, return r; } +static inline struct __timespec64 +valid_timespec_to_timespec64 (const struct timespec ts) +{ + struct __timespec64 ts64; + + ts64.tv_sec = ts.tv_sec; + ts64.tv_nsec = ts.tv_nsec; + + return ts64; +} + static inline int fstatat64_time64_stat (int fd, const char *file, struct __stat64_t64 *buf, int flag)