On Mon, 20 Apr 2026 07:19:26 GMT, Michael McMahon <[email protected]> wrote:
> I wouldn't say that is desired behavior. It's just what is observed but is > platform specific and undocumented. I'm not sure special casing pid == 0 in > the shared code is a good idea. What if the other platforms have similar > behavior, but for different pid values? I think also checking before > dereferencing an out of range index value is still prudent regardless. `getDescendents()` does not expect to find the requested pid in the result stream/list. The use of zero in the call to native is intended to fetch info for all processes. Hmm, I don't think process 0 is real and am surprised to find a process zero with parent zero in the result list. I don't have a Linux handy to check. `ps` on MacOS does not list it. `ps -p 0`. Process ids are OS specific so there is no spec to throw IAE on `ProcessHandle.of(0)`. But I don't think pid zero should be exposed. If a process zero is not real then the API should return an empty list for calls to `ProcessHandle.of(0).getDescendents().toList()`. ------------- PR Comment: https://git.openjdk.org/jdk/pull/30763#issuecomment-4289925286
