summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authornetchild <netchild@FreeBSD.org>2007-10-14 10:45:31 +0000
committernetchild <netchild@FreeBSD.org>2007-10-14 10:45:31 +0000
commit4af9918bc0e8f388ffda416ed716c9b17ca6c0fd (patch)
treee7d76e2d64fce20db3bf8837259e3d37e4f7d3ec /share
parent57a6302920d738a0f943ec56aa7d87683e443246 (diff)
downloadFreeBSD-src-4af9918bc0e8f388ffda416ed716c9b17ca6c0fd.zip
FreeBSD-src-4af9918bc0e8f388ffda416ed716c9b17ca6c0fd.tar.gz
Import OpenBSD's sysctl hardware sensors framework.
This commit includes the following core components: * sample configuration file for sensorsd * rc(8) script and glue code for sensorsd(8) * sysctl(3) doc fixes for CTL_HW tree * sysctl(3) documentation for hardware sensors * sysctl(8) documentation for hardware sensors * support for the sensor structure for sysctl(8) * rc.conf(5) documentation for starting sensorsd(8) * sensor_attach(9) et al documentation * /sys/kern/kern_sensors.c o sensor_attach(9) API for drivers to register ksensors o sensor_task_register(9) API for the update task o sysctl(3) glue code o hw.sensors shadow tree for sysctl(8) internal magic * <sys/sensors.h> * HW_SENSORS definition for <sys/sysctl.h> * sensors display for systat(1), including documentation * sensorsd(8) and all applicable documentation The userland part of the framework is entirely source-code compatible with OpenBSD 4.1, 4.2 and -current as of today. All sensor readings can be viewed with `sysctl hw.sensors`, monitored in semi-realtime with `systat -sensors` and also logged with `sensorsd`. Submitted by: Constantine A. Murenin <cnst@FreeBSD.org> Sponsored by: Google Summer of Code 2007 (GSoC2007/cnst-sensors) Mentored by: syrinx Tested by: many OKed by: kensmith Obtained from: OpenBSD (parts)
Diffstat (limited to 'share')
-rw-r--r--share/man/man5/rc.conf.519
-rw-r--r--share/man/man9/Makefile8
-rw-r--r--share/man/man9/sensor_attach.9155
3 files changed, 181 insertions, 1 deletions
diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5
index 02c6432..9415fce 100644
--- a/share/man/man5/rc.conf.5
+++ b/share/man/man5/rc.conf.5
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 3, 2007
+.Dd September 13, 2007
.Dt RC.CONF 5
.Os
.Sh NAME
@@ -222,6 +222,22 @@ is set to
these are the flags to pass to the
.Xr powerd 8
daemon.
+.It Va sensorsd_enable
+.Pq Vt bool
+Set to
+.Dq Li NO
+by default.
+Setting this to
+.Dq Li YES
+enables
+.Xr sensorsd 8 ,
+a sensors monitoring and logging daemon.
+.It Va sensorsd_flags
+.Pq Vt str
+Empty by default.
+This variable contains additional flags passed to the
+.Xr sensorsd 8
+program.
.It Va tmpmfs
Controls the creation of a
.Pa /tmp
@@ -3886,6 +3902,7 @@ enable support for sound mixer.
.Xr rpc.statd 8 ,
.Xr rwhod 8 ,
.Xr savecore 8 ,
+.Xr sensorsd 8 ,
.Xr sshd 8 ,
.Xr swapon 8 ,
.Xr sysctl 8 ,
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index bf6bcad..68a6ffe 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -209,6 +209,7 @@ MAN= accept_filter.9 \
securelevel_gt.9 \
selrecord.9 \
sema.9 \
+ sensor_attach.9 \
sf_buf.9 \
signal.9 \
sleep.9 \
@@ -975,6 +976,13 @@ MLINKS+=sema.9 sema_destroy.9 \
sema.9 sema_trywait.9 \
sema.9 sema_value.9 \
sema.9 sema_wait.9
+MLINKS+=sensor_attach.9 sensordev_install.9 \
+ sensor_attach.9 sensordev_deinstall.9 \
+ sensor_attach.9 sensor_detach.9 \
+ sensor_attach.9 ksensordev.9 \
+ sensor_attach.9 ksensor.9 \
+ sensor_attach.9 sensor_task_register.9 \
+ sensor_attach.9 sensor_task_unregister.9
MLINKS+=sf_buf.9 sf_buf_alloc.9 \
sf_buf.9 sf_buf_free.9 \
sf_buf.9 sf_buf_kva.9 \
diff --git a/share/man/man9/sensor_attach.9 b/share/man/man9/sensor_attach.9
new file mode 100644
index 0000000..ce4bb20
--- /dev/null
+++ b/share/man/man9/sensor_attach.9
@@ -0,0 +1,155 @@
+.\" $FreeBSD$
+.\" $OpenBSD: sensor_attach.9,v 1.4 2007/03/22 16:55:31 deraadt Exp $
+.\"
+.\" Copyright (c) 2006 Michael Knudsen <mk@openbsd.org>
+.\" Copyright (c) 2006 Constantine A. Murenin <cnst+openbsd@bugmail.mojo.ru>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd 19 August 2007
+.Dt SENSOR_ATTACH 9
+.Os
+.Sh NAME
+.Nm sensor_attach ,
+.Nm sensor_detach ,
+.Nm sensordev_install ,
+.Nm sensordev_deinstall ,
+.Nm sensor_task_register ,
+.Nm sensor_task_unregister
+.Nd sensors framework
+.Sh SYNOPSIS
+.In sys/sensors.h
+.Ft void
+.Fn "sensordev_install" "struct ksensordev *sensdev"
+.Ft void
+.Fn "sensordev_deinstall" "struct ksensordev *sensdev"
+.Pp
+.Ft void
+.Fn "sensor_attach" "struct ksensordev *sensdev" "struct ksensor *sens"
+.Ft void
+.Fn "sensor_detach" "struct ksensordev *sensdev" "struct ksensor *sens"
+.Pp
+.Ft int
+.Fn "sensor_task_register" "void *arg" "void (*func)(void *)" "int period"
+.Ft void
+.Fn "sensor_task_unregister" "void *arg"
+.Sh DESCRIPTION
+The
+sensors
+framework API provides a mechanism for manipulation of hardware sensors
+that are available under the
+.Va hw.sensors
+.Xr sysctl 8
+tree.
+.Pp
+.Fn sensor_attach
+adds the sensor specified by the
+.Pa sens
+argument to the sensor device specified by the
+.Pa sensdev
+argument.
+.Fn sensor_detach
+can be used to remove sensors previously added by
+.Fn sensor_attach .
+.Pp
+.Fn sensordev_install
+registers the sensor device specified by the
+.Pa sensdev
+argument so that all sensors that are attached to the device become
+accessible via the sysctl interface.
+.Fn sensordev_deinstall
+can be used to remove sensor devices previously registered by
+.Fn sensordev_install .
+.Pp
+Drivers are responsible for retrieving, interpreting and normalising
+sensor values and updating the sensor struct periodically.
+If the driver needs process context, for example to sleep, it can
+register a task with the sensor framework.
+.Pp
+.Fn sensor_task_register
+is used to register a periodic task to update sensors.
+The
+.Fa func
+argument is a pointer to the function to run with an interval of
+.Fa period
+seconds.
+The
+.Fa arg
+parameter is the argument given to the
+.Fa func
+function.
+The
+.Fn sensor_task_unregister
+removes all tasks previously registered with
+.Fn sensor_task_register
+with an argument of
+.Fa arg .
+.Sh COMPATIBILITY
+.Ss sensor_task
+The
+.Fn sensor_task_register
+and
+.Fn sensor_task_unregister
+functions that are included in
+.Ox 4.2
+and later
+are not compatible with
+.Fx .
+.Fx
+includes an implementation that is similar and compatible
+with an earlier version of
+these
+.Va sensor_task
+functions that was available from
+.Ox 3.9
+until
+.Ox 4.1 .
+.Pp
+Drivers that only call
+.Fn sensor_task_register
+and don't check its return value are not affected by this
+.Va sensor_task
+compatibility notice.
+.Sh SEE ALSO
+.Xr systat 1 ,
+.Xr sysctl 3 ,
+.Xr sensorsd 8 ,
+.Xr sysctl 8
+.Sh HISTORY
+The sensor framework was written by
+.An Alexander Yurchenko Aq grange@openbsd.org
+and first appeared in
+.Ox 3.4 .
+.An David Gwynne Aq dlg@openbsd.org
+later extended it for
+.Ox 3.8 .
+.An Constantine A. Murenin Aq cnst+openbsd@bugmail.mojo.ru
+extended it even further by introducing the concept of sensor devices in
+.Ox 4.1 .
+.Pp
+The framework was ported to
+.Fx
+by
+.An Constantine A. Murenin Aq cnst@FreeBSD.org
+as a Google Summer of Code 2007 project,
+and first appeared in
+.Fx 7.XXX.
OpenPOWER on IntegriCloud