diff options
author | marcus <marcus@FreeBSD.org> | 2010-01-03 11:02:15 +0800 |
---|---|---|
committer | marcus <marcus@FreeBSD.org> | 2010-01-03 11:02:15 +0800 |
commit | 1cc0a40a39635796383601918b3c381e9e00e0c8 (patch) | |
tree | 85f8d0f465fe6fb121a7a190980031fed7eef9f4 | |
parent | c76575b0dd8d578ac8a8b09a067382f958932e94 (diff) | |
download | freebsd-ports-gnome-1cc0a40a39635796383601918b3c381e9e00e0c8.tar.gz freebsd-ports-gnome-1cc0a40a39635796383601918b3c381e9e00e0c8.tar.zst freebsd-ports-gnome-1cc0a40a39635796383601918b3c381e9e00e0c8.zip |
Properly determine the CPU load values on FreeBSD.
-rw-r--r-- | sysutils/gnome-power-manager/Makefile | 2 | ||||
-rw-r--r-- | sysutils/gnome-power-manager/files/patch-src_gpm-load.c | 46 |
2 files changed, 47 insertions, 1 deletions
diff --git a/sysutils/gnome-power-manager/Makefile b/sysutils/gnome-power-manager/Makefile index 601ea8167393..5b527ba41719 100644 --- a/sysutils/gnome-power-manager/Makefile +++ b/sysutils/gnome-power-manager/Makefile @@ -8,7 +8,7 @@ PORTNAME= gnome-power-manager PORTVERSION= 2.24.4 -PORTREVISION= 6 +PORTREVISION= 7 CATEGORIES= sysutils gnome MASTER_SITES= GNOME DIST_SUBDIR= gnome2 diff --git a/sysutils/gnome-power-manager/files/patch-src_gpm-load.c b/sysutils/gnome-power-manager/files/patch-src_gpm-load.c new file mode 100644 index 000000000000..b9e08c982b72 --- /dev/null +++ b/sysutils/gnome-power-manager/files/patch-src_gpm-load.c @@ -0,0 +1,46 @@ +--- src/gpm-load.c.orig 2010-01-02 21:57:09.000000000 -0500 ++++ src/gpm-load.c 2010-01-02 21:59:16.000000000 -0500 +@@ -33,6 +33,10 @@ + #include <kstat.h> + #include <sys/sysinfo.h> + #endif ++#if defined(__FreeBSD__) ++#include <sys/resource.h> ++#include <sys/sysctl.h> ++#endif + #ifdef HAVE_UNISTD_H + #include <unistd.h> + #endif /* HAVE_UNISTD_H */ +@@ -159,6 +163,32 @@ out: + return FALSE; + } + ++#elif defined(__FreeBSD__) ++ ++/** ++ * gpm_load_get_cpu_values: ++ * @cpu_idle: The idle time reported by the CPU ++ * @cpu_total: The total time reported by the CPU ++ * Return value: Success of reading of the kern.cp_time sysctl. ++ **/ ++static gboolean ++gpm_load_get_cpu_values (long unsigned *cpu_idle, long unsigned *cpu_total) ++{ ++ long cpts[CPUSTATES]; ++ size_t length; ++ ++ length = sizeof (cpts); ++ if (sysctlbyname ("kern.cp_time", cpts, &length, NULL, 0)) { ++ return FALSE; ++ } ++ ++ *cpu_idle = (unsigned long) cpts[CP_IDLE]; ++ *cpu_total = (unsigned long) (cpts[CP_USER] + cpts[CP_NICE] + \ ++ cpts[CP_SYS] + cpts[CP_IDLE] + cpts[CP_INTR]); ++ ++ return TRUE; ++} ++ + #else + + /** |