#include <sys/stat.h>
+#include <fcntl.h>
#include "syscall.h"
#include "libc.h"
-int stat(const char *path, struct stat *buf)
+int stat(const char *restrict path, struct stat *restrict buf)
{
- return syscall2(__NR_stat, (long)path, (long)buf);
+#ifdef SYS_stat
+ return syscall(SYS_stat, path, buf);
+#else
+ return syscall(SYS_fstatat, AT_FDCWD, path, buf, 0);
+#endif
}
LFS64(stat);