mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 22:35:24 +00:00
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.
This commit is contained in:
parent
6a12dce207
commit
bf2bd8e722
@ -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)
|
||||
{
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user