From owner-p4-projects@FreeBSD.ORG Sun Sep 9 18:43:34 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0B58116A468; Sun, 9 Sep 2007 18:43:34 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1EC316A421 for ; Sun, 9 Sep 2007 18:43:33 +0000 (UTC) (envelope-from cnst@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 9028513C469 for ; Sun, 9 Sep 2007 18:43:33 +0000 (UTC) (envelope-from cnst@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l89IhX2g064443 for ; Sun, 9 Sep 2007 18:43:33 GMT (envelope-from cnst@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l89IhX6o064440 for perforce@freebsd.org; Sun, 9 Sep 2007 18:43:33 GMT (envelope-from cnst@FreeBSD.org) Date: Sun, 9 Sep 2007 18:43:33 GMT Message-Id: <200709091843.l89IhX6o064440@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to cnst@FreeBSD.org using -f From: "Constantine A. Murenin" To: Perforce Change Reviews Cc: Subject: PERFORCE change 126232 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Sep 2007 18:43:34 -0000 http://perforce.freebsd.org/chv.cgi?CH=126232 Change 126232 by cnst@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) {