I checked Linux [1], Solaris [2], MacOS [3], FreeBSD [4] and AIX [5] docs and I tried to summarize 64-bit directory usage as follows: * [1] & [2] seem to use 'opendir/closedir/DIR' in conjunction with 'readdir64' * [3] seems to be based on [4] which doesn't provide any specific 64-bit interface for directory usage * [5] seems to require 'opendir64/closedir64/DIR64' to use 'readdir64'
Then, I found the following 'readdir64' usages in the JDK: $ find ./src/ -type f -print | xargs grep "readdir64" ./src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c:#define readdir64 readdir ./src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c: ptr = readdir64(dirp); ./src/java.base/unix/native/libjava/TimeZone_md.c:#define readdir64 readdir ./src/java.base/unix/native/libjava/TimeZone_md.c: while ((dp = readdir64(dirp)) != NULL) { ./src/java.base/unix/native/libjava/childproc.c: #define readdir64 readdir ./src/java.base/unix/native/libjava/childproc.c: /* We use readdir64 instead of readdir to work around Solaris bug ./src/java.base/unix/native/libjava/childproc.c: while ((dirp = readdir64(dp)) != NULL) { ./src/java.base/unix/native/libjava/UnixFileSystem_md.c: #define readdir64 readdir ./src/java.base/unix/native/libjava/UnixFileSystem_md.c: while ((ptr = readdir64(dir)) != NULL) { ./src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c: #define readdir64 readdir ./src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c: while ((dentp = readdir64(dirp)) != NULL) { In these files, only 'TimeZone_md.c' & 'OperatingSystemImpl.c' seem to be missing '#define opendir opendir64' (etc...) for AIX. So, I guess I would do (blindly) something more like the patch below. Do we agree? Bernard [1] https://www.gnu.org/software/libc/manual/html_node/Reading_002fClosing-Directory.html [2] https://docs.oracle.com/cd/E36784_01/html/E36883/lf64-5.html [3] https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/OSX_Technology_Overview/SystemTechnology/SystemTechnology.html [4] https://www.freebsd.org/cgi/man.cgi?query=opendir&sektion=3 [5] https://www.ibm.com/support/knowledgecenter/en/ssw_aix_71/com.ibm.aix.basetrf1/opendir.htm diff -r b0fcf59be391 src/java.base/unix/native/libjava/TimeZone_md.c --- a/src/java.base/unix/native/libjava/TimeZone_md.c Fri Jul 20 14:48:41 2018 -0700 +++ b/src/java.base/unix/native/libjava/TimeZone_md.c Sat Jul 28 15:24:10 2018 +0200 @@ -55,6 +55,12 @@ #define readdir64 readdir #endif +#if defined(_AIX) + #define DIR DIR64 + #define opendir opendir64 + #define closedir closedir64 +#endif + #if !defined(__solaris__) || defined(__sparcv9) || defined(amd64) #define fileopen fopen #define filegets fgets diff -r b0fcf59be391 src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c --- a/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c Fri Jul 20 14:48:41 2018 -0700 +++ b/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c Sat Jul 28 15:24:10 2018 +0200 @@ -79,6 +79,12 @@ #define readdir64 readdir #endif +#if defined(_AIX) + #define DIR DIR64 + #define opendir opendir64 + #define closedir closedir64 +#endif + // true = get available swap in bytes // false = get total swap in bytes static jlong get_total_or_available_swap_space_size(JNIEnv* env, jboolean available) { On 27 July 2018 at 22:09, Brian Burkhalter <brian.burkhal...@oracle.com> wrote: > Hi Bernard, > > I think you are correct. Webrev updated accordingly: > > http://cr.openjdk.java.net/~bpb/8207744/webrev.01/ > > I know you cannot do it, but a build of this on AIX by someone would be > appreciated (not urgent). > > Thanks, > > Brian > > On Jul 27, 2018, at 7:16 AM, B. Blaser <bsr...@gmail.com> wrote: > > I cannot experiment on AIX myself but as mentioned in [1], shouldn't > this also/only be necessary in 'OperatingSystemImpl.c' & > 'TimeZone_md.c'? > I guess the problem on AIX is that 'readdir64' needs > 'openddir64/closedir64/DIR64' while these methods don't exist and are > de-facto not necessary on Linux (at least with glibc 2.26 64-bit). > The other files you suggest to fix seem to use 'readdir' so I believe > 'opendir/closedir' are well deserved here. > > What do you think? > > Thanks, > Bernard > > > [1] > http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-July/054439.html > >