Date: Sun, 09 Nov 2003 14:16:40 +0100 (CET) From: Markus Brueffer <brueffer@phoenix-systems.de> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/59080: [patch] x11/kdebase3: ksysguardd doesn't determine CPU stats correctly Message-ID: <20031109131640.24A5A1D8@maquis.hitnet.rwth-aachen.de> Resent-Message-ID: <200311091330.hA9DUDsL017310@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 59080 >Category: ports >Synopsis: [patch] x11/kdebase3: ksysguardd doesn't determine CPU stats correctly >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Nov 09 05:30:12 PST 2003 >Closed-Date: >Last-Modified: >Originator: Markus Brueffer >Release: FreeBSD 5.1-CURRENT i386 >Organization: >Environment: System: FreeBSD cheops.phoenix 5.1-CURRENT FreeBSD 5.1-CURRENT #10: Tue Nov 4 20:05:23 CET 2003 brueffer@cheops.phoenix:/usr/obj/usr/src/sys/CHEOPS i386 >Description: For determining CPU stats, ksysguardd uses sysctlbyname. From sysctl(3): int sysctlbyname(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen); Unfortunately oldlenp is passed the wrong way which makes the call to sysctlbyname fail, resulting in all statistics about the CPU always to be 0. The attached patch corrects this. It was tested on several machines ranging from FreeBSD 4.9 up to the latest -CURRENT. Furthermore this patch should be committed to KDE-HEAD. >How-To-Repeat: Open ksysguard and have a look at the CPU-pane. You won't see any CPU statistics there. >Fix: --- patch-ksysguard-ksysguardd-FreeBSD-CPU.c begins here --- --- ksysguard/ksysguardd/FreeBSD/CPU.c.orig Sat Nov 8 15:40:15 2003 +++ ksysguard/ksysguardd/FreeBSD/CPU.c Sat Nov 8 15:16:40 2003 @@ -49,6 +49,8 @@ long cp_diff[CPUSTATES]; int cpu_states[CPUSTATES]; +size_t cp_time_len = sizeof(cp_time); + void initCpuInfo(struct SensorModul* sm) { @@ -73,7 +75,7 @@ int updateCpuInfo(void) { - sysctlbyname("kern.cp_time", &cp_time, sizeof(cp_time), NULL, 0); + sysctlbyname("kern.cp_time", &cp_time, &cp_time_len, NULL, 0); percentages(CPUSTATES, cpu_states, cp_time, cp_old, cp_diff); return (0); } --- patch-ksysguard-ksysguardd-FreeBSD-CPU.c ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031109131640.24A5A1D8>