From 66c0b19ed6fec2afd4ed381665274fa83c67660e Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Fri, 1 Sep 2023 09:34:46 +1000 Subject: Correct pid_t type return from Platform_getMaxPid function Coverity scanning shows we end up passing an integer into the Row_setPidColumnWidth routine which requires a pid_t - update each platform to return the correct type (and never return -1 as a failure code, this was being ignored). --- pcp/Platform.c | 4 ++-- pcp/Platform.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'pcp') diff --git a/pcp/Platform.c b/pcp/Platform.c index 83313338..9fb3770e 100644 --- a/pcp/Platform.c +++ b/pcp/Platform.c @@ -472,13 +472,13 @@ unsigned int Platform_getMaxCPU(void) { return pcp->ncpu; } -int Platform_getMaxPid(void) { +pid_t Platform_getMaxPid(void) { if (pcp->pidmax) return pcp->pidmax; pmAtomValue value; if (Metric_values(PCP_PID_MAX, &value, 1, PM_TYPE_32) == NULL) - return -1; + return UINT_MAX; pcp->pidmax = value.l; return pcp->pidmax; } diff --git a/pcp/Platform.h b/pcp/Platform.h index ce21f845..f43ed54f 100644 --- a/pcp/Platform.h +++ b/pcp/Platform.h @@ -84,7 +84,7 @@ long long Platform_getBootTime(void); unsigned int Platform_getMaxCPU(void); -int Platform_getMaxPid(void); +pid_t Platform_getMaxPid(void); double Platform_setCPUValues(Meter* this, int cpu); -- cgit v1.2.3