- lm_sensors-r5993-fix-loading-of-cpuid-module.patch: Fix loading
of the cpuid module. - lm_sensors-r6016-handle-superio-wo-logdev.patch: Properly handle Super-I/O chips without logical device. - lm_sensors-r6017-fix-sysfs-detection.patch: libsensors: Change sysfs detection to survive upcoming kernel changes (bnc#751180). - lm_sensors-r6025-sensord-fix-memory-leaks.patch: sensord: Fix memory leaks revealed by valgrind (bnc#751177). - lm_sensors-r6030-fix-power-interval-output.patch: Fix power interval output. OBS-URL: https://build.opensuse.org/package/show/Base:System/sensors?expand=0&rev=46
This commit is contained in:
parent
a01dd7b703
commit
933f01c077
22
lm_sensors-r5993-fix-loading-of-cpuid-module.patch
Normal file
22
lm_sensors-r5993-fix-loading-of-cpuid-module.patch
Normal file
@ -0,0 +1,22 @@
|
||||
Fix loading of the cpuid module. On non-udev systems, or even on udev
|
||||
systems where /dev/cpu/0/cpuid is part of the static device node tree,
|
||||
the previous test would succeed even when the cpuid module isn't
|
||||
loaded, resulting in missing detections (of coretemp-supported CPU
|
||||
models in particuler.) Check if the module is loaded by looking in
|
||||
sysfs instead, this is much more reliable.
|
||||
|
||||
---
|
||||
prog/detect/sensors-detect | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- lm_sensors-3.3.1.orig/prog/detect/sensors-detect
|
||||
+++ lm_sensors-3.3.1/prog/detect/sensors-detect
|
||||
@@ -6636,7 +6636,7 @@ sub main
|
||||
"Do you want to scan for them? This is totally safe. (YES/no): ";
|
||||
unless (<STDIN> =~ /^\s*n/i) {
|
||||
# Load the cpuid driver if needed
|
||||
- unless (-e "/dev/cpu/$cpu[0]->{nr}/cpuid") {
|
||||
+ unless (-e "$sysfs_root/class/cpuid") {
|
||||
load_module("cpuid");
|
||||
udev_settle();
|
||||
}
|
20
lm_sensors-r6016-handle-superio-wo-logdev.patch
Normal file
20
lm_sensors-r6016-handle-superio-wo-logdev.patch
Normal file
@ -0,0 +1,20 @@
|
||||
Properly handle Super-I/O chips without logical device. Just report
|
||||
that we can't support the chip yet, instead of spitting I/O errors.
|
||||
|
||||
---
|
||||
prog/detect/sensors-detect | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- lm_sensors-3.3.1.orig/prog/detect/sensors-detect
|
||||
+++ lm_sensors-3.3.1/prog/detect/sensors-detect
|
||||
@@ -3747,6 +3747,10 @@ sub probe_superio
|
||||
print "\n (hardware monitoring capabilities accessible via SMBus only)\n";
|
||||
return FEAT_SMBUS;
|
||||
}
|
||||
+ if (!exists $chip->{logdev}) {
|
||||
+ print "\n (no support yet)\n";
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
# Switch to the sensor logical device
|
||||
outb($addrreg, $superio{logdevreg});
|
43
lm_sensors-r6017-fix-sysfs-detection.patch
Normal file
43
lm_sensors-r6017-fix-sysfs-detection.patch
Normal file
@ -0,0 +1,43 @@
|
||||
References: bnc#751180
|
||||
|
||||
Upcoming change in sysfs will break the way libsensors detects if
|
||||
sysfs is mounted. Adjust the implementation so that it still works after
|
||||
said change.
|
||||
|
||||
---
|
||||
lib/sysfs.c | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
--- lm_sensors-3.3.1.orig/lib/sysfs.c
|
||||
+++ lm_sensors-3.3.1/lib/sysfs.c
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
+#include <sys/vfs.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@@ -40,6 +41,7 @@
|
||||
/****************************************************************************/
|
||||
|
||||
#define ATTR_MAX 128
|
||||
+#define SYSFS_MAGIC 0x62656572
|
||||
|
||||
/*
|
||||
* Read an attribute from sysfs
|
||||
@@ -585,11 +587,11 @@ exit_free:
|
||||
/* returns !0 if sysfs filesystem was found, 0 otherwise */
|
||||
int sensors_init_sysfs(void)
|
||||
{
|
||||
- struct stat statbuf;
|
||||
+ struct statfs statfsbuf;
|
||||
|
||||
snprintf(sensors_sysfs_mount, NAME_MAX, "%s", "/sys");
|
||||
- if (stat(sensors_sysfs_mount, &statbuf) < 0
|
||||
- || statbuf.st_nlink <= 2) /* Empty directory */
|
||||
+ if (statfs(sensors_sysfs_mount, &statfsbuf) < 0
|
||||
+ || statfsbuf.f_type != SYSFS_MAGIC)
|
||||
return 0;
|
||||
|
||||
return 1;
|
70
lm_sensors-r6025-sensord-fix-memory-leaks.patch
Normal file
70
lm_sensors-r6025-sensord-fix-memory-leaks.patch
Normal file
@ -0,0 +1,70 @@
|
||||
References: bnc#751177
|
||||
|
||||
Fix memory leaks in sensord revealed by valgrind.
|
||||
|
||||
The leak in daemonize() is harmless, we're about to exit anyway. Fix
|
||||
it still to make valgrind happy.
|
||||
|
||||
The leak in do_features() is real, as the function is called
|
||||
periodically by the daemon, for all actions. If the intervals at set
|
||||
low and the system has many sensors, the leak could be significant,
|
||||
maybe 150 kB/day.
|
||||
|
||||
---
|
||||
prog/sensord/sense.c | 22 +++++++++++++---------
|
||||
prog/sensord/sensord.c | 6 +++++-
|
||||
2 files changed, 18 insertions(+), 10 deletions(-)
|
||||
|
||||
--- lm_sensors-3.3.1.orig/prog/sensord/sense.c
|
||||
+++ lm_sensors-3.3.1/prog/sensord/sense.c
|
||||
@@ -132,14 +132,7 @@ static int do_features(const sensors_chi
|
||||
const FeatureDescriptor *feature, int action)
|
||||
{
|
||||
char *label;
|
||||
- int alrm, beep;
|
||||
-
|
||||
- label = sensors_get_label(chip, feature->feature);
|
||||
- if (!label) {
|
||||
- sensorLog(LOG_ERR, "Error getting sensor label: %s/%s",
|
||||
- chip->prefix, feature->feature->name);
|
||||
- return -1;
|
||||
- }
|
||||
+ int alrm, beep, ret;
|
||||
|
||||
alrm = get_flag(chip, feature->alarmNumber);
|
||||
if (alrm == -1)
|
||||
@@ -151,7 +144,18 @@ static int do_features(const sensors_chi
|
||||
if (beep == -1)
|
||||
return -1;
|
||||
|
||||
- return get_features(chip, feature, action, label, alrm, beep);
|
||||
+ label = sensors_get_label(chip, feature->feature);
|
||||
+ if (!label) {
|
||||
+ sensorLog(LOG_ERR, "Error getting sensor label: %s/%s",
|
||||
+ chip->prefix, feature->feature->name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ ret = get_features(chip, feature, action, label, alrm, beep);
|
||||
+
|
||||
+ free(label);
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
static int doKnownChip(const sensors_chip_name *chip,
|
||||
--- lm_sensors-3.3.1.orig/prog/sensord/sensord.c
|
||||
+++ lm_sensors-3.3.1/prog/sensord/sensord.c
|
||||
@@ -204,7 +204,11 @@ static void daemonize(void)
|
||||
} else if (pid != 0) {
|
||||
fprintf(file, "%d\n", pid);
|
||||
fclose(file);
|
||||
- unloadLib();
|
||||
+
|
||||
+ freeChips();
|
||||
+ if (unloadLib())
|
||||
+ exit(EXIT_FAILURE);
|
||||
+
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
39
lm_sensors-r6030-fix-power-interval-output.patch
Normal file
39
lm_sensors-r6030-fix-power-interval-output.patch
Normal file
@ -0,0 +1,39 @@
|
||||
Fix power interval output
|
||||
|
||||
Power interval is measured in seconds, not Watt.
|
||||
|
||||
---
|
||||
prog/sensors/chips.c | 20 +++++++++++++++++---
|
||||
1 file changed, 17 insertions(+), 3 deletions(-)
|
||||
|
||||
--- lm_sensors-3.3.1.orig/prog/sensors/chips.c
|
||||
+++ lm_sensors-3.3.1/prog/sensors/chips.c
|
||||
@@ -564,11 +564,25 @@ static void print_chip_power(const senso
|
||||
} else
|
||||
printf(" N/A ");
|
||||
|
||||
- for (i = 0; i < sensor_count; i++)
|
||||
- scale_value(&sensors[i].value, &sensors[i].unit);
|
||||
+ for (i = 0; i < sensor_count; i++) {
|
||||
+ /*
|
||||
+ * Unit is W and needs to be scaled for all attributes except
|
||||
+ * interval, which does not need to be scaled and is reported in
|
||||
+ * seconds.
|
||||
+ */
|
||||
+ if (strcmp(sensors[i].name, "interval")) {
|
||||
+ char *tmpstr;
|
||||
|
||||
+ tmpstr = alloca(4);
|
||||
+ scale_value(&sensors[i].value, &unit);
|
||||
+ snprintf(tmpstr, 4, "%sW", unit);
|
||||
+ sensors[i].unit = tmpstr;
|
||||
+ } else {
|
||||
+ sensors[i].unit = "s";
|
||||
+ }
|
||||
+ }
|
||||
print_limits(sensors, sensor_count, alarms, alarm_count,
|
||||
- label_size, "%s = %6.2f %sW");
|
||||
+ label_size, "%s = %6.2f %s");
|
||||
|
||||
printf("\n");
|
||||
}
|
@ -1,3 +1,17 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Mar 8 10:35:17 CET 2012 - jdelvare@suse.de
|
||||
|
||||
- lm_sensors-r5993-fix-loading-of-cpuid-module.patch: Fix loading
|
||||
of the cpuid module.
|
||||
- lm_sensors-r6016-handle-superio-wo-logdev.patch: Properly handle
|
||||
Super-I/O chips without logical device.
|
||||
- lm_sensors-r6017-fix-sysfs-detection.patch: libsensors: Change
|
||||
sysfs detection to survive upcoming kernel changes (bnc#751180).
|
||||
- lm_sensors-r6025-sensord-fix-memory-leaks.patch: sensord: Fix
|
||||
memory leaks revealed by valgrind (bnc#751177).
|
||||
- lm_sensors-r6030-fix-power-interval-output.patch: Fix power
|
||||
interval output.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jan 17 12:50:05 CET 2012 - jdelvare@suse.de
|
||||
|
||||
|
10
sensors.spec
10
sensors.spec
@ -37,6 +37,11 @@ Patch3: lm_sensors-3.0.0-sysconfig_metadata.patch
|
||||
Patch4: lm_sensors-3.0.3-hint-at-kernel-extra-package.patch
|
||||
Patch5: lm_sensors-r5991-improve-filtering-of-fake-DMI-data.patch
|
||||
Patch6: lm_sensors-r5992-print-DMI-product-version.patch
|
||||
Patch7: lm_sensors-r5993-fix-loading-of-cpuid-module.patch
|
||||
Patch8: lm_sensors-r6016-handle-superio-wo-logdev.patch
|
||||
Patch9: lm_sensors-r6017-fix-sysfs-detection.patch
|
||||
Patch10: lm_sensors-r6025-sensord-fix-memory-leaks.patch
|
||||
Patch11: lm_sensors-r6030-fix-power-interval-output.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
ExcludeArch: s390 s390x
|
||||
@ -141,6 +146,11 @@ Authors:
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
|
||||
%build
|
||||
RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
|
||||
|
Loading…
x
Reference in New Issue
Block a user