[crac] RFR: 8371549: [CRaC] Implement C/R in Selector on non-Linux [v2]

Timofei Pushkin tpushkin at openjdk.org
Thu Jan 8 16:54:02 UTC 2026


On Wed, 7 Jan 2026 18:37:44 GMT, Radim Vansa <rvansa at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/crac/ClaimedFDs.java line 89:
>> 
>>> 87:                         assert fileDescriptorAccess.getHandle(entry.getKey()) != -1;
>>> 88:                         // On Windows the native FDs check is a no-op, but we need to set
>>> 89:                         // the FD to prevent assertion failure on Descriptor.getFd()
>> 
>> Maybe allow -1 as a value? Having 0 may be confusing as it is a valid FD value.
>> 
>> In the future, it looks like we need a more general abstraction for FD/handle.
>
> It is strange to allow -1 in a 'valid' Descriptor. And on Linux, which is our 'main' platform this does not happen - I think it is better to keep it this way. I could do `fd = Integer.MAX_VALUE` to differentiate this from stdin = 0.

AFAIU, this is only used for error reporting. In a error message -1 seems more obvious as a placeholder than 0 or the actual value of `Integer.MAX_VALUE`.

But it is not so important, I'm OK with leaving as is.

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

PR Review Comment: https://git.openjdk.org/crac/pull/276#discussion_r2673107564


More information about the crac-dev mailing list