On Fri, 26 May 2023 07:12:07 GMT, Matthias Baesken <mbaes...@openjdk.org> wrote:

>> This is IBMs declaration of statfs
>> `extern int statfs(char *, struct statfs *);`
>> So the compiler will not accept a `const char*`
>> Indeed I do not know if this ever worked, but my change makes it not worse.
>
> Here is the documentation of statfs on AIX  
> https://www.ibm.com/docs/en/aix/7.2?topic=s-statfs-fstatfs-statfs64-fstatfs64-ustat-subroutine
>   (showing the IBM declaration Joachim told us) .

> Also, pre-existing, the cast seems really suspicious. The type of `chars` is 
> `jchar*`, which is a sequence of 16bit characters. Does this actually work? 
> If so, how?

Probably a jchar to char conversion would be needed for the array elements,  
maybe like this here (or is there a better utility function in the codebase) ? 
See  jCharArrayToCKCharArray
https://github.com/openjdk/jdk/blob/199b1bf5009120efd1fd37a1ddabc0c6fb84f62c/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_util.c#L644

I am not aware of an AIX statfs for wchars but maybe I miss something.  But it 
is a separate issue of Java_GetXSpace_getSpace0  anyway and should be handled 
in another bug.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14146#discussion_r1206370114

Reply via email to