xref: /illumos-gate/usr/src/cmd/fm/fmd/common/fmd_error.h (revision 2a8bcb4efb45d99ac41c94a75c396b362c414f7f)
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 /*
24  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 
28 #ifndef	_FMD_ERROR_H
29 #define	_FMD_ERROR_H
30 
31 #include <errno.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * This enum definition is used to define a set of error tags associated with
39  * the fmd daemon's various error conditions.  The shell script mkerror.sh is
40  * used to parse this file and create a corresponding fmd_error.c source file.
41  * If you do something other than add a new error tag here, you may need to
42  * update the mkerror shell script as it is based upon simple regexps.
43  */
44 typedef enum fmd_errno {
45     EFMD_UNKNOWN = 1000, /* unknown fault management daemon error */
46     EFMD_PANIC,		/* unrecoverable fatal error in daemon occurred */
47     EFMD_EXIT,		/* failed to initialize fault management daemon */
48     EFMD_MODULE,	/* fmd module detected or caused an error */
49     EFMD_CONF_OPEN,	/* failed to open configuration file */
50     EFMD_CONF_KEYWORD,	/* invalid configuration file keyword */
51     EFMD_CONF_NOPROP,	/* invalid configuration file parameter name */
52     EFMD_CONF_NODEFER,	/* deferred properties not permitted in this file */
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_CONF_DEFER,	/* invalid deferred configuration file property */
63     EFMD_CONF_UNDEF,	/* configuration property is not defined */
64     EFMD_MOD_INIT,	/* failed to initialize module */
65     EFMD_MOD_FINI,	/* failed to uninitialize module */
66     EFMD_MOD_THR,	/* failed to create processing thread for module */
67     EFMD_MOD_JOIN,	/* failed to join processing thread for module */
68     EFMD_MOD_CONF,	/* error(s) detected in module configuration file */
69     EFMD_MOD_DICT,	/* failed to open module's event code dictionary */
70     EFMD_MOD_LOADED,	/* specified module is already loaded */
71     EFMD_MOD_NOMOD,	/* specified module is not loaded */
72     EFMD_MOD_FAIL,	/* module failed due to preceding error */
73     EFMD_MOD_TOPO,	/* failed to obtain topology handle */
74     EFMD_RTLD_OPEN,	/* rtld failed to open shared library plug-in */
75     EFMD_RTLD_INIT,	/* shared library plug-in does not define _fmd_init */
76     EFMD_BLTIN_NAME,	/* built-in plug-in name not found in definition list */
77     EFMD_BLTIN_INIT,	/* built-in plug-in does not define init function */
78     EFMD_EVENT_INVAL,	/* event interface programming error */
79     EFMD_XPRT_INVAL,	/* transport interface programming error */
80     EFMD_XPRT_PAYLOAD,	/* transport event has invalid payload */
81     EFMD_XPRT_OWNER,	/* transport can only be manipulated by owner */
82     EFMD_XPRT_THR,	/* failed to create thread for transport */
83     EFMD_XPRT_LIMIT,	/* limit on number of open transports exceeded */
84     EFMD_TIME_GETTOD,	/* failed to get current time-of-day */
85     EFMD_LOG_OPEN,	/* failed to open and initialize log file */
86     EFMD_LOG_CLOSE,	/* failed to close log file */
87     EFMD_LOG_EXACCT,	/* failed to perform log exacct operation */
88     EFMD_LOG_APPEND,	/* failed to append event to log */
89     EFMD_LOG_MINFREE,	/* insufficient min fs space to append event to log */
90     EFMD_LOG_COMMIT,	/* failed to commit event to log */
91     EFMD_LOG_INVAL,	/* invalid log header information */
92     EFMD_LOG_VERSION,	/* invalid log version information */
93     EFMD_LOG_UNPACK,	/* failed to unpack data in log */
94     EFMD_LOG_REPLAY,	/* failed to replay log content */
95     EFMD_LOG_UPDATE,	/* failed to update log toc */
96     EFMD_LOG_ROTATE,	/* failed to rotate log file */
97     EFMD_LOG_ROTBUSY,	/* failed to rotate log file due to pending events */
98     EFMD_ASRU_NODIR,	/* failed to open asru cache directory */
99     EFMD_ASRU_EVENT,	/* failed to process asru event log */
100     EFMD_ASRU_FMRI,	/* failed to convert asru fmri to string */
101     EFMD_ASRU_NOENT,	/* failed to locate specified asru entry */
102     EFMD_ASRU_UNLINK,	/* failed to delete asru cache entry */
103     EFMD_ASRU_DUP,	/* asru log is a duplicate of an existing asru */
104     EFMD_FMRI_SCHEME,	/* fmri scheme module is missing or failed to load */
105     EFMD_FMRI_OP,	/* fmri scheme module operation failed */
106     EFMD_FMRI_INVAL,	/* fmri nvlist is missing required element */
107     EFMD_FMRI_NOTSUP,	/* fmri scheme module does not support operation */
108     EFMD_VER_OLD,	/* plug-in is compiled using an obsolete fmd API */
109     EFMD_VER_NEW,	/* plug-in is compiled using a newer fmd API */
110     EFMD_HDL_INIT,	/* client handle wasn't initialized by _fmd_init */
111     EFMD_HDL_INFO,	/* client info is missing required information */
112     EFMD_HDL_PROP,	/* client info includes invalid property definition */
113     EFMD_HDL_NOTREG,	/* client handle has never been registered */
114     EFMD_HDL_REG,	/* client handle has already been registered */
115     EFMD_HDL_TID,	/* client handle must be registered by owner */
116     EFMD_HDL_INVAL,	/* client handle is corrupt or not owned by caller */
117     EFMD_HDL_ABORT,	/* client requested that module execution abort */
118     EFMD_HDL_NOMEM,	/* client memory limit exceeded */
119     EFMD_PROP_TYPE,	/* property accessed using incompatible type */
120     EFMD_PROP_DEFN,	/* property is not defined */
121     EFMD_STAT_FLAGS,	/* invalid flags passed to fmd_stat_* function */
122     EFMD_STAT_TYPE,	/* invalid operation for statistic type */
123     EFMD_STAT_BADTYPE,	/* invalid type for statistic */
124     EFMD_STAT_BADNAME,	/* invalid name for statistic */
125     EFMD_STAT_DUPNAME,	/* statistic name is already defined in collection */
126     EFMD_STAT_NOMEM,	/* failed to allocate memory for statistics snapshot */
127     EFMD_CASE_OWNER,	/* case can only be manipulated or closed by owner */
128     EFMD_CASE_STATE,	/* case is not in appropriate state for operation */
129     EFMD_CASE_EVENT,	/* case operation failed due to invalid event */
130     EFMD_CASE_INVAL,	/* case uuid does not match any known case */
131     EFMD_BUF_INVAL,	/* buffer specification uses invalid name or size */
132     EFMD_BUF_LIMIT,	/* client exceeded limit on total buffer space */
133     EFMD_BUF_NOENT,	/* no such buffer is currently defined by client */
134     EFMD_BUF_OFLOW,	/* write would overflow the size of this buffer */
135     EFMD_BUF_EXISTS,	/* buffer with the specified name already exists */
136     EFMD_SERD_NAME,	/* no serd engine with the specified name exists */
137     EFMD_SERD_EXISTS,	/* serd engine with the specified name already exists */
138     EFMD_THR_CREATE,	/* failed to create auxiliary module thread */
139     EFMD_THR_LIMIT,	/* limit on module auxiliary threads exceeded */
140     EFMD_THR_INVAL,	/* invalid thread id specified for thread call */
141     EFMD_THR_JOIN,	/* failed to join with auxiliary thread */
142     EFMD_TIMER_INVAL,	/* invalid time delta or id specified for timer call */
143     EFMD_TIMER_LIMIT,	/* client exceeded limit on number of pending timers */
144     EFMD_CKPT_NOMEM,	/* failed to allocate checkpoint buffer */
145     EFMD_CKPT_MKDIR,	/* failed to create checkpoint directory */
146     EFMD_CKPT_CREATE,	/* failed to create checkpoint file */
147     EFMD_CKPT_COMMIT,	/* failed to commit checkpoint file */
148     EFMD_CKPT_DELETE,	/* failed to delete checkpoint file */
149     EFMD_CKPT_OPEN,	/* failed to open checkpoint file */
150     EFMD_CKPT_SHORT,	/* checkpoint file has been truncated or corrupted */
151     EFMD_CKPT_INVAL,	/* checkpoint file has invalid header or content */
152     EFMD_CKPT_RESTORE,	/* failed to restore checkpoint file */
153     EFMD_RPC_REG,	/* failed to register rpc service */
154     EFMD_RPC_BOUND,	/* rpc program/version is already bound */
155     EFMD_NVL_INVAL,	/* invalid nvlist function argument */
156     EFMD_CTL_INVAL,	/* invalid fault manager control event */
157     EFMD_END		/* end of custom errno list (to ease auto-merge) */
158 } fmd_errno_t;
159 
160 extern const char *fmd_errclass(int);
161 extern const char *fmd_strerror(int);
162 extern int fmd_set_errno(int);
163 
164 #ifdef	__cplusplus
165 }
166 #endif
167 
168 #endif	/* _FMD_ERROR_H */
169