KSENSOR_KIND(9F)        Kernel Functions for Drivers        KSENSOR_KIND(9F)
NAME
     ksensor_kind_current, 
ksensor_kind_temperature, 
ksensor_kind_voltage -
     ksensor kind implementations
SYNOPSIS
     #include <sys/sensors.h>     int     ksensor_kind_current(
void *driver, 
sensor_ioctl_kind_t *kind);     
int     ksensor_kind_temperature(
void *driver, 
sensor_ioctl_kind_t *kind);     
int     ksensor_kind_voltage(
void *driver, 
sensor_ioctl_kind_t *kind);
INTERFACE LEVEL
     Volatile - This interface is still evolving in illumos.  API and ABI
     stability is not guaranteed.
DESCRIPTION
     The 
ksensor_kind_current(), 
ksensor_kind_temperature(), and     
ksensor_kind_voltage() functions are implementations of the ksensor     
kso_kind(9E) entry point and indicate that a sensor is a current
     (SENSOR_KIND_CURRENT), temperature (SENSOR_KIND_TEMPERATURE), or
     voltage (SENSOR_KIND_VOLTAGE) sensor respectively.
     While these functions can be called directly, it is expected that they
     will be used as part of a ksensor operations vector as described in     
ksensor_ops(9E), allowing the driver to avoid having to implement the
     entry point directly.  If a driver does use this function, it must
     ensure that the return value is passed back to the framework as part of
     its 
kso_kind(9E) entry point.
CONTEXT
     The 
ksensor_kind_current(), 
ksensor_kind_temperature(), and     
ksensor_kind_voltage() functions can be called from 
user, or 
kernel     context.
RETURN VALUES
     Upon successful completion, the 
ksensor_kind_current(),     
ksensor_kind_temperature(), and 
ksensor_kind_voltage() functions return     
0 and update 
kind with the corresponding information.  Otherwise, a
     non-zero error value is returned.
EXAMPLES
     Example 1 Using 
ksensor_kind_temperature() as part of the     
ksensor_ops(9E) entry points.
     #include <sys/sensors.h>
     static int coretemp_read(void *, sensor_ioctl_scalar_t *);
     static const ksensor_ops_t coretemp_temp_ops = {
             .kso_kind = ksensor_kind_temperature,
             .kso_scalar = coretemp_read
     };
SEE ALSO
     ksensor(9E), 
ksensor_ops(9E), 
kso_kind(9E)illumos                         May 10, 2024                         illumos