Blame lib/error.h

Packit 53d5b6
/*
Packit 53d5b6
    error.h - Part of libsensors, a Linux library for reading sensor data.
Packit 53d5b6
    Copyright (c) 1998, 1999  Frodo Looijaard <frodol@dds.nl>
Packit 53d5b6
    Copyright (C) 2007-2010   Jean Delvare <jdelvare@suse.de>
Packit 53d5b6
Packit 53d5b6
    This library is free software; you can redistribute it and/or
Packit 53d5b6
    modify it under the terms of the GNU Lesser General Public
Packit 53d5b6
    License as published by the Free Software Foundation; either
Packit 53d5b6
    version 2.1 of the License, or (at your option) any later version.
Packit 53d5b6
Packit 53d5b6
    This library is distributed in the hope that it will be useful,
Packit 53d5b6
    but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 53d5b6
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 53d5b6
    GNU Lesser General Public License for more details.
Packit 53d5b6
Packit 53d5b6
    You should have received a copy of the GNU General Public License
Packit 53d5b6
    along with this program; if not, write to the Free Software
Packit 53d5b6
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
Packit 53d5b6
    MA 02110-1301 USA.
Packit 53d5b6
*/
Packit 53d5b6
Packit 53d5b6
#ifndef LIB_SENSORS_ERROR_H
Packit 53d5b6
#define LIB_SENSORS_ERROR_H
Packit 53d5b6
Packit 53d5b6
#define SENSORS_ERR_WILDCARDS	1 /* Wildcard found in chip name */
Packit 53d5b6
#define SENSORS_ERR_NO_ENTRY	2 /* No such subfeature known */
Packit 53d5b6
#define SENSORS_ERR_ACCESS_R	3 /* Can't read */
Packit 53d5b6
#define SENSORS_ERR_KERNEL	4 /* Kernel interface error */
Packit 53d5b6
#define SENSORS_ERR_DIV_ZERO	5 /* Divide by zero */
Packit 53d5b6
#define SENSORS_ERR_CHIP_NAME	6 /* Can't parse chip name */
Packit 53d5b6
#define SENSORS_ERR_BUS_NAME	7 /* Can't parse bus name */
Packit 53d5b6
#define SENSORS_ERR_PARSE	8 /* General parse error */
Packit 53d5b6
#define SENSORS_ERR_ACCESS_W	9 /* Can't write */
Packit 53d5b6
#define SENSORS_ERR_IO		10 /* I/O error */
Packit 53d5b6
#define SENSORS_ERR_RECURSION	11 /* Evaluation recurses too deep */
Packit 53d5b6
Packit 53d5b6
#ifdef __cplusplus
Packit 53d5b6
extern "C" {
Packit 53d5b6
#endif /* __cplusplus */
Packit 53d5b6
Packit 53d5b6
Packit 53d5b6
/* This function returns a pointer to a string which describes the error.
Packit 53d5b6
   errnum may be negative (the corresponding positive error is returned).
Packit 53d5b6
   You may not modify the result! */
Packit 53d5b6
const char *sensors_strerror(int errnum);
Packit 53d5b6
Packit 53d5b6
/* These functions are called when a parse error is detected. Give them new
Packit 53d5b6
   values, and your own functions are called instead of the default (which
Packit 53d5b6
   print to stderr). These functions may terminate the program, but they
Packit 53d5b6
   usually output an error and return. The first function is the original
Packit 53d5b6
   one, the second one was added later when support for multiple
Packit 53d5b6
   configuration files was added.
Packit 53d5b6
   The library code now only calls the second function. However, for
Packit 53d5b6
   backwards compatibility, if an application provides a custom handling
Packit 53d5b6
   function for the first function but not the second, then all parse
Packit 53d5b6
   errors will be reported using the first function (that is, the filename
Packit 53d5b6
   is never reported.)
Packit 53d5b6
   Note that filename can be NULL (if filename isn't known) and lineno
Packit 53d5b6
   can be 0 (if the error occurs before the actual parsing starts.) */
Packit 53d5b6
extern void (*sensors_parse_error) (const char *err, int lineno);
Packit 53d5b6
extern void (*sensors_parse_error_wfn) (const char *err,
Packit 53d5b6
					const char *filename, int lineno);
Packit 53d5b6
Packit 53d5b6
/* This function is called when an immediately fatal error (like no
Packit 53d5b6
   memory left) is detected. Give it a new value, and your own function
Packit 53d5b6
   is called instead of the default (which prints to stderr and ends
Packit 53d5b6
   the program). Never let it return! */
Packit 53d5b6
extern void (*sensors_fatal_error) (const char *proc, const char *err);
Packit 53d5b6
Packit 53d5b6
#ifdef __cplusplus
Packit 53d5b6
}
Packit 53d5b6
#endif /* __cplusplus */
Packit 53d5b6
Packit 53d5b6
#endif /* def LIB_SENSORS_ERROR_H */