On Tue, 21 Apr 2026 16:28:25 GMT, Michael McMahon <[email protected]> wrote:

> ProcessHandle.of(0) returns a real handle on Mac, but not on Linux or 
> Windows. We could disallow its creation on Mac too, but existing code could 
> be using it. The parent of `1` is `0` and the parent of `0` is itself.

ok, pid 0 is the kernel on MacOS.
The anomaly is caused by the overload of 0 when calling native to return all 
processes.
The invariant should be that the stream returned from `getDescendants()` does 
not return a ProcessHandle for the pid itself.  But I suppose that is a 
different bug. The current bug would not occur if the requested pid was ignored.

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

PR Comment: https://git.openjdk.org/jdk/pull/30763#issuecomment-4290489048

Reply via email to