mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-10-13 10:24:42 +00:00
Document error-related functions.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5654 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
@@ -70,6 +70,17 @@ libsensors \- publicly accessible functions provided by the sensors library
|
||||
.BI "int sensors_set_value(const sensors_chip_name *" name ", int " subfeat_nr ","
|
||||
.BI " double " value ");"
|
||||
.BI "int sensors_do_chip_sets(const sensors_chip_name *" name ");"
|
||||
|
||||
.B #include <sensors/error.h>
|
||||
|
||||
/* Error decoding */
|
||||
.BI "const char *sensors_strerror(int " errnum ");"
|
||||
|
||||
/* Error handlers */
|
||||
.BI "void (*sensors_parse_error) (const char *" err ", int " lineno ");"
|
||||
.BI "void (*sensors_parse_error_wfn) (const char *" err ","
|
||||
.BI " const char *" filename ", int " lineno ");"
|
||||
.BI "void (*sensors_fatal_error) (const char *" proc ", const char *" err ");"
|
||||
.fi
|
||||
|
||||
.SH DESCRIPTION
|
||||
@@ -148,6 +159,34 @@ failure.
|
||||
executes all set statements for this particular chip. The chip may contain
|
||||
wildcards! This function will return 0 on success, and <0 on failure.
|
||||
|
||||
.B sensors_strerror()
|
||||
returns a pointer to a string which describes the error.
|
||||
errnum may be negative (the corresponding positive error is returned).
|
||||
You may not modify the result!
|
||||
|
||||
.B sensors_parse_error()
|
||||
and
|
||||
.B sensors_parse_error_wfn()
|
||||
are functions which are called when a parse error is detected. Give them
|
||||
new values, and your own functions are called instead of the default (which
|
||||
print to stderr). These functions may terminate the program, but they
|
||||
usually output an error and return. The first function is the original
|
||||
one, the second one was added later when support for multiple
|
||||
configuration files was added.
|
||||
The library code now only calls the second function. However, for
|
||||
backwards compatibility, if an application provides a custom handling
|
||||
function for the first function but not the second, then all parse
|
||||
errors will be reported using the first function (that is, the filename
|
||||
is never reported.)
|
||||
Note that filename can be NULL (if filename isn't known) and lineno
|
||||
can be 0 (if the error occurs before the actual parsing starts.)
|
||||
|
||||
.B sensors_fatal_error()
|
||||
Is a function which is called when an immediately fatal error (like no
|
||||
memory left) is detected. Give it a new value, and your own function
|
||||
is called instead of the default (which prints to stderr and ends
|
||||
the program). Never let it return!
|
||||
|
||||
.SH DATA STRUCTURES
|
||||
|
||||
Structure \fBsensors_feature\fR contains information related to a given
|
||||
|
||||
Reference in New Issue
Block a user