diff options
author | xride <xride@FreeBSD.org> | 2008-06-08 16:23:15 +0800 |
---|---|---|
committer | xride <xride@FreeBSD.org> | 2008-06-08 16:23:15 +0800 |
commit | b660889e3cb25dd55e92baec1d10d94e289d2bdb (patch) | |
tree | 3e989d9085ba6cdf78eb7f155f9acdfde490b79e /sysutils | |
parent | 66cb3c4c5cf0d09db136c819b3dc0483d7e140dc (diff) | |
download | freebsd-ports-gnome-b660889e3cb25dd55e92baec1d10d94e289d2bdb.tar.gz freebsd-ports-gnome-b660889e3cb25dd55e92baec1d10d94e289d2bdb.tar.zst freebsd-ports-gnome-b660889e3cb25dd55e92baec1d10d94e289d2bdb.zip |
Fixed: wmcpuload exit with message "error extracting symbols"
With patch provided by Luke Dean <LukeD@pobox.com>
PR: ports/123047
Submitted by: regisr <regisr@pobox.com>
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/wmcpuload/Makefile | 2 | ||||
-rw-r--r-- | sysutils/wmcpuload/files/patch-src_cpu__freebsd.c | 57 |
2 files changed, 55 insertions, 4 deletions
diff --git a/sysutils/wmcpuload/Makefile b/sysutils/wmcpuload/Makefile index c12a1119aaf0..2de7000340e3 100644 --- a/sysutils/wmcpuload/Makefile +++ b/sysutils/wmcpuload/Makefile @@ -7,7 +7,7 @@ PORTNAME= wmcpuload PORTVERSION= 1.0.1 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= sysutils windowmaker MASTER_SITES= http://seiichisato.jp/dockapps/src/ diff --git a/sysutils/wmcpuload/files/patch-src_cpu__freebsd.c b/sysutils/wmcpuload/files/patch-src_cpu__freebsd.c index a4c17528050a..160eb60ca39f 100644 --- a/sysutils/wmcpuload/files/patch-src_cpu__freebsd.c +++ b/sysutils/wmcpuload/files/patch-src_cpu__freebsd.c @@ -1,6 +1,57 @@ ---- src/cpu_freebsd.c.orig Sat Mar 8 03:40:25 2003 -+++ src/cpu_freebsd.c Wed Nov 30 13:42:56 2005 -@@ -75,7 +75,7 @@ +--- src/cpu_freebsd.c.orig 2008-05-03 07:05:31.000000000 +0200 ++++ src/cpu_freebsd.c 2008-05-03 07:12:09.000000000 +0200 +@@ -18,7 +18,8 @@ + #include <string.h> + #include "cpu.h" + +-#include <kvm.h> ++#include <sys/sysctl.h> ++#include <sys/types.h> + #include <fcntl.h> + + #include <sys/param.h> +@@ -29,24 +30,18 @@ + # include <sys/resource.h> + #endif /* __FreeBSD_version < 500101 */ + +-static kvm_t *kd = NULL; +-static struct nlist nlst[] = { {"_cp_time"}, {0} }; ++static int sysctl_mib[2] = { -1, -1 }; ++static size_t sysctl_len; + + void + cpu_init(void) + { + +- kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open"); ++ sysctl_len = 2; ++ sysctlnametomib("kern.cp_time", sysctl_mib, &sysctl_len); + +- if (kd == NULL) { +- fprintf(stderr, "can't open kernel virtual memory"); +- exit(1); +- } +- +- kvm_nlist(kd, nlst); +- +- if (nlst[0].n_type == 0) { +- fprintf(stderr, "error extracting symbols"); ++ if (sysctl_mib[0] == -1) { ++ fprintf(stderr, "unknown sysctl kern.cp_time"); + exit(1); + } + +@@ -68,14 +63,14 @@ + int used, total, result; + unsigned long int cpu_time[CPUSTATES]; + +- if (kvm_read(kd, nlst[0].n_value, &cpu_time, sizeof(cpu_time)) != +- sizeof(cpu_time)) +- return 0; ++ sysctl_len = sizeof(cpu_time); ++ if (sysctl(sysctl_mib, 2, &cpu_time, &sysctl_len, NULL, 0) == -1) ++ return 0; + used = cpu_time[CP_USER] + cpu_time[CP_SYS]; if (!opts->ignore_nice) used += cpu_time[CP_NICE]; |