[12] (AIX) 8207744: Clean up inconsistent use of opendir/closedir versus opendir64/closedir64 (original) (raw)

B. Blaser bsrbnd at gmail.com
Fri Aug 10 13:20:36 UTC 2018


Hi Brian,

Among the files you suggest to fix, only the following ones are still using 'readdir64' for other systems than AIX:

http://cr.openjdk.java.net/~bpb/8207744/webrev.03/src/java.base/unix/native/libjava/UnixFileSystem_md.c.frames.html http://cr.openjdk.java.net/~bpb/8207744/webrev.03/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c.frames.html

I think you could also use 'readdir' and remove lines like the following ones in both files:

67 #if defined(_ALLBSD_SOURCE) 68 #define dirent64 dirent 69 #define readdir64 readdir 70 #define stat64 stat

The following file is the only one that uses 'readdir64' on BSD which is suspect:

http://cr.openjdk.java.net/~bpb/8207744/webrev.03/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c.frames.html

I guess you could simply remove the following lines:

77 #if defined(_ALLBSD_SOURCE) 78 #define DIR DIR64 79 #define dirent dirent64 80 #define opendir opendir64 81 #define closedir closedir64 82 #define readdir readdir64 83 #endif

In the following file:

http://cr.openjdk.java.net/~bpb/8207744/webrev.03/src/java.base/unix/native/libjava/TimeZone_md.c.frames.html

... 'readdir' seems not to be used on AIX, see:

81 #if defined(linux) || defined(MACOSX) || defined(solaris)

So, some lines following '53 #if defined(_AIX) ...' are probably not necessary.

Finally, referring to [1], I note that 'readdir64' is only necessary on Linux to access large file systems using 32-bit architectures:

"To support large filesystems on 32-bit machines there are LFS variants of the last two functions." [...]

So, removing it is OK if this feature isn't required by the JDK.

Cheers, Bernard

[1] https://www.gnu.org/software/libc/manual/html_node/Reading_002fClosing-Directory.html

On 9 August 2018 at 22:56, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:

Hello,

The latest build + test runs with the .03 revision of this patch check out on AIX, Linux-x64, macOS, Solaris-sparc, and Windows-x64. If there is a Reviewer available who approves of these changes then please do so. Thanks, Brian On Aug 7, 2018, at 3:41 PM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:

Hi Matthias,

Yes, that was intentional. From the documentation it looks as if the Linux / Solaris *64 functions in question are now legacy so I changed them for hopefully better consistency. I did not see any problems in building or testing with these changes. If someone knows these changes to be incorrect then I would appreciate being so informed. Does this latest (.03) patch check out on AIX? Thanks, Brian On Aug 7, 2018, at 3:12 AM, Baesken, Matthias <matthias.baesken at sap.com> wrote:

small remark from my side , looks like you changed in

src/java.base/unix/native/libjava/TimeZonemd.c src/java.base/unix/native/libjava/childproc.c and src/jdk.management/unix/native/libmanagementext/OperatingSystemImpl.c at some places dirent64 / readdir64 to dirent / readdir in the linux/solaris coding. for example TimeZonemd.c 122 static char * 123 findZoneinfoFile(char *buf, sizet size, const char *dir) 124 { 125 DIR *dirp = NULL; 126 struct stat statbuf; 127 struct dirent *dp = NULL;.

Was it intended to change for linux/solaris ?



More information about the core-libs-dev mailing list