RFR: 8277489: Rewrite JAAS UnixLoginModule with FFM [v10]
Weijun Wang
weijun at openjdk.org
Wed Jan 21 21:13:58 UTC 2026
On Wed, 21 Jan 2026 21:01:30 GMT, Weijun Wang <weijun at openjdk.org> wrote:
>> src/jdk.security.auth/share/classes/com/sun/security/auth/module/UnixSystem.java line 118:
>>
>>> 116: = LINKER.downcallHandle(SYMBOL_LOOKUP.findOrThrow(
>>> 117: OperatingSystem.isAix() ? "_posix_getpwuid_r" : "getpwuid_r"),
>>> 118: FunctionDescriptor.of(C_INT,
>>
>> Indentation could be improved, here.
>
> Do you have a suggestion? I intentionally indented based on argument nesting. `FunctionDescriptor.of(...` is the 2nd argument of `downcallHandle` so I indented one level (8 spaces) to the method. `OperatingSystem.isAix()...` is argument of `findOrThrow` and `calling_convention_requires_int_as_long...` etc are arguments of `FunctionDescriptor.of` and they are indented one level further. IntelliJ IDEA unindents the `FunctionDescriptor.of(...)` block but I think that's misleading.
As for whether it's a better alternative of JNI, FFM is usually considered at least as fast as JNI. In this case, on my Mac, the FFM version is much much faster. I guess the main reason is while the C code is quite small it calls back to Java object manipulation too much.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28931#discussion_r2714356450
More information about the security-dev
mailing list