5155 NIGHTLY_OPTIONS last argument should be unquoted
[illumos-gate.git] / usr / src / head / fmtmsg.h
blob209439f0662e887a7f654a3fcec252ad567291ca
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>
29 * Copyright 1996-2003 Sun Microsystems, Inc. All rights reserved.
30 * Use is subject to license terms.
33 #ifndef _FMTMSG_H
34 #define _FMTMSG_H
36 #include <sys/feature_tests.h>
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
43 * fmtmsg.h
45 * The <fmtmsg.h> header file contains the definitions needed
46 * to use the fmtmsg() function. This function writes messages
47 * in a standard format to the standard error stream (stderr)
48 * and to the system console.
52 * Define the value "NULL" if it hasn't been defined already.
53 * NULL breaks namespace so we define _NULL
55 #if defined(_LP64)
56 #define _NULL 0L
57 #else
58 #define _NULL 0
59 #endif
61 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
62 #ifndef NULL
63 #define NULL _NULL
64 #endif
65 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
69 * Constraint definitions:
70 * MM_MXLABELLN Maximum size of a "label" in a message
71 * MM_MXTAGLN Maximum size of a "tag" in a message
72 * MM_MXTXTLN Maximum size of a text string
73 * MM_MXACTLN Maximum size of an action string
76 #define MM_MXLABELLN 25
77 #define MM_MXTAGLN 32
78 #define MM_MXTXTLN 512
79 #define MM_MXACTLN 512
82 * Environment variable names used by fmtmsg():
83 * MSGVERB Tells fmtmsg() which components it is to write
84 * to the standard error stream
87 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
88 #define MSGVERB "MSGVERB"
89 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
92 * Classification information
93 * - Definition of classifications
94 * - Definition of recoverability
95 * - Definition of source classifications
99 * Definition of the "null" classification
100 * MM_NULL Indicates that the classification has been omitted
103 #define MM_NULL 0L
106 * Definitions of type classifications:
107 * MM_HARD Hardware
108 * MM_SOFT Software
109 * MM_FIRM Firmware
112 #define MM_HARD 0x00000001L
113 #define MM_SOFT 0x00000002L
114 #define MM_FIRM 0x00000004L
117 * Definitions of recoverability subclassification
118 * MM_RECOVER Recoverable
119 * MM_NRECOV Non-recoverable
122 #define MM_RECOVER 0x00000100L
123 #define MM_NRECOV 0x00000200L
126 * Definitions of source subclassification
127 * MM_APPL Application
128 * MM_UTIL Utility
129 * MM_OPSYS Kernel
132 #define MM_APPL 0x00000008L
133 #define MM_UTIL 0x00000010L
134 #define MM_OPSYS 0x00000020L
137 * Definitions for the action to take with the message:
138 * MM_PRINT Write to the standard error stream
139 * MM_CONSOLE Treat the message as a console message
142 #define MM_PRINT 0x00000040L
143 #define MM_CONSOLE 0x00000080L
146 * Constants for severity values
148 * SEV_LEVEL Names the env variable that defines severities
150 * MM_NOSEV Message has no severity
151 * MM_HALT Message describes a severe error condition
152 * MM_ERROR Message describes an error condition
153 * MM_WARNING Message tells of probable error condition
154 * MM_INFO Message informs, not in error
157 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
158 #define SEV_LEVEL "SEV_LEVEL"
159 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
161 #define MM_NOSEV 0
162 #define MM_HALT 1
163 #define MM_ERROR 2
164 #define MM_WARNING 3
165 #define MM_INFO 4
168 * Null values for message components
169 * MM_NULLLBL Null value for the label-component
170 * MM_NULLSEV Null value for the severity-component
171 * MM_NULLMC Null value for the classification-component
172 * MM_NULLTXT Null value for the text-component
173 * MM_NULLACT Null value for the action-component
174 * MM_NULLTAG Null value for the tag-component
177 #define MM_NULLLBL ((char *)_NULL)
178 #define MM_NULLSEV MM_NOSEV
179 #define MM_NULLMC MM_NULL
180 #define MM_NULLTXT ((char *)_NULL)
181 #define MM_NULLACT ((char *)_NULL)
182 #define MM_NULLTAG ((char *)_NULL)
185 * Values returned by fmtmsg()
187 * MM_NOTOK None of the requested messages were generated
188 * MM_NOMSG No message was written to stderr
189 * MM_NOCON No console message was generated
192 #define MM_NOTOK -1
193 #define MM_OK 0x00
194 #define MM_NOMSG 0x01
195 #define MM_NOCON 0x04
197 /* Function definition */
199 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
200 int addseverity(int, const char *);
201 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
203 int fmtmsg(long, const char *, int, const char *, const char *,
204 const char *);
206 #ifdef __cplusplus
208 #endif
210 #endif /* _FMTMSG_H */