diff options
author | ume <ume@FreeBSD.org> | 2009-08-04 21:34:26 +0800 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2009-08-04 21:34:26 +0800 |
commit | 5005516535f72c5072e847325e7b84946a74b159 (patch) | |
tree | e803ab03db8ee4a3c230af06a5f92f9a18b2401c /sysutils/gkrellm2 | |
parent | 39554f2b987809210e9957e42f3300f1276f612b (diff) | |
download | freebsd-ports-gnome-5005516535f72c5072e847325e7b84946a74b159.tar.gz freebsd-ports-gnome-5005516535f72c5072e847325e7b84946a74b159.tar.zst freebsd-ports-gnome-5005516535f72c5072e847325e7b84946a74b159.zip |
- Add multi cpu support.
- Though coretemp set dev.cpu.N.temperature in celsius, amdtemp set
it in kelvin.
Diffstat (limited to 'sysutils/gkrellm2')
-rw-r--r-- | sysutils/gkrellm2/Makefile | 2 | ||||
-rw-r--r-- | sysutils/gkrellm2/files/patch-src::sysdeps::freebsd.c | 256 |
2 files changed, 192 insertions, 66 deletions
diff --git a/sysutils/gkrellm2/Makefile b/sysutils/gkrellm2/Makefile index 0cb72da54c2f..a42815fc3271 100644 --- a/sysutils/gkrellm2/Makefile +++ b/sysutils/gkrellm2/Makefile @@ -7,7 +7,7 @@ PORTNAME= gkrellm PORTVERSION= 2.3.2 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= sysutils ipv6 MASTER_SITES= http://members.dslextreme.com/users/billw/gkrellm/ \ ${MASTER_SITE_LOCAL} diff --git a/sysutils/gkrellm2/files/patch-src::sysdeps::freebsd.c b/sysutils/gkrellm2/files/patch-src::sysdeps::freebsd.c index 649003ff662f..ed1fd26d9f7f 100644 --- a/sysutils/gkrellm2/files/patch-src::sysdeps::freebsd.c +++ b/sysutils/gkrellm2/files/patch-src::sysdeps::freebsd.c @@ -1,7 +1,7 @@ Index: src/sysdeps/freebsd.c diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c --- src/sysdeps/freebsd.c.orig 2008-10-04 09:45:56.000000000 +0900 -+++ src/sysdeps/freebsd.c 2008-10-13 02:35:16.000000000 +0900 ++++ src/sysdeps/freebsd.c 2009-08-04 22:04:06.080455360 +0900 @@ -33,14 +33,20 @@ | as that of the covered work. */ @@ -51,7 +51,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c static int gk_sysctlnametomib(const char *name, int *mibp, size_t *lenp) { -@@ -90,16 +95,11 @@ gk_sysctlnametomib(const char *name, int +@@ -90,38 +95,43 @@ gk_sysctlnametomib(const char *name, int /* ===================================================================== */ /* CPU monitor interface */ @@ -67,13 +67,22 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c -extern kvm_t *kvmd; static int oid_cp_time[CTL_MAXNAME + 2]; ++static int oid_cp_times[CTL_MAXNAME + 2]; static size_t oid_cp_time_len = sizeof(oid_cp_time); -@@ -109,12 +109,14 @@ void ++static size_t oid_cp_times_len = sizeof(oid_cp_times); + static gint have_cp_time; ++static gint maxid; ++static gint ncpus; ++static u_long cpumask; ++static long *cp_times; + + void gkrellm_sys_cpu_read_data(void) { - long cp_time[CPUSTATES]; +- long cp_time[CPUSTATES]; - int len = sizeof(cp_time); -+ size_t len = sizeof(cp_time); ++ long cp_time[CPUSTATES], *cp_timep; ++ size_t len; +#if __FreeBSD_version < 500000 static struct nlist nl[] = { #define N_CP_TIME 0 @@ -84,23 +93,120 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c if (have_cp_time) { -@@ -122,6 +124,7 @@ gkrellm_sys_cpu_read_data(void) - cp_time, &len, 0, 0) < 0) +- if (sysctl(oid_cp_time, oid_cp_time_len, +- cp_time, &len, 0, 0) < 0) ++ len = sizeof(cp_time); ++ if (sysctl(oid_cp_time, oid_cp_time_len, cp_time, &len, ++ NULL, 0) < 0) return; } +#if __FreeBSD_version < 500000 else { if (kvmd == NULL) -@@ -133,6 +136,7 @@ gkrellm_sys_cpu_read_data(void) +@@ -133,22 +143,92 @@ gkrellm_sys_cpu_read_data(void) sizeof(cp_time)) != sizeof(cp_time)) return; } +#endif - /* Currently, SMP is not supported */ - gkrellm_cpu_assign_data(0, cp_time[CP_USER], cp_time[CP_NICE], -@@ -156,8 +160,6 @@ gkrellm_sys_cpu_init(void) +- /* Currently, SMP is not supported */ +- gkrellm_cpu_assign_data(0, cp_time[CP_USER], cp_time[CP_NICE], +- cp_time[CP_SYS], cp_time[CP_IDLE]); ++ if (ncpus > 1) ++ { ++ gint i, j; ++ ++ gkrellm_cpu_assign_composite_data(cp_time[CP_USER], ++ cp_time[CP_NICE], ++ cp_time[CP_SYS], ++ cp_time[CP_IDLE]); ++ ++ len = (maxid + 1) * sizeof(long) * CPUSTATES; ++ if (sysctl(oid_cp_times, oid_cp_times_len, cp_times, &len, ++ NULL, 0) < 0) ++ return; ++ for (i = j = 0; i <= maxid; ++i) ++ { ++ if ((cpumask & (1ul << i)) == 0) ++ continue; ++ cp_timep = &cp_times[i * CPUSTATES]; ++ gkrellm_cpu_assign_data(j, cp_timep[CP_USER], ++ cp_timep[CP_NICE], ++ cp_timep[CP_SYS], ++ cp_timep[CP_IDLE]); ++ ++j; ++ } ++ } ++ else ++ gkrellm_cpu_assign_data(0, cp_time[CP_USER], cp_time[CP_NICE], ++ cp_time[CP_SYS], cp_time[CP_IDLE]); + } + + gboolean + gkrellm_sys_cpu_init(void) + { +- static char *name = "kern.cp_time"; +- +- gkrellm_cpu_set_number_of_cpus(1); ++ gint have_cp_times = FALSE; ++ gint maxcpus; ++ size_t len; ++ long *p; ++ ++ if (gk_sysctlnametomib("kern.cp_time", oid_cp_time, ++ &oid_cp_time_len) >= 0) ++ have_cp_time = TRUE; ++ ++ len = sizeof(maxcpus); ++ if (sysctlbyname("kern.smp.maxcpus", &maxcpus, &len, NULL, 0) >= 0) ++ { ++ gint empty, i, j; ++ ++ if (gk_sysctlnametomib("kern.cp_times", oid_cp_times, ++ &oid_cp_times_len) < 0) ++ goto pcpu_probe_done; ++ len = maxcpus * sizeof(long) * CPUSTATES; ++ if ((cp_times = malloc(len)) == NULL) ++ goto pcpu_probe_done; ++ if (sysctl(oid_cp_times, oid_cp_times_len, cp_times, &len, ++ NULL, 0) < 0) ++ { ++ free(cp_times); ++ cp_times = NULL; ++ goto pcpu_probe_done; ++ } ++ maxid = (len / CPUSTATES / sizeof(long)) - 1; ++ cpumask = 0; ++ ncpus = 0; ++ for (i = 0; i <= maxid; ++i) ++ { ++ empty = 1; ++ for (j = 0; empty && j < CPUSTATES; ++j) ++ if (cp_times[i * CPUSTATES + j] != 0) ++ empty = 0; ++ if (!empty) ++ { ++ cpumask |= (1ul << i); ++ ++ncpus; ++ } ++ } ++ if ((p = realloc(cp_times, len)) != NULL) ++ cp_times = p; ++ have_cp_times = TRUE; ++ } + +- if (gk_sysctlnametomib(name, oid_cp_time, &oid_cp_time_len) < 0) +- return TRUE; +- ++have_cp_time; ++pcpu_probe_done: ++ if (!have_cp_times) ++ ncpus = 1; ++ gkrellm_cpu_set_number_of_cpus(ncpus); + return TRUE; + } + +@@ -156,8 +236,6 @@ gkrellm_sys_cpu_init(void) /* ===================================================================== */ /* Proc monitor interface */ @@ -109,7 +215,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c #if __FreeBSD_version >= 400000 #include <sys/user.h> #endif -@@ -175,13 +177,10 @@ gkrellm_sys_cpu_init(void) +@@ -175,13 +253,10 @@ gkrellm_sys_cpu_init(void) #undef KERNEL #endif @@ -123,7 +229,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c static int oid_v_forks[CTL_MAXNAME + 2]; static int oid_v_vforks[CTL_MAXNAME + 2]; static int oid_v_rforks[CTL_MAXNAME + 2]; -@@ -215,17 +214,19 @@ gkrellm_sys_proc_read_data(void) +@@ -215,17 +290,19 @@ gkrellm_sys_proc_read_data(void) static int oid_proc[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL }; #endif double avenrun; @@ -146,7 +252,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c if (getloadavg(&avenrun, 1) <= 0) avenrun = 0; -@@ -246,6 +247,7 @@ gkrellm_sys_proc_read_data(void) +@@ -246,6 +323,7 @@ gkrellm_sys_proc_read_data(void) if (r_forks >= 0 && r_vforks >= 0 && r_rforks >= 0) n_forks = n_forks + n_vforks + n_rforks; } @@ -154,7 +260,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c else { /* workaround: Can I get total number of processes? */ -@@ -268,6 +270,7 @@ gkrellm_sys_proc_read_data(void) +@@ -268,6 +346,7 @@ gkrellm_sys_proc_read_data(void) } } } @@ -162,7 +268,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c #if __FreeBSD_version >= 400000 if (sysctl(oid_proc, 3, NULL, &len, NULL, 0) >= 0) -@@ -318,10 +321,6 @@ gkrellm_sys_proc_read_users(void) +@@ -318,10 +397,6 @@ gkrellm_sys_proc_read_users(void) #if __FreeBSD_version >= 300000 #include <devstat.h> static struct statinfo statinfo_cur; @@ -173,7 +279,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c #endif gchar * -@@ -479,11 +478,7 @@ gkrellm_sys_disk_init(void) +@@ -479,11 +554,7 @@ gkrellm_sys_disk_init(void) #include <netinet6/tcp6_var.h> #endif @@ -185,7 +291,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c #endif -@@ -582,7 +577,7 @@ gkrellm_sys_inet_read_tcp_data(void) +@@ -582,7 +653,7 @@ gkrellm_sys_inet_read_tcp_data(void) gint tcp_status; struct xinpgen *xig, *oxig; gchar *buf; @@ -194,7 +300,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c if (!initialized) { -@@ -655,17 +650,14 @@ gkrellm_sys_inet_init(void) +@@ -655,17 +726,14 @@ gkrellm_sys_inet_init(void) /* ===================================================================== */ /* Memory/Swap monitor interface */ @@ -213,7 +319,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c static struct nlist nl_mem[] = { #define N_CNT 0 { "_cnt" }, -@@ -687,17 +679,20 @@ static struct nlist nl_mem[] = { +@@ -687,17 +755,20 @@ static struct nlist nl_mem[] = { #endif { "" } }; @@ -238,7 +344,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c #else char *header; int hlen, nswap, nswdev, dmmax; -@@ -734,21 +729,37 @@ swapmode(guint64 *retavail, guint64 *ret +@@ -734,21 +805,37 @@ swapmode(guint64 *retavail, guint64 *ret } warning--; /* decrease counter, see end of function */ @@ -281,7 +387,16 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c if (kvm_read(kvmd, nl_mem[VM_NSWAP].n_value, &nswap, sizeof(nswap)) != sizeof(nswap)) return(0); -@@ -942,9 +953,9 @@ static struct mibtab mibs[] = { +@@ -898,7 +985,7 @@ get_bufspace(guint64 *bufspacep) + } + + if (sysctl(oid_bufspace, oid_bufspace_len, +- &bufspace, &bufspace_len, 0, 0) < 0) ++ &bufspace, &bufspace_len, NULL, 0) < 0) + return 0; + #endif + *bufspacep = bufspace; +@@ -942,9 +1029,9 @@ static struct mibtab mibs[] = { #endif static guint64 swapin, @@ -294,7 +409,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c void gkrellm_sys_mem_read_data(void) -@@ -954,15 +965,14 @@ gkrellm_sys_mem_read_data(void) +@@ -954,15 +1041,14 @@ gkrellm_sys_mem_read_data(void) static gint swappgsin = -1; static gint swappgsout = -1; gint dpagein, dpageout; @@ -313,7 +428,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c #endif #if 0 -@@ -981,60 +991,49 @@ gkrellm_sys_mem_read_data(void) +@@ -981,60 +1067,49 @@ gkrellm_sys_mem_read_data(void) } shared = 0; @@ -379,7 +494,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c } + for (i = 0; mibs[i].name; ++i) + if (sysctl(mibs[i].oid, mibs[i].oid_len, &mibs[i].value, -+ &mibs[i].value_len, 0, 0) < 0) ++ &mibs[i].value_len, NULL, 0) < 0) + return; + total = (mibs[MIB_V_PAGE_COUNT].value - + mibs[MIB_V_WIRE_COUNT].value) << pshift; @@ -411,7 +526,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c if (nl_mem[0].n_type == 0) if (kvm_nlist(kvmd, nl_mem) < 0 || nl_mem[0].n_type == 0) return; -@@ -1051,6 +1050,7 @@ gkrellm_sys_mem_read_data(void) +@@ -1051,6 +1126,7 @@ gkrellm_sys_mem_read_data(void) cached = sum.v_cache_count << pshift; used = x_used - buffers - cached; gkrellm_mem_assign_data(total, used, free, shared, buffers, cached); @@ -419,7 +534,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c if (swappgsin < 0) { dpagein = 0; -@@ -1058,11 +1058,12 @@ gkrellm_sys_mem_read_data(void) +@@ -1058,11 +1134,12 @@ gkrellm_sys_mem_read_data(void) } else { @@ -434,7 +549,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c if (dpagein > 0 || dpageout > 0 || first_time_done == 0) { -@@ -1090,8 +1091,8 @@ gkrellm_sys_mem_init(void) +@@ -1090,8 +1167,8 @@ gkrellm_sys_mem_init(void) /* ===================================================================== */ /* Battery monitor interface */ @@ -444,7 +559,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c #include <machine/apm_bios.h> #define APMDEV "/dev/apm" -@@ -1099,6 +1100,7 @@ gkrellm_sys_mem_init(void) +@@ -1099,6 +1176,7 @@ gkrellm_sys_mem_init(void) #define L_ON_LINE 1 #define L_CHARGING 3 #define L_UNKNOWN 0xFF @@ -452,7 +567,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c /* following two definitions are taken from sys/dev/acpica/acpiio.h */ #define ACPI_BATT_STAT_CHARGING 0x0002 -@@ -1125,16 +1127,18 @@ gkrellm_sys_battery_read_data(void) +@@ -1125,16 +1203,18 @@ gkrellm_sys_battery_read_data(void) size_t size; int acpi_info[4]; int i; @@ -473,7 +588,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c /* * XXX: Disable getting battery information via ACPI * to support multiple batteries via APM sim until -@@ -1174,6 +1178,7 @@ gkrellm_sys_battery_read_data(void) +@@ -1174,6 +1254,7 @@ gkrellm_sys_battery_read_data(void) return; } @@ -481,7 +596,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c if ((f = open(APMDEV, O_RDONLY)) == -1) return; if ((r = ioctl(f, APMIO_GETINFO, &info)) == -1) { -@@ -1231,6 +1236,7 @@ gkrellm_sys_battery_read_data(void) +@@ -1231,6 +1312,7 @@ gkrellm_sys_battery_read_data(void) #endif close(f); @@ -489,7 +604,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c } gboolean -@@ -1258,7 +1264,7 @@ gkrellm_sys_battery_init(void) +@@ -1258,7 +1340,7 @@ gkrellm_sys_battery_init(void) /* ===================================================================== */ /* Sensor monitor interface */ @@ -498,7 +613,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c typedef struct { -@@ -1286,7 +1292,6 @@ static VoltDefault voltdefault0[] = +@@ -1286,7 +1368,6 @@ static VoltDefault voltdefault0[] = }; #include <dirent.h> @@ -506,15 +621,16 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c #include <machine/cpufunc.h> #if __FreeBSD_version >= 500042 #include <dev/smbus/smb.h> -@@ -1298,6 +1303,7 @@ static VoltDefault voltdefault0[] = +@@ -1298,6 +1379,8 @@ static VoltDefault voltdefault0[] = #define INTERFACE_IO 0 #define INTERFACE_SMB 1 #define INTERFACE_ACPI 2 +#define INTERFACE_CORETEMP 3 /* Already in Celsius */ ++#define INTERFACE_AMDTEMP 4 /* Addresses to use for /dev/io */ #define WBIO1 0x295 -@@ -1331,7 +1337,7 @@ get_data(int iodev, u_char command, int +@@ -1331,7 +1414,7 @@ get_data(int iodev, u_char command, int struct smbcmd cmd; bzero(&cmd, sizeof(cmd)); @@ -523,7 +639,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c cmd.slave = 0x5a; cmd.cmd = command; if (ioctl(iodev, SMB_READB, (caddr_t)&cmd) == -1) -@@ -1357,6 +1363,8 @@ gkrellm_sys_sensors_get_temperature(gcha +@@ -1357,6 +1440,8 @@ gkrellm_sys_sensors_get_temperature(gcha { u_char byte; @@ -532,9 +648,13 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c if (interface == MBMON_INTERFACE) { -@@ -1366,15 +1374,24 @@ gkrellm_sys_sensors_get_temperature(gcha +@@ -1364,17 +1449,18 @@ gkrellm_sys_sensors_get_temperature(gcha + return gkrellm_sys_sensors_mbmon_get_value(path, temp); + } - if (interface == INTERFACE_ACPI) +- if (interface == INTERFACE_ACPI) ++ if (interface == INTERFACE_ACPI || interface == INTERFACE_CORETEMP || ++ interface == INTERFACE_AMDTEMP) { - int value; - size_t size = sizeof(value); @@ -543,33 +663,30 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c if (sysctlbyname(path, &value, &size, NULL, 0) < 0) return FALSE; if (temp) - *temp = (gfloat) TZ_KELVTOC(value); +- *temp = (gfloat) TZ_KELVTOC(value); ++ *temp = (interface == INTERFACE_CORETEMP) ? ++ (gfloat) value : (gfloat) TZ_KELVTOC(value); return TRUE; } + -+ if (interface == INTERFACE_CORETEMP) -+ { -+ size = sizeof(value); -+ if (sysctlbyname(path, &value, &size, NULL, 0) < 0) -+ return FALSE; -+ if (temp) -+ *temp = (gfloat) value; -+ return TRUE; -+ } -+ if (get_data(iodev, LM78_TEMP, interface, &byte)) { if (temp) -@@ -1447,7 +1464,7 @@ gkrellm_sys_sensors_init(void) - gchar mib_name[256], label[8]; +@@ -1444,10 +1530,10 @@ static GList *freebsd_sensor_list; + gboolean + gkrellm_sys_sensors_init(void) + { +- gchar mib_name[256], label[8]; ++ gchar mib_name[256], label[8], buf[BUFSIZ], *fmt; gint interface, id; - int oid_acpi_temp[CTL_MAXNAME + 2]; +- int oid_acpi_temp[CTL_MAXNAME + 2]; - size_t oid_acpi_temp_len = sizeof(oid_acpi_temp); -+ size_t oid_acpi_temp_len; ++ int oid[CTL_MAXNAME + 2]; ++ size_t oid_len, len; GList *list; struct freebsd_sensor *sensor; -@@ -1455,10 +1472,12 @@ gkrellm_sys_sensors_init(void) +@@ -1455,12 +1541,13 @@ gkrellm_sys_sensors_init(void) */ gkrellm_sys_sensors_mbmon_check(TRUE); @@ -580,27 +697,36 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c + { snprintf(mib_name, sizeof(mib_name), "hw.acpi.thermal.tz%d.temperature", id); -+ oid_acpi_temp_len = sizeof(oid_acpi_temp); - if (gk_sysctlnametomib(mib_name, oid_acpi_temp, - &oid_acpi_temp_len) < 0) +- if (gk_sysctlnametomib(mib_name, oid_acpi_temp, +- &oid_acpi_temp_len) < 0) ++ oid_len = sizeof(oid); ++ if (gk_sysctlnametomib(mib_name, oid, &oid_len) < 0) break; -@@ -1470,7 +1489,27 @@ gkrellm_sys_sensors_init(void) + interface = INTERFACE_ACPI; + if (!gkrellm_sys_sensors_get_temperature(mib_name, 0, 0, +@@ -1470,7 +1557,33 @@ gkrellm_sys_sensors_init(void) gkrellm_sensors_add_sensor(SENSOR_TEMPERATURE, NULL, mib_name, 0, 0, interface, 1.0, 0.0, NULL, label); - } + } + -+ /* Coretemp */ ++ /* Coretemp and Amdtemp */ + for (id = 0;; id++) + { + snprintf(mib_name, sizeof(mib_name), + "dev.cpu.%d.temperature", id); -+ oid_acpi_temp_len = sizeof(oid_acpi_temp); -+ if (gk_sysctlnametomib(mib_name, oid_acpi_temp, -+ &oid_acpi_temp_len) < 0) ++ oid_len = sizeof(oid) - sizeof(int) * 2; ++ if (gk_sysctlnametomib(mib_name, oid + 2, &oid_len) < 0) ++ break; ++ oid[0] = 0; ++ oid[1] = 4; ++ len = sizeof(buf); ++ if (sysctl(oid, oid_len + 2, buf, &len, 0, 0) < 0) + break; -+ interface = INTERFACE_CORETEMP; ++ fmt = (gchar *)(buf + sizeof(u_int)); ++ interface = (fmt[1] == 'K') ? ++ INTERFACE_AMDTEMP : INTERFACE_CORETEMP; + if (!gkrellm_sys_sensors_get_temperature(mib_name, 0, 0, + interface, NULL)) + continue; @@ -613,7 +739,7 @@ diff -u -p src/sysdeps/freebsd.c.orig src/sysdeps/freebsd.c if (freebsd_sensor_list) { -@@ -1504,13 +1543,7 @@ sensors_add_sensor(gint type, gchar *id_ +@@ -1504,13 +1617,7 @@ sensors_add_sensor(gint type, gchar *id_ sensor->factor = factor; sensor->offset = offset; sensor->default_label = default_label ? g_strdup(default_label) : NULL; |