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