From 21c6e78ea76156c007b7b36f2ef60b4fffd62f50 Mon Sep 17 00:00:00 2001 From: netchild Date: Mon, 15 Oct 2007 20:00:24 +0000 Subject: Backout sensors framework. Requested by: phk Discussed on: cvs-all --- sbin/sysctl/sysctl.8 | 1 - sbin/sysctl/sysctl.c | 140 --------------------------------------------------- 2 files changed, 141 deletions(-) (limited to 'sbin/sysctl') diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8 index 1e656ad..942fd7c 100644 --- a/sbin/sysctl/sysctl.8 +++ b/sbin/sysctl/sysctl.8 @@ -215,7 +215,6 @@ denote .It "hw.floatingpoint integer no .It "hw.machine_arch string no .It "hw.realmem integer no -.It "hw.sensors.. struct no .It "machdep.console_device dev_t no .It "machdep.adjkerntz integer yes .It "machdep.disable_rtc_set integer yes diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index e4aa86b..9dcfcb0 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -44,7 +44,6 @@ static const char rcsid[] = #include #include #include -#include #include #include #include @@ -409,143 +408,6 @@ S_vmtotal(int l2, void *p) } static int -S_sensor(int l2, void *p) -{ - struct sensor *s = (struct sensor *)p; - - if (l2 != sizeof(*s)) { - warnx("S_sensor %d != %d", l2, sizeof(*s)); - return (1); - } - - 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"); - return (0); - } - - if (s->flags & SENSOR_FUNKNOWN) - printf("unknown"); - else { - switch (s->type) { - case SENSOR_TEMP: - printf("%.2f degC", - (s->value - 273150000) / 1000000.0); - break; - case SENSOR_FANRPM: - printf("%lld RPM", s->value); - break; - case SENSOR_VOLTS_DC: - printf("%.2f VDC", s->value / 1000000.0); - break; - case SENSOR_AMPS: - printf("%.2f A", s->value / 1000000.0); - break; - case SENSOR_WATTHOUR: - printf("%.2f Wh", s->value / 1000000.0); - break; - case SENSOR_AMPHOUR: - printf("%.2f Ah", s->value / 1000000.0); - break; - case SENSOR_INDICATOR: - printf("%s", s->value ? "On" : "Off"); - break; - case SENSOR_INTEGER: - printf("%lld", s->value); - break; - case SENSOR_PERCENT: - printf("%.2f%%", s->value / 1000.0); - break; - case SENSOR_LUX: - printf("%.2f lx", s->value / 1000000.0); - break; - case SENSOR_DRIVE: - { - const char *name; - - switch (s->value) { - case SENSOR_DRIVE_EMPTY: - name = "empty"; - break; - case SENSOR_DRIVE_READY: - name = "ready"; - break; - case SENSOR_DRIVE_POWERUP: - name = "powering up"; - break; - case SENSOR_DRIVE_ONLINE: - name = "online"; - break; - case SENSOR_DRIVE_IDLE: - name = "idle"; - break; - case SENSOR_DRIVE_ACTIVE: - name = "active"; - break; - case SENSOR_DRIVE_REBUILD: - name = "rebuilding"; - break; - case SENSOR_DRIVE_POWERDOWN: - name = "powering down"; - break; - case SENSOR_DRIVE_FAIL: - name = "failed"; - break; - case SENSOR_DRIVE_PFAIL: - name = "degraded"; - break; - default: - name = "unknown"; - break; - } - printf(name); - break; - } - case SENSOR_TIMEDELTA: - printf("%.6f secs", s->value / 1000000000.0); - break; - default: - printf("unknown"); - } - } - - if (s->desc[0] != '\0') - printf(" (%s)", s->desc); - - switch (s->status) { - case SENSOR_S_UNSPEC: - break; - case SENSOR_S_OK: - printf(", OK"); - break; - case SENSOR_S_WARN: - printf(", WARNING"); - break; - case SENSOR_S_CRIT: - printf(", CRITICAL"); - break; - case SENSOR_S_UNKNOWN: - printf(", UNKNOWN"); - break; - } - - if (s->tv.tv_sec) { - time_t t = s->tv.tv_sec; - char ct[26]; - - ctime_r(&t, ct); - ct[19] = '\0'; - printf(", %s.%03ld", ct, s->tv.tv_usec / 1000); - } - - return (0); -} - -static int T_dev_t(int l2, void *p) { dev_t *d = (dev_t *)p; @@ -816,8 +678,6 @@ show_var(int *oid, int nlen) func = S_loadavg; else if (strcmp(fmt, "S,vmtotal") == 0) func = S_vmtotal; - else if (strcmp(fmt, "S,sensor") == 0) - func = S_sensor; else if (strcmp(fmt, "T,dev_t") == 0) func = T_dev_t; else -- cgit v1.1