On Mon, 5 Jan 2026 16:06:56 GMT, Weijun Wang <[email protected]> wrote:

> Maybe we can call Integer.toUnsignedLong() on pw_uid and pw_gid? In 
> UnixSystem, they are longs.

Yes, I had thought about this, too. But, I think we will need to distinguish 
between the platforms. PPC64 and s390 (and also SPARC which is no longer 
supported) pass smaller integer type values as 64 bit `long` and 
`Integer.toUnsignedLong()` would be correct when we change the signature to use 
`long` instead of `int`.
However, other platforms may require to pass the values as 4 Byte `int`. 
Especially when they are passed on stack. (Not sure if any supported platform 
does that. Probably not.) It's unfortunate that the FFM doesn't provide a good 
abstraction for passing `uint32_t`. Maybe we should implement an enhancement?
In hotspot, `CCallingConventionRequiresIntsAsLongs` is used to decide if 4 Byte 
integer types need to get extended.

> I would suggest we just throw an exception in UnixSystem if getpwuid_r cannot 
> find the username.

Fine with me. I don't like ignoring getpwuid_r failures, either.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28931#discussion_r2662113718

Reply via email to