9762 Split the custr functions into their own library
[unleashed.git] / usr / src / head / fmtmsg.h
blob5695847380b780d0b91a3c64174b283c3009aa61
1 /*
2 * CDDL HEADER START
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.
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.
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]
20 * CDDL HEADER END
22 /* Copyright (c) 1988 AT&T */
23 /* All Rights Reserved */
27 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
28 * Copyright 2014-2015 PALO, Richard.
30 * Copyright 1996-2003 Sun Microsystems, Inc. All rights reserved.
31 * Use is subject to license terms.
34 #ifndef _FMTMSG_H
35 #define _FMTMSG_H
37 #include <sys/feature_tests.h>
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
44 * fmtmsg.h
46 * The <fmtmsg.h> header file contains the definitions needed
47 * to use the fmtmsg() function. This function writes messages
48 * in a standard format to the standard error stream (stderr)
49 * and to the system console.
53 * Constraint definitions:
54 * MM_MXLABELLN Maximum size of a "label" in a message
55 * MM_MXTAGLN Maximum size of a "tag" in a message
56 * MM_MXTXTLN Maximum size of a text string
57 * MM_MXACTLN Maximum size of an action string
60 #define MM_MXLABELLN 25
61 #define MM_MXTAGLN 32
62 #define MM_MXTXTLN 512
63 #define MM_MXACTLN 512
66 * Environment variable names used by fmtmsg():
67 * MSGVERB Tells fmtmsg() which components it is to write
68 * to the standard error stream
71 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
72 #define MSGVERB "MSGVERB"
73 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
76 * Classification information
77 * - Definition of classifications
78 * - Definition of recoverability
79 * - Definition of source classifications
83 * Definition of the "null" classification
84 * MM_NULL Indicates that the classification has been omitted
87 #define MM_NULL 0L
90 * Definitions of type classifications:
91 * MM_HARD Hardware
92 * MM_SOFT Software
93 * MM_FIRM Firmware
96 #define MM_HARD 0x00000001L
97 #define MM_SOFT 0x00000002L
98 #define MM_FIRM 0x00000004L
101 * Definitions of recoverability subclassification
102 * MM_RECOVER Recoverable
103 * MM_NRECOV Non-recoverable
106 #define MM_RECOVER 0x00000100L
107 #define MM_NRECOV 0x00000200L
110 * Definitions of source subclassification
111 * MM_APPL Application
112 * MM_UTIL Utility
113 * MM_OPSYS Kernel
116 #define MM_APPL 0x00000008L
117 #define MM_UTIL 0x00000010L
118 #define MM_OPSYS 0x00000020L
121 * Definitions for the action to take with the message:
122 * MM_PRINT Write to the standard error stream
123 * MM_CONSOLE Treat the message as a console message
126 #define MM_PRINT 0x00000040L
127 #define MM_CONSOLE 0x00000080L
130 * Constants for severity values
132 * SEV_LEVEL Names the env variable that defines severities
134 * MM_NOSEV Message has no severity
135 * MM_HALT Message describes a severe error condition
136 * MM_ERROR Message describes an error condition
137 * MM_WARNING Message tells of probable error condition
138 * MM_INFO Message informs, not in error
141 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
142 #define SEV_LEVEL "SEV_LEVEL"
143 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
145 #define MM_NOSEV 0
146 #define MM_HALT 1
147 #define MM_ERROR 2
148 #define MM_WARNING 3
149 #define MM_INFO 4
152 * Null values for message components
153 * MM_NULLLBL Null value for the label-component
154 * MM_NULLSEV Null value for the severity-component
155 * MM_NULLMC Null value for the classification-component
156 * MM_NULLTXT Null value for the text-component
157 * MM_NULLACT Null value for the action-component
158 * MM_NULLTAG Null value for the tag-component
161 #define MM_NULLLBL ((char *)0)
162 #define MM_NULLSEV MM_NOSEV
163 #define MM_NULLMC MM_NULL
164 #define MM_NULLTXT ((char *)0)
165 #define MM_NULLACT ((char *)0)
166 #define MM_NULLTAG ((char *)0)
169 * Values returned by fmtmsg()
171 * MM_NOTOK None of the requested messages were generated
172 * MM_NOMSG No message was written to stderr
173 * MM_NOCON No console message was generated
176 #define MM_NOTOK -1
177 #define MM_OK 0x00
178 #define MM_NOMSG 0x01
179 #define MM_NOCON 0x04
181 /* Function definition */
183 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
184 int addseverity(int, const char *);
185 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
187 int fmtmsg(long, const char *, int, const char *, const char *,
188 const char *);
190 #ifdef __cplusplus
192 #endif
194 #endif /* _FMTMSG_H */