From e3b378ecd1ed33698ccace0ddf64effce8d76b21 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sun, 23 Aug 2009 15:58:52 -0700 Subject: [PATCH] (SIGAR-179) Increase buffer size in cpu_list query from 16 to 128 --- src/os/win32/win32_sigar.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/os/win32/win32_sigar.c b/src/os/win32/win32_sigar.c index 4b776849..9879c701 100644 --- a/src/os/win32/win32_sigar.c +++ b/src/os/win32/win32_sigar.c @@ -725,6 +725,8 @@ static PERF_INSTANCE_DEFINITION *get_cpu_instance(sigar_t *sigar, return PdhFirstInstance(object); } +#define SPPI_MAX 128 /* XXX unhardcode; should move off this api anyhow */ + #define sigar_NtQuerySystemInformation \ sigar->ntdll.query_sys_info.func @@ -743,8 +745,7 @@ static int get_idle_cpu(sigar_t *sigar, sigar_cpu_t *cpu, DLLMOD_INIT(ntdll, FALSE); if (sigar_NtQuerySystemInformation) { DWORD retval, num; - /* XXX unhardcode 16 */ - SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION info[16]; + SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION info[SPPI_MAX]; /* into the lungs of hell */ sigar_NtQuerySystemInformation(SystemProcessorPerformanceInformation, &info, sizeof(info), &retval); @@ -815,8 +816,7 @@ static int sigar_cpu_ntsys_get(sigar_t *sigar, sigar_cpu_t *cpu) { DWORD retval, num; int i; - /* XXX unhardcode 16 */ - SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION info[16]; + SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION info[SPPI_MAX]; /* into the lungs of hell */ sigar_NtQuerySystemInformation(SystemProcessorPerformanceInformation, &info, sizeof(info), &retval); @@ -918,8 +918,7 @@ static int sigar_cpu_list_ntsys_get(sigar_t *sigar, int status, i, j; int core_rollup = sigar_cpu_core_rollup(sigar); - /* XXX unhardcode 16 */ - SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION info[16]; + SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION info[SPPI_MAX]; /* into the lungs of hell */ sigar_NtQuerySystemInformation(SystemProcessorPerformanceInformation, &info, sizeof(info), &retval);