jmx-dev Integrated: 8350939: Revisit Windows PDH buffer size calculation for OperatingSystemMXBean

Kevin Walls kevinw at openjdk.org
Thu Mar 6 12:30:07 UTC 2025


On Mon, 3 Mar 2025 12:22:01 GMT, Kevin Walls <kevinw at openjdk.org> wrote:

> Following on from JDK-8350820, which backed out the _snprintf to snprintf change (JDK-8336289) in OperatingSystemImpl.c on Windows, because the counter names were being truncated (so CPU monitoring was not possible).
> 
> This change moves to snprintf again, but the counter names are not truncated.
> 
> snprintf must need the null terminator to fit inside the buffer length given.  It does not, and snprintf truncates (and always add the null terminator).

This pull request has now been integrated.

Changeset: 8f8a879d
Author:    Kevin Walls <kevinw at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/8f8a879de03add68e385f2610863d3b4ddd86df7
Stats:     41 lines in 1 file changed: 0 ins; 5 del; 36 mod

8350939: Revisit Windows PDH buffer size calculation for OperatingSystemMXBean

Reviewed-by: dholmes, lmesnik, sspitsyn

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

PR: https://git.openjdk.org/jdk/pull/23861


More information about the jmx-dev mailing list