On Mon, 3 Mar 2025 12:22:01 GMT, Kevin Walls <kev...@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).

Fix looks good. Thanks.

src/jdk.management/windows/native/libmanagement_ext/OperatingSystemImpl.c line 
296:

> 294: /* PDH format patterns, and lengths of their constant component. */
> 295: static const char* const OBJECT_COUNTER_FMT = "\\%s\\%s";
> 296: static const size_t OBJECT_COUNTER_FMT_LEN = 2;

Pre-existing but as per earlier discussions on this, what exactly do these 
lengths mean??

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

Marked as reviewed by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/23861#pullrequestreview-2656144269
PR Review Comment: https://git.openjdk.org/jdk/pull/23861#discussion_r1978719502

Reply via email to