summaryrefslogtreecommitdiff
path: root/lib/libc/sys/stat.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/sys/stat.c')
-rw-r--r--lib/libc/sys/stat.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/libc/sys/stat.c b/lib/libc/sys/stat.c
index 6b58daa9e515..a7ed7baf5c2f 100644
--- a/lib/libc/sys/stat.c
+++ b/lib/libc/sys/stat.c
@@ -1,4 +1,5 @@
/*-
+ * Copyright (c) 2017 M. Warner Losh <imp@FreeBSD.org>
* Copyright (c) 2012 Gleb Kurtsou <gleb@FreeBSD.org>
* All rights reserved.
*
@@ -29,15 +30,22 @@ __FBSDID("$FreeBSD$");
#include "namespace.h"
#include <sys/param.h>
-#include <sys/fcntl.h>
#include <sys/syscall.h>
-#include <sys/stat.h>
+#include "compat-ino64.h"
#include <unistd.h>
+
#include "libc_private.h"
int
stat(const char *path, struct stat *sb)
{
+ struct freebsd11_stat stat11;
+ int rv;
- return (__sys_fstatat(AT_FDCWD, path, sb, 0));
+ if (__getosreldate() >= INO64_FIRST)
+ return (__sys_fstatat(AT_FDCWD, path, sb, 0));
+ rv = syscall(SYS_freebsd11_stat, path, &stat11);
+ if (rv == 0)
+ __stat11_to_stat(&stat11, sb);
+ return (rv);
}