xref: /illumos-gate/usr/src/cmd/fm/fmd/common/fmd_error.h (revision 2a8bcb4efb45d99ac41c94a75c396b362c414f7f)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
22d9638e54Smws 
237c478bd9Sstevel@tonic-gate /*
24*7aec1d6eScindi  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
257c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #ifndef	_FMD_ERROR_H
297c478bd9Sstevel@tonic-gate #define	_FMD_ERROR_H
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #include <errno.h>
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
347c478bd9Sstevel@tonic-gate extern "C" {
357c478bd9Sstevel@tonic-gate #endif
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate /*
387c478bd9Sstevel@tonic-gate  * This enum definition is used to define a set of error tags associated with
397c478bd9Sstevel@tonic-gate  * the fmd daemon's various error conditions.  The shell script mkerror.sh is
407c478bd9Sstevel@tonic-gate  * used to parse this file and create a corresponding fmd_error.c source file.
417c478bd9Sstevel@tonic-gate  * If you do something other than add a new error tag here, you may need to
427c478bd9Sstevel@tonic-gate  * update the mkerror shell script as it is based upon simple regexps.
437c478bd9Sstevel@tonic-gate  */
447c478bd9Sstevel@tonic-gate typedef enum fmd_errno {
457c478bd9Sstevel@tonic-gate     EFMD_UNKNOWN = 1000, /* unknown fault management daemon error */
467c478bd9Sstevel@tonic-gate     EFMD_PANIC,		/* unrecoverable fatal error in daemon occurred */
477c478bd9Sstevel@tonic-gate     EFMD_EXIT,		/* failed to initialize fault management daemon */
487c478bd9Sstevel@tonic-gate     EFMD_MODULE,	/* fmd module detected or caused an error */
497c478bd9Sstevel@tonic-gate     EFMD_CONF_OPEN,	/* failed to open configuration file */
507c478bd9Sstevel@tonic-gate     EFMD_CONF_KEYWORD,	/* invalid configuration file keyword */
517c478bd9Sstevel@tonic-gate     EFMD_CONF_NOPROP,	/* invalid configuration file parameter name */
52d9638e54Smws     EFMD_CONF_NODEFER,	/* deferred properties not permitted in this file */
537c478bd9Sstevel@tonic-gate     EFMD_CONF_PROPDUP,	/* duplicate configuration file parameter name */
547c478bd9Sstevel@tonic-gate     EFMD_CONF_INVAL,	/* invalid value for configuration file property */
557c478bd9Sstevel@tonic-gate     EFMD_CONF_OVERFLOW,	/* configuration value too large for data type */
567c478bd9Sstevel@tonic-gate     EFMD_CONF_USAGE,	/* syntax error in configuration file directive */
577c478bd9Sstevel@tonic-gate     EFMD_CONF_DEFAULT,	/* invalid default value for configuration property */
587c478bd9Sstevel@tonic-gate     EFMD_CONF_ERRS,	/* error(s) detected in configuration file */
597c478bd9Sstevel@tonic-gate     EFMD_CONF_IO,	/* i/o error prevented configuration file processing */
607c478bd9Sstevel@tonic-gate     EFMD_CONF_PROPNAME,	/* configuration property name is not an identifier */
617c478bd9Sstevel@tonic-gate     EFMD_CONF_RDONLY,	/* configuration property is read-only */
62d9638e54Smws     EFMD_CONF_DEFER,	/* invalid deferred configuration file property */
63*7aec1d6eScindi     EFMD_CONF_UNDEF,	/* configuration property is not defined */
647c478bd9Sstevel@tonic-gate     EFMD_MOD_INIT,	/* failed to initialize module */
657c478bd9Sstevel@tonic-gate     EFMD_MOD_FINI,	/* failed to uninitialize module */
667c478bd9Sstevel@tonic-gate     EFMD_MOD_THR,	/* failed to create processing thread for module */
677c478bd9Sstevel@tonic-gate     EFMD_MOD_JOIN,	/* failed to join processing thread for module */
687c478bd9Sstevel@tonic-gate     EFMD_MOD_CONF,	/* error(s) detected in module configuration file */
697c478bd9Sstevel@tonic-gate     EFMD_MOD_DICT,	/* failed to open module's event code dictionary */
707c478bd9Sstevel@tonic-gate     EFMD_MOD_LOADED,	/* specified module is already loaded */
717c478bd9Sstevel@tonic-gate     EFMD_MOD_NOMOD,	/* specified module is not loaded */
727c478bd9Sstevel@tonic-gate     EFMD_MOD_FAIL,	/* module failed due to preceding error */
73*7aec1d6eScindi     EFMD_MOD_TOPO,	/* failed to obtain topology handle */
747c478bd9Sstevel@tonic-gate     EFMD_RTLD_OPEN,	/* rtld failed to open shared library plug-in */
757c478bd9Sstevel@tonic-gate     EFMD_RTLD_INIT,	/* shared library plug-in does not define _fmd_init */
767c478bd9Sstevel@tonic-gate     EFMD_BLTIN_NAME,	/* built-in plug-in name not found in definition list */
777c478bd9Sstevel@tonic-gate     EFMD_BLTIN_INIT,	/* built-in plug-in does not define init function */
78d9638e54Smws     EFMD_EVENT_INVAL,	/* event interface programming error */
79d9638e54Smws     EFMD_XPRT_INVAL,	/* transport interface programming error */
80d9638e54Smws     EFMD_XPRT_PAYLOAD,	/* transport event has invalid payload */
81d9638e54Smws     EFMD_XPRT_OWNER,	/* transport can only be manipulated by owner */
82d9638e54Smws     EFMD_XPRT_THR,	/* failed to create thread for transport */
83d9638e54Smws     EFMD_XPRT_LIMIT,	/* limit on number of open transports exceeded */
847c478bd9Sstevel@tonic-gate     EFMD_TIME_GETTOD,	/* failed to get current time-of-day */
857c478bd9Sstevel@tonic-gate     EFMD_LOG_OPEN,	/* failed to open and initialize log file */
867c478bd9Sstevel@tonic-gate     EFMD_LOG_CLOSE,	/* failed to close log file */
877c478bd9Sstevel@tonic-gate     EFMD_LOG_EXACCT,	/* failed to perform log exacct operation */
887c478bd9Sstevel@tonic-gate     EFMD_LOG_APPEND,	/* failed to append event to log */
897c478bd9Sstevel@tonic-gate     EFMD_LOG_MINFREE,	/* insufficient min fs space to append event to log */
907c478bd9Sstevel@tonic-gate     EFMD_LOG_COMMIT,	/* failed to commit event to log */
917c478bd9Sstevel@tonic-gate     EFMD_LOG_INVAL,	/* invalid log header information */
927c478bd9Sstevel@tonic-gate     EFMD_LOG_VERSION,	/* invalid log version information */
937c478bd9Sstevel@tonic-gate     EFMD_LOG_UNPACK,	/* failed to unpack data in log */
947c478bd9Sstevel@tonic-gate     EFMD_LOG_REPLAY,	/* failed to replay log content */
957c478bd9Sstevel@tonic-gate     EFMD_LOG_UPDATE,	/* failed to update log toc */
967c478bd9Sstevel@tonic-gate     EFMD_LOG_ROTATE,	/* failed to rotate log file */
977c478bd9Sstevel@tonic-gate     EFMD_LOG_ROTBUSY,	/* failed to rotate log file due to pending events */
987c478bd9Sstevel@tonic-gate     EFMD_ASRU_NODIR,	/* failed to open asru cache directory */
997c478bd9Sstevel@tonic-gate     EFMD_ASRU_EVENT,	/* failed to process asru event log */
1007c478bd9Sstevel@tonic-gate     EFMD_ASRU_FMRI,	/* failed to convert asru fmri to string */
1017c478bd9Sstevel@tonic-gate     EFMD_ASRU_NOENT,	/* failed to locate specified asru entry */
1027c478bd9Sstevel@tonic-gate     EFMD_ASRU_UNLINK,	/* failed to delete asru cache entry */
1037c478bd9Sstevel@tonic-gate     EFMD_ASRU_DUP,	/* asru log is a duplicate of an existing asru */
1047c478bd9Sstevel@tonic-gate     EFMD_FMRI_SCHEME,	/* fmri scheme module is missing or failed to load */
1057c478bd9Sstevel@tonic-gate     EFMD_FMRI_OP,	/* fmri scheme module operation failed */
1067c478bd9Sstevel@tonic-gate     EFMD_FMRI_INVAL,	/* fmri nvlist is missing required element */
1077c478bd9Sstevel@tonic-gate     EFMD_FMRI_NOTSUP,	/* fmri scheme module does not support operation */
1087c478bd9Sstevel@tonic-gate     EFMD_VER_OLD,	/* plug-in is compiled using an obsolete fmd API */
1097c478bd9Sstevel@tonic-gate     EFMD_VER_NEW,	/* plug-in is compiled using a newer fmd API */
1107c478bd9Sstevel@tonic-gate     EFMD_HDL_INIT,	/* client handle wasn't initialized by _fmd_init */
1117c478bd9Sstevel@tonic-gate     EFMD_HDL_INFO,	/* client info is missing required information */
1127c478bd9Sstevel@tonic-gate     EFMD_HDL_PROP,	/* client info includes invalid property definition */
1137c478bd9Sstevel@tonic-gate     EFMD_HDL_NOTREG,	/* client handle has never been registered */
1147c478bd9Sstevel@tonic-gate     EFMD_HDL_REG,	/* client handle has already been registered */
1157c478bd9Sstevel@tonic-gate     EFMD_HDL_TID,	/* client handle must be registered by owner */
1167c478bd9Sstevel@tonic-gate     EFMD_HDL_INVAL,	/* client handle is corrupt or not owned by caller */
1177c478bd9Sstevel@tonic-gate     EFMD_HDL_ABORT,	/* client requested that module execution abort */
1187c478bd9Sstevel@tonic-gate     EFMD_HDL_NOMEM,	/* client memory limit exceeded */
1197c478bd9Sstevel@tonic-gate     EFMD_PROP_TYPE,	/* property accessed using incompatible type */
1207c478bd9Sstevel@tonic-gate     EFMD_PROP_DEFN,	/* property is not defined */
1217c478bd9Sstevel@tonic-gate     EFMD_STAT_FLAGS,	/* invalid flags passed to fmd_stat_* function */
1227c478bd9Sstevel@tonic-gate     EFMD_STAT_TYPE,	/* invalid operation for statistic type */
1237c478bd9Sstevel@tonic-gate     EFMD_STAT_BADTYPE,	/* invalid type for statistic */
1247c478bd9Sstevel@tonic-gate     EFMD_STAT_BADNAME,	/* invalid name for statistic */
1257c478bd9Sstevel@tonic-gate     EFMD_STAT_DUPNAME,	/* statistic name is already defined in collection */
1267c478bd9Sstevel@tonic-gate     EFMD_STAT_NOMEM,	/* failed to allocate memory for statistics snapshot */
1277c478bd9Sstevel@tonic-gate     EFMD_CASE_OWNER,	/* case can only be manipulated or closed by owner */
1287c478bd9Sstevel@tonic-gate     EFMD_CASE_STATE,	/* case is not in appropriate state for operation */
1297c478bd9Sstevel@tonic-gate     EFMD_CASE_EVENT,	/* case operation failed due to invalid event */
1307c478bd9Sstevel@tonic-gate     EFMD_CASE_INVAL,	/* case uuid does not match any known case */
1317c478bd9Sstevel@tonic-gate     EFMD_BUF_INVAL,	/* buffer specification uses invalid name or size */
1327c478bd9Sstevel@tonic-gate     EFMD_BUF_LIMIT,	/* client exceeded limit on total buffer space */
1337c478bd9Sstevel@tonic-gate     EFMD_BUF_NOENT,	/* no such buffer is currently defined by client */
1347c478bd9Sstevel@tonic-gate     EFMD_BUF_OFLOW,	/* write would overflow the size of this buffer */
1357c478bd9Sstevel@tonic-gate     EFMD_BUF_EXISTS,	/* buffer with the specified name already exists */
1367c478bd9Sstevel@tonic-gate     EFMD_SERD_NAME,	/* no serd engine with the specified name exists */
1377c478bd9Sstevel@tonic-gate     EFMD_SERD_EXISTS,	/* serd engine with the specified name already exists */
1387c478bd9Sstevel@tonic-gate     EFMD_THR_CREATE,	/* failed to create auxiliary module thread */
1397c478bd9Sstevel@tonic-gate     EFMD_THR_LIMIT,	/* limit on module auxiliary threads exceeded */
1407c478bd9Sstevel@tonic-gate     EFMD_THR_INVAL,	/* invalid thread id specified for thread call */
1417c478bd9Sstevel@tonic-gate     EFMD_THR_JOIN,	/* failed to join with auxiliary thread */
1427c478bd9Sstevel@tonic-gate     EFMD_TIMER_INVAL,	/* invalid time delta or id specified for timer call */
1437c478bd9Sstevel@tonic-gate     EFMD_TIMER_LIMIT,	/* client exceeded limit on number of pending timers */
1447c478bd9Sstevel@tonic-gate     EFMD_CKPT_NOMEM,	/* failed to allocate checkpoint buffer */
1457c478bd9Sstevel@tonic-gate     EFMD_CKPT_MKDIR,	/* failed to create checkpoint directory */
1467c478bd9Sstevel@tonic-gate     EFMD_CKPT_CREATE,	/* failed to create checkpoint file */
1477c478bd9Sstevel@tonic-gate     EFMD_CKPT_COMMIT,	/* failed to commit checkpoint file */
1487c478bd9Sstevel@tonic-gate     EFMD_CKPT_DELETE,	/* failed to delete checkpoint file */
1497c478bd9Sstevel@tonic-gate     EFMD_CKPT_OPEN,	/* failed to open checkpoint file */
1507c478bd9Sstevel@tonic-gate     EFMD_CKPT_SHORT,	/* checkpoint file has been truncated or corrupted */
1517c478bd9Sstevel@tonic-gate     EFMD_CKPT_INVAL,	/* checkpoint file has invalid header or content */
1527c478bd9Sstevel@tonic-gate     EFMD_CKPT_RESTORE,	/* failed to restore checkpoint file */
1537c478bd9Sstevel@tonic-gate     EFMD_RPC_REG,	/* failed to register rpc service */
1547c478bd9Sstevel@tonic-gate     EFMD_RPC_BOUND,	/* rpc program/version is already bound */
1557c478bd9Sstevel@tonic-gate     EFMD_NVL_INVAL,	/* invalid nvlist function argument */
1567c478bd9Sstevel@tonic-gate     EFMD_CTL_INVAL,	/* invalid fault manager control event */
1577c478bd9Sstevel@tonic-gate     EFMD_END		/* end of custom errno list (to ease auto-merge) */
1587c478bd9Sstevel@tonic-gate } fmd_errno_t;
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate extern const char *fmd_errclass(int);
1617c478bd9Sstevel@tonic-gate extern const char *fmd_strerror(int);
1627c478bd9Sstevel@tonic-gate extern int fmd_set_errno(int);
1637c478bd9Sstevel@tonic-gate 
1647c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1657c478bd9Sstevel@tonic-gate }
1667c478bd9Sstevel@tonic-gate #endif
1677c478bd9Sstevel@tonic-gate 
1687c478bd9Sstevel@tonic-gate #endif	/* _FMD_ERROR_H */
169