diff --git a/lm_sensors-r5993-fix-loading-of-cpuid-module.patch b/lm_sensors-r5993-fix-loading-of-cpuid-module.patch new file mode 100644 index 0000000..bb47fe2 --- /dev/null +++ b/lm_sensors-r5993-fix-loading-of-cpuid-module.patch @@ -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 ( =~ /^\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(); + } diff --git a/lm_sensors-r6016-handle-superio-wo-logdev.patch b/lm_sensors-r6016-handle-superio-wo-logdev.patch new file mode 100644 index 0000000..720a2f4 --- /dev/null +++ b/lm_sensors-r6016-handle-superio-wo-logdev.patch @@ -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}); diff --git a/lm_sensors-r6017-fix-sysfs-detection.patch b/lm_sensors-r6017-fix-sysfs-detection.patch new file mode 100644 index 0000000..f7445e6 --- /dev/null +++ b/lm_sensors-r6017-fix-sysfs-detection.patch @@ -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 + #include ++#include + #include + #include + #include +@@ -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; diff --git a/lm_sensors-r6025-sensord-fix-memory-leaks.patch b/lm_sensors-r6025-sensord-fix-memory-leaks.patch new file mode 100644 index 0000000..f115af4 --- /dev/null +++ b/lm_sensors-r6025-sensord-fix-memory-leaks.patch @@ -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); + } + diff --git a/lm_sensors-r6030-fix-power-interval-output.patch b/lm_sensors-r6030-fix-power-interval-output.patch new file mode 100644 index 0000000..5ddca4d --- /dev/null +++ b/lm_sensors-r6030-fix-power-interval-output.patch @@ -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"); + } diff --git a/sensors.changes b/sensors.changes index 4128032..a909309 100644 --- a/sensors.changes +++ b/sensors.changes @@ -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 diff --git a/sensors.spec b/sensors.spec index e592f89..65d0ee8 100644 --- a/sensors.spec +++ b/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"