RFR: 8336529: (fs) UnixFileAttributeViews setTimes() failing on armhf, Ubuntu noble [v2]

Vladimir Petko vpetko at openjdk.org
Wed Jul 24 20:21:34 UTC 2024


On Thu, 18 Jul 2024 17:25:30 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Vladimir Petko has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
>> 
>>  - review comments: add ifdef, rename function
>>  - Merge branch 'master' into JDK-8336529
>>  - typo: remove extra whitespace
>>  - fix typo: missing whitespace
>>  - try to use 64 bit function if sizeof(time_t) > 4
>
> I don't object to putting in a patch to deal with this porting challenge, we just need to make sure that it don't disrupt other builds or platforms.  To that end, I think it would be better to only compile in lookup_time_t_function on Linux, you can put it after statx_wrapper. I assume you can reduce it to:
> 
>     if (sizeof(time_t) > 4) {
>         return dlsym(RTLD_DEFAULT, symbol64);
>     } else {
>         return dlsym(RTLD_DEFAULT, symbol32);
>     }
> 
> In Java_sun_nio_fs_UnixNativeDispatcher_init think you can use something like this to avoid changing what is compiled in on other platforms. 
> 
> #if defined(__linux)
>     my_futimesat_func = ..
> #elif defined(_ALLBSD_SOURCE)
>     my_futimesat_func = ..
> #else
>    my_futimesat_func = ..
> #endif

@AlanBateman I am still a bit afraid of breaking the non-glibc armhf port. E.g. musl does not provide 64 bit symbol, but instead has `__futimens_time32`. Maybe it would be better to have 

#if defined(__linux__) && defined(__arm__)
/**
 * Lookup functions with time_t parameter. Try to use 64 bit symbol
 * if sizeof(time_t) exceeds 32 bit.
 */
static void* lookup_time_t_function(const char* symbol, const char* symbol64) {
    void *func_ptr = NULL;
    if (sizeof(time_t) > 4) {
        func_ptr =  dlsym(RTLD_DEFAULT, symbol64);
    } 
    if (func_ptr == NULL)
        return dlsym(RTLD_DEFAULT, symbol);
   return func_ptr;
}
#endif

This is a bit longer, but does not break for musl.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20208#issuecomment-2248828050


More information about the nio-dev mailing list