root/lm-sensors/tags/V2-10-4/lib/error.h

Revision 1979, 2.5 kB (checked in by mds, 5 years ago)

Add separate error returns and messages for read and write errors.

Add missing message for "general parse error" - a nasty bug.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*
2     error.h - Part of libsensors, a Linux library for reading sensor data.
3     Copyright (c) 1998, 1999  Frodo Looijaard <frodol@dds.nl>
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #ifndef LIB_SENSORS_ERROR_H
21 #define LIB_SENSORS_ERROR_H
22
23 #define SENSORS_ERR_WILDCARDS 1 /* Wildcard found in chip name */
24 #define SENSORS_ERR_NO_ENTRY/* No such feature known */
25 #define SENSORS_ERR_ACCESS 3    /* Can't read or write */
26 #define SENSORS_ERR_PROC 4      /* Can't access /proc file */
27 #define SENSORS_ERR_DIV_ZERO/* Divide by zero */
28 #define SENSORS_ERR_CHIP_NAME 6 /* Can't parse chip name */
29 #define SENSORS_ERR_BUS_NAME/* Can't parse bus name */
30 #define SENSORS_ERR_PARSE 8     /* General parse error */
31 #define SENSORS_ERR_ACCESS_W 9    /* Can't write */
32 #define SENSORS_ERR_ACCESS_R 10    /* Can't read */
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif /* __cplusplus */
37
38
39 /* This function returns a pointer to a string which describes the error.
40    errnum may be negative (the corresponding positive error is returned).
41    You may not modify the result! */
42 extern const char *sensors_strerror(int errnum);
43
44 /* This function is called when a parse error is detected. Give it a new
45    value, and your own function is called instead of the default (which
46    prints to stderr). This function may terminate the program, but it
47    usually outputs an error and returns. */
48 extern void (*sensors_parse_error) (const char *err, int lineno);
49
50 /* This function is called when an immediately fatal error (like no
51    memory left) is detected. Give it a new value, and your own function
52    is called instead of the default (which prints to stderr and ends
53    the program). Never let it return! */
54 extern void (*sensors_fatal_error) (const char *proc, const char *err);
55
56 #ifdef __cplusplus
57 }
58 #endif /* __cplusplus */
59
60 #endif /* def LIB_SENSORS_ERROR_H */
Note: See TracBrowser for help on using the browser.