RFR: 8187667: Disable deprecation warning for readdir_r
David Holmes
david.holmes at oracle.com
Tue Sep 19 21:11:08 UTC 2017
FYI background reading:
https://www.gnu.org/software/libc/manual/html_node/Reading_002fClosing-Directory.html#Reading_002fClosing-Directory
Seems the deprecation has merit.
David
On 20/09/2017 7:05 AM, David Holmes wrote:
> Hi Erik,
>
> Reviewed!
>
> On 19/09/2017 10:42 PM, Erik Helin wrote:
>> Hi all,
>>
>> I'm continuing to run into some small problems when compiling HotSpot
>> with a more recent toolchain. It seems like readdir_r [0] has been
>> deprecated beginning with glibc 2.24 [1]. In HotSpot, we use readdir_r
>> for os::readdir on Linux (defined in os_linux.inline.hpp). Since
>> readdir_r most likely will stay around for a long time in glibc (even
>> though in deprecated form), I figured it was best to just silence the
>> deprecation warning from gcc. If readdir_r finally is removed one day,
>> then we might have to look up the appropriate readdir function using
>> dlopen, dlsym etc.
>
> I find it very odd that they have deprecated the thread-safe variant of
> this function, and recommend use of the basic readdir. I can only assume
> they have made readdir itself thread-safe, but given the POSIX spec does
> not require that, noone can take advantage without locking into knowing
> which glibc version they are running on! That seems an awful mess for
> programmers.
>
> It is a good idea to just keep using it.
>
>> Patch:
>> http://cr.openjdk.java.net/~ehelin/8187667/00/
>>
>> Bug:
>> https://bugs.openjdk.java.net/browse/JDK-8187667
>>
>> Testing:
>> - Compiles with:
>> - gcc 7.1.1 and glibc 2.25 on Fedora 26
>> - gcc 4.9.2 and glibc 2.12 on OEL 6.4
>> - JPRT
>
> The change will cause warnings on gcc < 4.6, so this reinforces the need
> to switch to our minimim gcc version ... which I forget :)
>
> Thanks,
> David
>
>
>> Thanks,
>> Erik
>>
>> [0]:
>> http://pubs.opengroup.org/onlinepubs/009695399/functions/readdir.html
>> [1]: https://sourceware.org/bugzilla/show_bug.cgi?id=19056
More information about the hotspot-dev
mailing list