8171906: Changes for 8148023 break AIX build
authorclanger
Fri, 23 Dec 2016 07:54:05 +0100
changeset 42944 641db7ce5057
parent 42943 51ece443d1cc
child 42945 1a9931e1c0f5
8171906: Changes for 8148023 break AIX build Reviewed-by: goetz, bpb
jdk/src/java.base/unix/native/libjava/UnixFileSystem_md.c
jdk/src/java.base/unix/native/libjava/childproc.c
jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
--- a/jdk/src/java.base/unix/native/libjava/UnixFileSystem_md.c	Thu Dec 22 18:48:53 2016 +0000
+++ b/jdk/src/java.base/unix/native/libjava/UnixFileSystem_md.c	Fri Dec 23 07:54:05 2016 +0100
@@ -39,10 +39,6 @@
 #include <dlfcn.h>
 #include <limits.h>
 
-#if defined(__solaris__) && !defined(NAME_MAX)
-#define NAME_MAX MAXNAMLEN
-#endif
-
 #include "jni.h"
 #include "jni_util.h"
 #include "jlong.h"
@@ -52,13 +48,26 @@
 #include "java_io_FileSystem.h"
 #include "java_io_UnixFileSystem.h"
 
+#if defined(_AIX)
+  #if !defined(NAME_MAX)
+    #define NAME_MAX MAXNAMLEN
+  #endif
+  #define DIR DIR64
+  #define opendir opendir64
+  #define closedir closedir64
+#endif
+
+#if defined(__solaris__) && !defined(NAME_MAX)
+  #define NAME_MAX MAXNAMLEN
+#endif
+
 #if defined(_ALLBSD_SOURCE)
-#define dirent64 dirent
-#define readdir64_r readdir_r
-#define stat64 stat
-#ifndef MACOSX
-#define statvfs64 statvfs
-#endif
+  #define dirent64 dirent
+  #define readdir64_r readdir_r
+  #define stat64 stat
+  #ifndef MACOSX
+    #define statvfs64 statvfs
+  #endif
 #endif
 
 /* -- Field IDs -- */
--- a/jdk/src/java.base/unix/native/libjava/childproc.c	Thu Dec 22 18:48:53 2016 +0000
+++ b/jdk/src/java.base/unix/native/libjava/childproc.c	Fri Dec 23 07:54:05 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -62,15 +62,18 @@
   return c >= '0' && c <= '9';
 }
 
-#ifdef _ALLBSD_SOURCE
-#define FD_DIR "/dev/fd"
-#define dirent64 dirent
-#define readdir64 readdir
-#elif defined(_AIX)
-/* AIX does not understand '/proc/self' - it requires the real process ID */
-#define FD_DIR aix_fd_dir
+#if defined(_AIX)
+  /* AIX does not understand '/proc/self' - it requires the real process ID */
+  #define FD_DIR aix_fd_dir
+  #define DIR DIR64
+  #define opendir opendir64
+  #define closedir closedir64
+#elif defined(_ALLBSD_SOURCE)
+  #define FD_DIR "/dev/fd"
+  #define dirent64 dirent
+  #define readdir64 readdir
 #else
-#define FD_DIR "/proc/self/fd"
+  #define FD_DIR "/proc/self/fd"
 #endif
 
 int
--- a/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c	Thu Dec 22 18:48:53 2016 +0000
+++ b/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c	Fri Dec 23 07:54:05 2016 +0100
@@ -81,6 +81,12 @@
 
 #include "sun_nio_fs_UnixNativeDispatcher.h"
 
+#if defined(_AIX)
+  #define DIR DIR64
+  #define opendir opendir64
+  #define closedir closedir64
+#endif
+
 /**
  * Size of password or group entry when not available via sysconf
  */
@@ -264,7 +270,11 @@
     my_unlinkat_func = (unlinkat_func*) dlsym(RTLD_DEFAULT, "unlinkat");
     my_renameat_func = (renameat_func*) dlsym(RTLD_DEFAULT, "renameat");
     my_futimesat_func = (futimesat_func*) dlsym(RTLD_DEFAULT, "futimesat");
+#if defined(_AIX)
+    my_fdopendir_func = (fdopendir_func*) dlsym(RTLD_DEFAULT, "fdopendir64");
+#else
     my_fdopendir_func = (fdopendir_func*) dlsym(RTLD_DEFAULT, "fdopendir");
+#endif
 
 #if defined(FSTATAT64_SYSCALL_AVAILABLE)
     /* fstatat64 missing from glibc */