On Thu, 23 Apr 2026 13:11:05 GMT, Michael McMahon <[email protected]> wrote:
>> Hi, >> >> This is a small fix for j.l.ProcessHandle on MacOS. Unlike other platforms, >> Mac returns a ProcessHandle for pid 0 whose descendants are _all_ processes >> on the system. This specific scenario tickles an off by one error where the >> descendants method tries to access an element past the end of the array of >> pids. The fix is to break from the loop before accessing this element. >> >> Thanks, >> >> Michael >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Michael McMahon has updated the pull request incrementally with one > additional commit since the last revision: > > typo I looked at a refactoring to change the sentinel value to -1 and avoid 0. Also added some MacOSX tests for pid 0. See draft PR: https://github.com/openjdk/jdk/pull/30923 Use it as you see fit or I can convert it to a non-draft PR. ------------- PR Comment: https://git.openjdk.org/jdk/pull/30763#issuecomment-4313697172
