RFR: 8179887 - Build failure with glibc >= 2.24: error: 'int readdir_r(DIR*, dirent*, dirent**)' is deprecated (original) (raw)

B. Blaser bsrbnd at gmail.com
Mon May 7 15:20:11 UTC 2018


On 7 May 2018 at 14:19, B. Blaser <bsrbnd at gmail.com> wrote:

On 6 May 2018 at 18:35, B. Blaser <bsrbnd at gmail.com> wrote:

On 5 May 2018 at 22:26, Kim Barrett <kim.barrett at oracle.com> wrote:

On May 5, 2018, at 8:03 AM, B. Blaser <bsrbnd at gmail.com> wrote:

On 4 May 2018 at 17:42, Alan Bateman <Alan.Bateman at oracle.com> wrote: On 04/05/2018 16:31, B. Blaser wrote:

: I'll create a new JBS issue (unless you want to) since the fix is mostly located in core-libs and only intended to make the build complete. But I'll still need someone to review and push the fix, would you be interested in doing this? I think someone needs to explore the behavior on other platforms too as the #ifndef linux patches are ugly. Yes sure but I cannot test it elsewhere myself... and we can easily remove them once POSIX officially deprecates 'readdirr' or if someone validates the fix on other systems. I'm not sure anyone has the ability to test on all supported. That doesn't (and really can't) prevent making changes across platforms to platform-specific code. It just means one needs to get help with testing. Make the change across platforms, test on those platforms one has access to, and ask here for help testing on others. OK, I'll provide a cross-platform fix to be evaluated on other systems too. Here it is, tier1 is successful on Linux with glibc=2.26. Any feedback on other systems would be very helpful.

Some more cleanup...

Does this look better?

Thanks, Bernard

diff -r e81481fea884 src/java.base/unix/native/libjava/TimeZone_md.c --- a/src/java.base/unix/native/libjava/TimeZone_md.c Mon May 07 08:56:35 2018 +0200 +++ b/src/java.base/unix/native/libjava/TimeZone_md.c Mon May 07 15:14:26 2018 +0200 @@ -1,5 +1,5 @@ /*

d_name) + name_max + 1); - if (entry == NULL) { - (void) closedir(dirp); - return NULL; - }

@@ -214,9 +200,6 @@ pathname = NULL; }

@@ -339,7 +331,7 @@ if (rv == NULL) goto error;

 /* Scan the directory */

@@ -360,7 +352,6 @@ (*env)->DeleteLocalRef(env, name); } closedir(dir);

@@ -375,7 +366,6 @@

error: closedir(dir);

diff -r e81481fea884 src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c --- a/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c Mon May 07 08:56:35 2018 +0200 +++ b/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c Mon May 07 15:14:26 2018 +0200 @@ -1,5 +1,5 @@ /*

JNIEXPORT jbyteArray JNICALL Java_sun_nio_fs_UnixNativeDispatcher_readdir(JNIEnv* env, jclass this, jlong value) {

#ifdef _AIX

to NULL for the */

to NULL for the / / directory stream end. Otherwise, 'errno' will contain the error code. */ if (res != 0) {

#endif

@@ -745,7 +741,7 @@ throwUnixException(env, res); return NULL; } else {

diff -r e81481fea884 src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c --- a/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c Mon May 07 08:56:35 2018 +0200 +++ b/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c Mon May 07 15:14:26 2018 +0200 @@ -1,5 +1,5 @@ /*

#endif /* _ALLBSD_SOURCE */

-static struct dirent* read_dir(DIR* dirp, struct dirent* entry) { -#ifdef solaris - struct dirent* dbuf = readdir(dirp); - return dbuf; -#else /* linux || _ALLBSD_SOURCE / - struct dirent p; - if (readdir_r(dirp, entry, &p) == 0) { - return p; - } else { - return NULL; - } -#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) { @@ -432,7 +418,6 @@ return (100); #else /* solaris/linux */ DIR *dirp;

@@ -453,7 +438,7 @@

 // iterate through directory entries, skipping '.' and '..'
 // each entry represents an open file descriptor.


More information about the core-libs-dev mailing list