changeset 17736:08bbb5882450

8165643: SecureDirectoryStream doesn't work on linux non-x86 Reviewed-by: alanb
author martin
date Wed, 07 Sep 2016 14:44:59 -0700
parents caf0b176cf70
children 5cfe381e52f2
files src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c test/java/nio/file/DirectoryStream/SecureDS.java
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c	Thu Sep 08 22:14:00 2016 +0000
+++ b/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c	Wed Sep 07 14:44:59 2016 -0700
@@ -52,6 +52,10 @@
 #include <strings.h>
 #endif
 
+#ifdef __linux__
+#include <sys/syscall.h>
+#endif
+
 #if defined(__linux__) || defined(_AIX)
 #include <string.h>
 #endif
@@ -157,14 +161,11 @@
 }
 #endif
 
-#if defined(__linux__) && defined(__x86_64__)
+#if defined(__linux__) && defined(_LP64) && defined(__NR_newfstatat)
 #define FSTATAT64_SYSCALL_AVAILABLE
 static int fstatat64_wrapper(int dfd, const char *path,
                              struct stat64 *statbuf, int flag)
 {
-    #ifndef __NR_newfstatat
-    #define __NR_newfstatat  262
-    #endif
     return syscall(__NR_newfstatat, dfd, path, statbuf, flag);
 }
 #endif
--- a/test/java/nio/file/DirectoryStream/SecureDS.java	Thu Sep 08 22:14:00 2016 +0000
+++ b/test/java/nio/file/DirectoryStream/SecureDS.java	Wed Sep 07 14:44:59 2016 -0700
@@ -45,6 +45,9 @@
             DirectoryStream<Path> stream = newDirectoryStream(dir);
             stream.close();
             if (!(stream instanceof SecureDirectoryStream)) {
+                if (System.getProperty("os.name").equals("Linux"))
+                    throw new AssertionError(
+                            "SecureDirectoryStream not supported.");
                 System.out.println("SecureDirectoryStream not supported.");
                 return;
             }