RFR: 8324539: Do not use LFS64 symbols in JDK libs [v7]
Magnus Ihse Bursie
ihse at openjdk.org
Fri Feb 2 15:53:08 UTC 2024
On Fri, 2 Feb 2024 15:48:04 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:
>> src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c line 365:
>>
>>> 363: #else
>>> 364: // Make sure we link to the 64-bit version of the functions
>>> 365: my_openat_func = (openat_func*) dlsym(RTLD_DEFAULT, "openat64");
>>
>> Explain this part to me, if you wouldn't mind? (Why do we keep the `64` variants?)
>
> I wrote earlier:
>
>> There is one change that merit highlighting: In src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c, I kept the dlsym lookup for openat64, fstatat64 and fdopendir64, on non-BSD OSes (i.e. Linux and AIX), and on AIX, respectively. This seems to me to be the safest choice, as we do not need to know if a lookup of openat would yield a 32-bit or a 64-bit version. (I frankly don't know, but I'm guessing it would yield the 32-bit version.)
Basically, my understanding is that a call to "openat" in the source file will be converted into a call to openat64 on 32-bit platforms. When we look up the function using dlsym, I assume we need to find the 64-bit version directly.
Even if this is incorrect, it seems at least *safe* to do it this way.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17538#discussion_r1476231574
More information about the nio-dev
mailing list