8165643: SecureDirectoryStream doesn't work on linux non-x86
authormartin
Wed, 07 Sep 2016 14:44:59 -0700
changeset 40800 bd4117559e3f
parent 40799 f25e9a37e03f
child 40801 9bf0aafeb2bb
8165643: SecureDirectoryStream doesn't work on linux non-x86 Reviewed-by: alanb
jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
jdk/test/java/nio/file/DirectoryStream/SecureDS.java
--- a/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c	Thu Sep 08 22:14:00 2016 +0000
+++ b/jdk/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/jdk/test/java/nio/file/DirectoryStream/SecureDS.java	Thu Sep 08 22:14:00 2016 +0000
+++ b/jdk/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;
             }