RFR: 8179887 - Build failure with glibc >= 2.24: error: 'int readdir_r(DIR*, dirent*, dirent**)' is deprecated
gnu.andrew at redhat.com
Wed Apr 25 14:51:36 UTC 2018
On 24 April 2018 at 20:17, Kim Barrett <kim.barrett at oracle.com> wrote:
>> On Apr 23, 2018, at 3:51 AM, Michal Vala <mvala at redhat.com> wrote:
>> following discussion "RFR: build pragma error with gcc 4.4.7", I'm posting updated patch replacing deprecated readdir_r with readdir. Bug ID is JDK-8179887 .
>> webrev: http://cr.openjdk.java.net/~andrew/8179887/webrev/
>> I'm asking for the review and eventually sponsorship.
The patch looks good to me.
> 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
> Much nearly duplicated code for PerfMemory support
I think, in the circumstances, Michal's solution is the best option at
8134540 looks like a more long-term change currently scheduled for 12 (is
anyone currently working on it?), whereas this fix could go into 11 and remove
a couple of unneeded memory allocations.
> Looking a bit deeper, there might be some additional follow-on that could be done, eliminating
> the second argument to os::readdir.
> 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.
This also seems like a more in-depth separate change and not one that
can be performed
by any of us alone, as we don't test all these platforms. As it
stands, Michal's change affects
Linux and Linux alone, and the addition of the use of NULL will make
it clearer that moving
to an os:readdir is feasible on that platform.
Senior Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)
Web Site: http://fuseyism.com
PGP Key: ed25519/0xCFDA0F9B35964222 (hkp://keys.gnupg.net)
Fingerprint = 5132 579D D154 0ED2 3E04 C5A0 CFDA 0F9B 3596 4222
More information about the build-dev