ENVSYS_GSTRING (aka Generic String) uses the genstr member in
the envsys_data_t struct to add a generic string that envstat(8)
will show as value or state.
It's like the ENVSYS_DRIVER, but doesn't use value_cur. Below
is the dictionary created on these sensors:
<dict>
<key>description</key>
<string>acpibat0 charge state</string>
<key>generic-state-string</key>
<string>NORMAL</string>
<key>monitoring-supported</key>
<false/>
<key>state</key>
<string>valid</string>
<key>type</key>
<string>Generic string</string>
</dict>
Note that it's limited to 32 chars, but we can grow it if needed.
envstat(8) will print ENVSYS_GSTRING sensors as:
$ envstat -dacpibat0 -s"acpibat0 charge state"
acpibat0 charge state: NORMAL
$
in the /dev/sysmon device.
Use O_RDONLY for ENVSYS_GETDICTIONARY and O_RDWR for ENVSYS_SETDICTIONARY
in envstat(8).
Fixes PR kern/36661 by YAMAMOTO Takashi.
the analysis. Closes PR bin/36636.
- Also use the longest string for the column alignment counting all
sensors available from all devices, not per-device.
Thanks to rmind@ for help.
with an asterisk, as was suggested by Greg. A. Woods.
Example:
$ ./envstat -dlm0 -s "CPU Fan,System Fan,Aux Fan"
System Fan: *
CPU Fan: 1308 RPM
Aux Fan: *
$
Except Integer and Driver sensors, which shouldn't need that.
(Part 3: userland)
* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
sysmon_power(9) and powerd(8), that means there is no 32 bytes event
size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.
Tested by:
blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
device controllers, and more specifically raid controllers.
Add a new sensor type, ENVSYS_DRIVE, to report drive status. From OpenBSD.
Add bio and sysmon support to mfi(4). This allow userland to query
status for drives and logical volumes attached to a mfi(4) controller. While
there fix some debug printfs in mfi so they compile.
Add bio(4) to amd64 and i386 GENERIC.
- use size_t where appropriate
- use err/warn instead of printf, and don't hide the error messages from ioctl.
- keep units in sync (someone added integer in the header file and forgot
to update envsys.c)