PERFORCE change 126232 for review

Constantine A. Murenin cnst at FreeBSD.org
Sun Sep 9 11:43:34 PDT 2007


http://perforce.freebsd.org/chv.cgi?CH=126232

Change 126232 by cnst at dale on 2007/09/09 18:42:58

	workaround, so that invalid values are not printed
	
	
	before:
	
	%sysctl hw.sensors
	hw.sensors.lm0.volt0: 1.23 VDC (VCore)
	hw.sensors.lm0.volt1: 12.30 VDC (+12V)
	hw.sensors.lm0.volt2: 3.33 VDC (+3.3V)
	hw.sensors.lm0.volt3: 3.31 VDC (+3.3V)
	hw.sensors.lm0.volt4: -45.19 VDC (-12V)
	hw.sensors.lm0.volt5: 1.58 VDC
	hw.sensors.lm0.volt6: 0.10 VDC
	hw.sensors.lm0.volt7: 3.31 VDC (3.3VSB)
	hw.sensors.lm0.volt8: 1.02 VDC (VBAT)
	hw.sensors.lm0.temp0: 58.00 degC
	hw.sensors.lm0.temp1: 23.00 degC
	hw.sensors.lm0.temp2: -273.15 degC
	hw.sensors.lm0.fan0: 0 RPM
	hw.sensors.lm0.fan1: 897 RPM
	hw.sensors.lm0.fan2: 0 RPM
	hw.sensors.cpu0.temp0: 27.00 degC
	hw.sensors.cpu1.temp0: 27.00 degC
	%
	
	
	now:
	
	dale# ./sysctl hw.sensors
	hw.sensors.lm0.volt0: 1.23 VDC (VCore)
	hw.sensors.lm0.volt1: 12.30 VDC (+12V)
	hw.sensors.lm0.volt2: 3.33 VDC (+3.3V)
	hw.sensors.lm0.volt3: 3.31 VDC (+3.3V)
	hw.sensors.lm0.volt4: -45.19 VDC (-12V)
	hw.sensors.lm0.volt5: 1.58 VDC
	hw.sensors.lm0.volt6: 0.10 VDC
	hw.sensors.lm0.volt7: 3.31 VDC (3.3VSB)
	hw.sensors.lm0.volt8: 1.02 VDC (VBAT)
	hw.sensors.lm0.temp0: 58.00 degC
	hw.sensors.lm0.temp1: 24.00 degC
	hw.sensors.lm0.temp2: invalid
	hw.sensors.lm0.fan0: invalid
	hw.sensors.lm0.fan1: 897 RPM
	hw.sensors.lm0.fan2: invalid
	hw.sensors.cpu0.temp0: 27.00 degC
	hw.sensors.cpu1.temp0: 28.00 degC
	dale# 
	
	
	And this is how it always was and is in systat(1)
	(and ideally how it should be in sysctl(8)):
	
	%systat -sensors
	                    /0   /1   /2   /3   /4   /5   /6   /7   /8   /9   /10
	     Load Average   |
	
	Sensor                            Value      Status       Description
	lm0.temp0                    58.00 degC
	lm0.temp1                    24.00 degC
	lm0.fan1                        892 RPM
	lm0.volt0                     1.23 V DC                   (VCore)
	lm0.volt1                    12.30 V DC                   (+12V)
	lm0.volt2                     3.33 V DC                   (+3.3V)
	lm0.volt3                     3.31 V DC                   (+3.3V)
	lm0.volt4                   -45.19 V DC                   (-12V)
	lm0.volt5                     1.58 V DC
	lm0.volt6                     0.10 V DC
	lm0.volt7                     3.31 V DC                   (3.3VSB)
	lm0.volt8                     1.02 V DC                   (VBAT)
	cpu0.temp0                   27.00 degC
	cpu1.temp0                   28.00 degC

Affected files ...

.. //depot/projects/soc2007/cnst-sensors/sbin.sysctl/sysctl.c#9 edit

Differences ...

==== //depot/projects/soc2007/cnst-sensors/sbin.sysctl/sysctl.c#9 (text+ko) ====

@@ -418,7 +418,14 @@
 		return (1);
 	}
 
-	if (s->flags & SENSOR_FUNKNOWN)
+	if (s->flags & SENSOR_FINVALID)
+		/*
+		 * XXX: with this flag, the node should be entirely ignored,
+		 * but as the magic-based sysctl(8) is not too flexible, we
+		 * simply have to print out that the sensor is invalid.
+		 */
+		printf("invalid");
+	else if (s->flags & SENSOR_FUNKNOWN)
 		printf("unknown");
 	else {
 		switch (s->type) {


More information about the p4-projects mailing list