provide an internal namespace-safe __fstatat
authorRich Felker <dalias@aerifal.cx>
Thu, 28 Apr 2022 06:14:34 +0000 (02:14 -0400)
committerRich Felker <dalias@aerifal.cx>
Mon, 2 May 2022 03:25:21 +0000 (23:25 -0400)
this makes it so we can drop direct stat syscall use in interfaces
that can't use the POSIX namespace.

src/include/sys/stat.h [new file with mode: 0644]
src/stat/fstatat.c

diff --git a/src/include/sys/stat.h b/src/include/sys/stat.h
new file mode 100644 (file)
index 0000000..822888b
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef SYS_STAT_H
+#define SYS_STAT_H
+
+#include "../../../include/sys/stat.h"
+
+hidden int __fstatat(int, const char *restrict, struct stat *restrict, int);
+
+#endif
index de165b5..cf11a29 100644 (file)
@@ -131,7 +131,7 @@ static int fstatat_kstat(int fd, const char *restrict path, struct stat *restric
        return 0;
 }
 
-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;
        if (sizeof((struct kstat){0}.st_atime_sec) < sizeof(time_t)) {
@@ -142,6 +142,8 @@ int fstatat(int fd, const char *restrict path, struct stat *restrict st, int fla
        return __syscall_ret(ret);
 }
 
+weak_alias(__fstatat, fstatat);
+
 #if !_REDIR_TIME64
 weak_alias(fstatat, fstatat64);
 #endif