found, rather maintain a global counter for all sensors that are unique,
and use this global to get the correct index in the array.
- Use prop_array_set() rather than prop_array_add() for adding dictionaries
into our global array. Thanks to yamt@.
- Overwrite the sensor index in the first sensor of a device, to avoid
a problem with LKMs where the first sensor gets the index of all edata
structures allocated in kernel.
- Add missing proto for sme_register_sensorname().
All them fix another part of yamt@'s PR.
there are no more events.
- Add sme_event_unregister_all() to remove all events associated with
a device and use it in sysmon_envsys_unregister() to fix a "use-after-free".
- Check return error of sme_sensor_upfoo() in sme_make_dictionary() and
return it rather than 0 all the time.
- Add more KASSERTS.
- sme_register_sensorname: there's no need to handle empty list case.
- 'obj' argument in sme_sensor_upstring and similar functions is useless:
removed the obj argument from the functions, it's handled in the function
itself now.
- check for more errors in sme_make_dictionary() and
sysmon_envsys_createplist().
own file, and DO NOT MAKE THEM inline AS IT IS WRONG.
Looks like I'm very stupid and I didn't know what inline meant.
Thank you very much YAMAMOTO Takashi.
create any dictionary if it's duplicated. Only the first sensor that has
a unique description will be added.
Remove all elements from the list at sysmon_envsys_unregister() time and
free resources associated with it.
if the description of it is not unique, mark the sensor with
ENVSYS_FDUPDESC, return EEXIST and continue.
Also, when changing a description, check that the new description is not
assigned by any other sensor, otherwise return EEXIST.
Note that these restrictions are only per device. Fixes PR kern/36660.
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.
so enable it. This will allow to set a min/max limit for the
macppc/battery.c driver, which uses an integer sensor to report the
battery capacity.
Indicator/Integer sensors will share the /etc/power/scripts/sensor_indicator
script to report the events.
WQ_PERCPU flag for workqueue and additional argument for workqueue_enqueue()
to assign a CPU might be used. Notes:
- For now, the list is used for workqueue_queue, which is non-optimal,
and will be changed with array, where index would be CPU ID.
- The data structures should be changed to be cache-friendly.
Reviewed by: <yamt>, <tech-kern>
state. Enable all sensors by default as valid and current valid data and
if there is one that is in invalid state, mark current data as not valid.
This matches the behaviour with the old API. Also, this fixes the problem
with ipmi(4) reporting bogus values with sensors in invalid state using
the old envstat(8).
Note that this only happened when using the old envstat(8).
configurable via sysctl. By default it uses 10 seconds, but it can be changed
between 1 second and 5 minutes.
$ sysctl -d kern.envsys
kern.envsys.refresh_value: wait time in seconds to refresh sensors being monitored
$
- Check the error returned by sme_event_add() and print details if
returned value is not EEXIST.
- If sme_event_add() returned an error, don't add the monitoring-* object
into the dictionary.
(Part 1: API)
* 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).
Patch by Slava Semushin <slava.semushin@gmail.com>
Again, this was tested by comparing obj files from a pristine and a patched
source tree against an i386/ALL kernel, and also for src/sbin/fsck_ffs,
src/sbin/fsdb and src/usr.sbin/makefs. Only changes in assert() line numbers
were detected in 'objdump -d' output.
changes the "tickle" model of wdogctl(8), it was modified as well;
while I was in there, I cleaned up the argument parsing.
The code was reviewed by simonb@.
instead of keeping sysmon_envsys_list_slock spinlock held
because some drivers might sleep in sysmon_envsys ops,
XXX sysmon_envsys_lock is now redundant
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
Right now, only power switch state change events are supported. This
is a work-in-progress.
* Add support to sysmon for delivering power mangement events to userland.
Add poll, kqueue, and read entry points to sysmon.
* Adapt ACPI to use the new generic <sys/power.h> event types.
This provides the kernel support for a forthcoming powerd(8) which can
do nice things like gracefully shut the system down when an ACPI power
button is pressed.
provide some VERY basic support for power/sleep buttons and lid switches;
if someone presses the power button, shut down the system semi-gracefully.
Eventually, we will send events for all types of button/lid events down
to a userland power management daemon, which will be able to define a
separate policy for each button/switch.
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals
kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)
based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
This merge changes the device switch tables from static array to
dynamically generated by config(8).
- All device switches is defined as a constant structure in device drivers.
- The new grammer ``device-major'' is introduced to ``files''.
device-major <prefix> char <num> [block <num>] [<rules>]
- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.
- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.
- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.
- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.
- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
device file is closed, rather on every descriptor close. Instead of
getting the exclusive lock on open and releasing on close, get
the lock only when needed in sysmonioctl_envsys().
Fixes kern/14368 by Anthony Mallet. Okayed by Jason Thorpe.
While here, also inline sysmon_envsys_init() to sysmonopen_envsys(),
and g/c sysmonioctl_wdog() prototype.
such as the LM78 and VT82C686A (and eventually ACPI). Multiple
sensor devices can be hooked registered with `sysmon', and eventually
sysmon will also handle hardware (and software) watchdog timers.
Convert the `lm' and `viaenv' drivers to the new interface.