diff options
Diffstat (limited to 'src/stat')
-rw-r--r-- | src/stat/__xstat.c | 5 | ||||
-rw-r--r-- | src/stat/fchmodat.c | 15 | ||||
-rw-r--r-- | src/stat/fstat.c | 8 | ||||
-rw-r--r-- | src/stat/fstatat.c | 16 | ||||
-rw-r--r-- | src/stat/lstat.c | 4 | ||||
-rw-r--r-- | src/stat/stat.c | 4 | ||||
-rw-r--r-- | src/stat/statvfs.c | 5 |
7 files changed, 21 insertions, 36 deletions
diff --git a/src/stat/__xstat.c b/src/stat/__xstat.c index 630936a0..b4560df7 100644 --- a/src/stat/__xstat.c +++ b/src/stat/__xstat.c @@ -22,11 +22,6 @@ int __xstat(int ver, const char *path, struct stat *buf) return stat(path, buf); } -weak_alias(__fxstat, __fxstat64); -weak_alias(__fxstatat, __fxstatat64); -weak_alias(__lxstat, __lxstat64); -weak_alias(__xstat, __xstat64); - #endif int __xmknod(int ver, const char *path, mode_t mode, dev_t *dev) diff --git a/src/stat/fchmodat.c b/src/stat/fchmodat.c index 4ee00b0a..bc581050 100644 --- a/src/stat/fchmodat.c +++ b/src/stat/fchmodat.c @@ -2,7 +2,6 @@ #include <fcntl.h> #include <errno.h> #include "syscall.h" -#include "kstat.h" int fchmodat(int fd, const char *path, mode_t mode, int flag) { @@ -11,12 +10,12 @@ int fchmodat(int fd, const char *path, mode_t mode, int flag) if (flag != AT_SYMLINK_NOFOLLOW) return __syscall_ret(-EINVAL); - struct kstat st; + struct stat st; int ret, fd2; char proc[15+3*sizeof(int)]; - if ((ret = __syscall(SYS_fstatat, fd, path, &st, flag))) - return __syscall_ret(ret); + if (fstatat(fd, path, &st, flag)) + return -1; if (S_ISLNK(st.st_mode)) return __syscall_ret(-EOPNOTSUPP); @@ -27,12 +26,12 @@ int fchmodat(int fd, const char *path, mode_t mode, int flag) } __procfdname(proc, fd2); - ret = __syscall(SYS_fstatat, AT_FDCWD, proc, &st, 0); + ret = stat(proc, &st); if (!ret) { - if (S_ISLNK(st.st_mode)) ret = -EOPNOTSUPP; - else ret = __syscall(SYS_fchmodat, AT_FDCWD, proc, mode); + if (S_ISLNK(st.st_mode)) ret = __syscall_ret(-EOPNOTSUPP); + else ret = syscall(SYS_fchmodat, AT_FDCWD, proc, mode); } __syscall(SYS_close, fd2); - return __syscall_ret(ret); + return ret; } diff --git a/src/stat/fstat.c b/src/stat/fstat.c index 9bbb46de..fd28b8ac 100644 --- a/src/stat/fstat.c +++ b/src/stat/fstat.c @@ -4,12 +4,10 @@ #include <fcntl.h> #include "syscall.h" -int fstat(int fd, struct stat *st) +int __fstat(int fd, struct stat *st) { if (fd<0) return __syscall_ret(-EBADF); - return fstatat(fd, "", st, AT_EMPTY_PATH); + return __fstatat(fd, "", st, AT_EMPTY_PATH); } -#if !_REDIR_TIME64 -weak_alias(fstat, fstat64); -#endif +weak_alias(__fstat, fstat); diff --git a/src/stat/fstatat.c b/src/stat/fstatat.c index de165b5c..04506375 100644 --- a/src/stat/fstatat.c +++ b/src/stat/fstatat.c @@ -6,7 +6,6 @@ #include <stdint.h> #include <sys/sysmacros.h> #include "syscall.h" -#include "kstat.h" struct statx { uint32_t stx_mask; @@ -69,6 +68,10 @@ static int fstatat_statx(int fd, const char *restrict path, struct stat *restric return 0; } +#ifdef SYS_fstatat + +#include "kstat.h" + static int fstatat_kstat(int fd, const char *restrict path, struct stat *restrict st, int flag) { int ret; @@ -130,18 +133,21 @@ static int fstatat_kstat(int fd, const char *restrict path, struct stat *restric return 0; } +#endif -int fstatat(int fd, const char *restrict path, struct stat *restrict st, int flag) +int __fstatat(int fd, const char *restrict path, struct stat *restrict st, int flag) { int ret; +#ifdef SYS_fstatat if (sizeof((struct kstat){0}.st_atime_sec) < sizeof(time_t)) { ret = fstatat_statx(fd, path, st, flag); if (ret!=-ENOSYS) return __syscall_ret(ret); } ret = fstatat_kstat(fd, path, st, flag); +#else + ret = fstatat_statx(fd, path, st, flag); +#endif return __syscall_ret(ret); } -#if !_REDIR_TIME64 -weak_alias(fstatat, fstatat64); -#endif +weak_alias(__fstatat, fstatat); diff --git a/src/stat/lstat.c b/src/stat/lstat.c index 6fe004de..6822fcae 100644 --- a/src/stat/lstat.c +++ b/src/stat/lstat.c @@ -5,7 +5,3 @@ int lstat(const char *restrict path, struct stat *restrict buf) { return fstatat(AT_FDCWD, path, buf, AT_SYMLINK_NOFOLLOW); } - -#if !_REDIR_TIME64 -weak_alias(lstat, lstat64); -#endif diff --git a/src/stat/stat.c b/src/stat/stat.c index ea70efc4..23570e7a 100644 --- a/src/stat/stat.c +++ b/src/stat/stat.c @@ -5,7 +5,3 @@ int stat(const char *restrict path, struct stat *restrict buf) { return fstatat(AT_FDCWD, path, buf, 0); } - -#if !_REDIR_TIME64 -weak_alias(stat, stat64); -#endif diff --git a/src/stat/statvfs.c b/src/stat/statvfs.c index f65d1b54..bfbb5fee 100644 --- a/src/stat/statvfs.c +++ b/src/stat/statvfs.c @@ -56,8 +56,3 @@ int fstatvfs(int fd, struct statvfs *buf) fixup(buf, &kbuf); return 0; } - -weak_alias(statvfs, statvfs64); -weak_alias(statfs, statfs64); -weak_alias(fstatvfs, fstatvfs64); -weak_alias(fstatfs, fstatfs64); |