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

Michal Vala mvala at redhat.com
Wed Apr 25 10:33:05 UTC 2018

On 04/24/2018 09:17 PM, Kim Barrett wrote:
>> On Apr 23, 2018, at 3:51 AM, Michal Vala <mvala at redhat.com> wrote:
>> Hi,
>> following discussion "RFR: build pragma error with gcc 4.4.7"[1], I'm posting updated patch replacing deprecated readdir_r with readdir. Bug ID is JDK-8179887 [2].
>> webrev: http://cr.openjdk.java.net/~andrew/8179887/webrev/
>> I'm asking for the review and eventually sponsorship.
> The change to os::readdir in os_linux.inline.hpp looks fine.
> I was going to suggest that rather than changing perfMemory_linux.cpp to use os::readdir in an
> unusual and platform-specific way, it should instead just call ::readdir directly.  However, neither
> of those is right, and that part of the change should not be made; see
> https://bugs.openjdk.java.net/browse/JDK-8134540
> Much nearly duplicated code for PerfMemory support
> Looking a bit deeper, there might be some additional follow-on that could be done, eliminating
> the second argument to os::readdir.

That's what was I first doing. However, I have no resources to test all OSes.
I understand that this solution is not clear. However, until we remove the 
second argument and eventually merge PerfMemory code, it's useless to passing it 
on linux. That's why I did that cleanup. It can be done for all OSes under 
another bug id though.

> windows: unused
> bsd: freebsd also deprecated readdir_r, I think for similar reasons.
> solaris: doc is clear about thread safety issue being about sharing the DIR*
> aix: I haven’t looked at it, but would guess it’s similar.
> In other words, don’t operate on the DIR* from multiple threads simultaneously, and just use
> ::readdir on non-Windows.  That would all be for another RFE though.

Michal Vala
Red Hat Czech

More information about the build-dev mailing list