xref: /illumos-gate/usr/src/cmd/fm/fmd/common/fmd_error.h (revision 88f8b78a88cbdc6d8c1af5c3e54bc49d25095c98)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_FMD_ERROR_H
28 #define	_FMD_ERROR_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <errno.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 /*
39  * This enum definition is used to define a set of error tags associated with
40  * the fmd daemon's various error conditions.  The shell script mkerror.sh is
41  * used to parse this file and create a corresponding fmd_error.c source file.
42  * If you do something other than add a new error tag here, you may need to
43  * update the mkerror shell script as it is based upon simple regexps.
44  */
45 typedef enum fmd_errno {
46     EFMD_UNKNOWN = 1000, /* unknown fault management daemon error */
47     EFMD_PANIC,		/* unrecoverable fatal error in daemon occurred */
48     EFMD_EXIT,		/* failed to initialize fault management daemon */
49     EFMD_MODULE,	/* fmd module detected or caused an error */
50     EFMD_CONF_OPEN,	/* failed to open configuration file */
51     EFMD_CONF_KEYWORD,	/* invalid configuration file keyword */
52     EFMD_CONF_NOPROP,	/* invalid configuration file parameter name */
53     EFMD_CONF_PROPDUP,	/* duplicate configuration file parameter name */
54     EFMD_CONF_INVAL,	/* invalid value for configuration file property */
55     EFMD_CONF_OVERFLOW,	/* configuration value too large for data type */
56     EFMD_CONF_USAGE,	/* syntax error in configuration file directive */
57     EFMD_CONF_DEFAULT,	/* invalid default value for configuration property */
58     EFMD_CONF_ERRS,	/* error(s) detected in configuration file */
59     EFMD_CONF_IO,	/* i/o error prevented configuration file processing */
60     EFMD_CONF_PROPNAME,	/* configuration property name is not an identifier */
61     EFMD_CONF_RDONLY,	/* configuration property is read-only */
62     EFMD_MOD_INIT,	/* failed to initialize module */
63     EFMD_MOD_FINI,	/* failed to uninitialize module */
64     EFMD_MOD_THR,	/* failed to create processing thread for module */
65     EFMD_MOD_JOIN,	/* failed to join processing thread for module */
66     EFMD_MOD_CONF,	/* error(s) detected in module configuration file */
67     EFMD_MOD_DICT,	/* failed to open module's event code dictionary */
68     EFMD_MOD_LOADED,	/* specified module is already loaded */
69     EFMD_MOD_NOMOD,	/* specified module is not loaded */
70     EFMD_MOD_FAIL,	/* module failed due to preceding error */
71     EFMD_RTLD_OPEN,	/* rtld failed to open shared library plug-in */
72     EFMD_RTLD_INIT,	/* shared library plug-in does not define _fmd_init */
73     EFMD_BLTIN_NAME,	/* built-in plug-in name not found in definition list */
74     EFMD_BLTIN_INIT,	/* built-in plug-in does not define init function */
75     EFMD_XPRT_CLASS,	/* event received with invalid transport class */
76     EFMD_XPRT_INVAL,	/* event received with invalid payload */
77     EFMD_XPRT_OPEN,	/* failed to open transport device for event replay */
78     EFMD_XPRT_READ,	/* failed to read transport device for event replay */
79     EFMD_XPRT_MARK,	/* failed to mark transport record for completion */
80     EFMD_TIME_GETTOD,	/* failed to get current time-of-day */
81     EFMD_LOG_OPEN,	/* failed to open and initialize log file */
82     EFMD_LOG_CLOSE,	/* failed to close log file */
83     EFMD_LOG_EXACCT,	/* failed to perform log exacct operation */
84     EFMD_LOG_APPEND,	/* failed to append event to log */
85     EFMD_LOG_MINFREE,	/* insufficient min fs space to append event to log */
86     EFMD_LOG_COMMIT,	/* failed to commit event to log */
87     EFMD_LOG_INVAL,	/* invalid log header information */
88     EFMD_LOG_VERSION,	/* invalid log version information */
89     EFMD_LOG_UNPACK,	/* failed to unpack data in log */
90     EFMD_LOG_REPLAY,	/* failed to replay log content */
91     EFMD_LOG_UPDATE,	/* failed to update log toc */
92     EFMD_LOG_ROTATE,	/* failed to rotate log file */
93     EFMD_LOG_ROTBUSY,	/* failed to rotate log file due to pending events */
94     EFMD_ASRU_NODIR,	/* failed to open asru cache directory */
95     EFMD_ASRU_EVENT,	/* failed to process asru event log */
96     EFMD_ASRU_FMRI,	/* failed to convert asru fmri to string */
97     EFMD_ASRU_NOENT,	/* failed to locate specified asru entry */
98     EFMD_ASRU_UNLINK,	/* failed to delete asru cache entry */
99     EFMD_ASRU_DUP,	/* asru log is a duplicate of an existing asru */
100     EFMD_FMRI_SCHEME,	/* fmri scheme module is missing or failed to load */
101     EFMD_FMRI_OP,	/* fmri scheme module operation failed */
102     EFMD_FMRI_INVAL,	/* fmri nvlist is missing required element */
103     EFMD_FMRI_NOTSUP,	/* fmri scheme module does not support operation */
104     EFMD_VER_OLD,	/* plug-in is compiled using an obsolete fmd API */
105     EFMD_VER_NEW,	/* plug-in is compiled using a newer fmd API */
106     EFMD_HDL_INIT,	/* client handle wasn't initialized by _fmd_init */
107     EFMD_HDL_INFO,	/* client info is missing required information */
108     EFMD_HDL_PROP,	/* client info includes invalid property definition */
109     EFMD_HDL_NOTREG,	/* client handle has never been registered */
110     EFMD_HDL_REG,	/* client handle has already been registered */
111     EFMD_HDL_TID,	/* client handle must be registered by owner */
112     EFMD_HDL_INVAL,	/* client handle is corrupt or not owned by caller */
113     EFMD_HDL_ABORT,	/* client requested that module execution abort */
114     EFMD_HDL_NOMEM,	/* client memory limit exceeded */
115     EFMD_PROP_TYPE,	/* property accessed using incompatible type */
116     EFMD_PROP_DEFN,	/* property is not defined */
117     EFMD_STAT_FLAGS,	/* invalid flags passed to fmd_stat_* function */
118     EFMD_STAT_TYPE,	/* invalid operation for statistic type */
119     EFMD_STAT_BADTYPE,	/* invalid type for statistic */
120     EFMD_STAT_BADNAME,	/* invalid name for statistic */
121     EFMD_STAT_DUPNAME,	/* statistic name is already defined in collection */
122     EFMD_STAT_NOMEM,	/* failed to allocate memory for statistics snapshot */
123     EFMD_CASE_OWNER,	/* case can only be manipulated or closed by owner */
124     EFMD_CASE_STATE,	/* case is not in appropriate state for operation */
125     EFMD_CASE_EVENT,	/* case operation failed due to invalid event */
126     EFMD_CASE_INVAL,	/* case uuid does not match any known case */
127     EFMD_BUF_INVAL,	/* buffer specification uses invalid name or size */
128     EFMD_BUF_LIMIT,	/* client exceeded limit on total buffer space */
129     EFMD_BUF_NOENT,	/* no such buffer is currently defined by client */
130     EFMD_BUF_OFLOW,	/* write would overflow the size of this buffer */
131     EFMD_BUF_EXISTS,	/* buffer with the specified name already exists */
132     EFMD_SERD_NAME,	/* no serd engine with the specified name exists */
133     EFMD_SERD_EXISTS,	/* serd engine with the specified name already exists */
134     EFMD_THR_CREATE,	/* failed to create auxiliary module thread */
135     EFMD_THR_LIMIT,	/* limit on module auxiliary threads exceeded */
136     EFMD_THR_INVAL,	/* invalid thread id specified for thread call */
137     EFMD_THR_JOIN,	/* failed to join with auxiliary thread */
138     EFMD_TIMER_INVAL,	/* invalid time delta or id specified for timer call */
139     EFMD_TIMER_LIMIT,	/* client exceeded limit on number of pending timers */
140     EFMD_CKPT_NOMEM,	/* failed to allocate checkpoint buffer */
141     EFMD_CKPT_MKDIR,	/* failed to create checkpoint directory */
142     EFMD_CKPT_CREATE,	/* failed to create checkpoint file */
143     EFMD_CKPT_COMMIT,	/* failed to commit checkpoint file */
144     EFMD_CKPT_DELETE,	/* failed to delete checkpoint file */
145     EFMD_CKPT_OPEN,	/* failed to open checkpoint file */
146     EFMD_CKPT_SHORT,	/* checkpoint file has been truncated or corrupted */
147     EFMD_CKPT_INVAL,	/* checkpoint file has invalid header or content */
148     EFMD_CKPT_RESTORE,	/* failed to restore checkpoint file */
149     EFMD_RPC_REG,	/* failed to register rpc service */
150     EFMD_RPC_BOUND,	/* rpc program/version is already bound */
151     EFMD_NVL_INVAL,	/* invalid nvlist function argument */
152     EFMD_CTL_INVAL,	/* invalid fault manager control event */
153     EFMD_END		/* end of custom errno list (to ease auto-merge) */
154 } fmd_errno_t;
155 
156 extern const char *fmd_errclass(int);
157 extern const char *fmd_strerror(int);
158 extern int fmd_set_errno(int);
159 
160 #ifdef	__cplusplus
161 }
162 #endif
163 
164 #endif	/* _FMD_ERROR_H */
165