RFR: 8179887 - Build failure with glibc >= 2.24: error: 'int readdir_r(DIR*, dirent*, dirent**)' is deprecated
Kim Barrett
kim.barrett at oracle.com
Tue May 1 17:59:01 UTC 2018
> On Apr 27, 2018, at 4:26 PM, Michal Vala <mvala at redhat.com> wrote:
>>> For now, proposed patch looks like this:
>>>
>>> --- old/src/hotspot/os/linux/os_linux.inline.hpp 2018-04-20 09:16:34.498343185 +0200
>>> +++ new/src/hotspot/os/linux/os_linux.inline.hpp 2018-04-20 09:16:34.214342670 +0200
>>> @@ -98,26 +98,8 @@
>>>
>>> inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
>>> {
>>> -// readdir_r has been deprecated since glibc 2.24.
>>> -// See https://sourceware.org/bugzilla/show_bug.cgi?id=19056 for more details.
>>> -#pragma GCC diagnostic push
>>> -#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
>>> -
>>> - dirent* p;
>>> - int status;
>>> assert(dirp != NULL, "just checking");
>>> -
>>> - // NOTE: Linux readdir_r (on RH 6.2 and 7.2 at least) is NOT like the POSIX
>>> - // version. Here is the doc for this function:
>>> - // http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_262.html
>>> -
>>> - if((status = ::readdir_r(dirp, dbuf, &p)) != 0) {
>>> - errno = status;
>>> - return NULL;
>>> - } else
>>> - return p;
>>> -
>>> -#pragma GCC diagnostic pop
>>> + return ::readdir(dirp);
>>> }
>>>
>>> inline int os::closedir(DIR *dirp) {
>> This looks good.
>
> Thanks!
> Someone to sponsor this please?
Do you have a sponsor yet? If not, I’ll do it.
More information about the build-dev
mailing list