1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* Copyright (c) 1988 AT&T */ 23*0Sstevel@tonic-gate /* All Rights Reserved */ 24*0Sstevel@tonic-gate 25*0Sstevel@tonic-gate 26*0Sstevel@tonic-gate /* 27*0Sstevel@tonic-gate * Copyright 1996-2003 Sun Microsystems, Inc. All rights reserved. 28*0Sstevel@tonic-gate * Use is subject to license terms. 29*0Sstevel@tonic-gate */ 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gate #ifndef _FMTMSG_H 32*0Sstevel@tonic-gate #define _FMTMSG_H 33*0Sstevel@tonic-gate 34*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */ 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate #include <sys/feature_tests.h> 37*0Sstevel@tonic-gate 38*0Sstevel@tonic-gate #ifdef __cplusplus 39*0Sstevel@tonic-gate extern "C" { 40*0Sstevel@tonic-gate #endif 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate /* 43*0Sstevel@tonic-gate * fmtmsg.h 44*0Sstevel@tonic-gate * 45*0Sstevel@tonic-gate * The <fmtmsg.h> header file contains the definitions needed 46*0Sstevel@tonic-gate * to use the fmtmsg() function. This function writes messages 47*0Sstevel@tonic-gate * in a standard format to the standard error stream (stderr) 48*0Sstevel@tonic-gate * and to the system console. 49*0Sstevel@tonic-gate */ 50*0Sstevel@tonic-gate 51*0Sstevel@tonic-gate /* 52*0Sstevel@tonic-gate * Define the value "NULL" if it hasn't been defined already. 53*0Sstevel@tonic-gate * NULL breaks namespace so we define _NULL 54*0Sstevel@tonic-gate */ 55*0Sstevel@tonic-gate #if defined(_LP64) 56*0Sstevel@tonic-gate #define _NULL 0L 57*0Sstevel@tonic-gate #else 58*0Sstevel@tonic-gate #define _NULL 0 59*0Sstevel@tonic-gate #endif 60*0Sstevel@tonic-gate 61*0Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 62*0Sstevel@tonic-gate #ifndef NULL 63*0Sstevel@tonic-gate #define NULL _NULL 64*0Sstevel@tonic-gate #endif 65*0Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ 66*0Sstevel@tonic-gate 67*0Sstevel@tonic-gate 68*0Sstevel@tonic-gate /* 69*0Sstevel@tonic-gate * Constraint definitions: 70*0Sstevel@tonic-gate * MM_MXLABELLN Maximum size of a "label" in a message 71*0Sstevel@tonic-gate * MM_MXTAGLN Maximum size of a "tag" in a message 72*0Sstevel@tonic-gate * MM_MXTXTLN Maximum size of a text string 73*0Sstevel@tonic-gate * MM_MXACTLN Maximum size of an action string 74*0Sstevel@tonic-gate */ 75*0Sstevel@tonic-gate 76*0Sstevel@tonic-gate #define MM_MXLABELLN 25 77*0Sstevel@tonic-gate #define MM_MXTAGLN 32 78*0Sstevel@tonic-gate #define MM_MXTXTLN 512 79*0Sstevel@tonic-gate #define MM_MXACTLN 512 80*0Sstevel@tonic-gate 81*0Sstevel@tonic-gate /* 82*0Sstevel@tonic-gate * Environment variable names used by fmtmsg(): 83*0Sstevel@tonic-gate * MSGVERB Tells fmtmsg() which components it is to write 84*0Sstevel@tonic-gate * to the standard error stream 85*0Sstevel@tonic-gate */ 86*0Sstevel@tonic-gate 87*0Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 88*0Sstevel@tonic-gate #define MSGVERB "MSGVERB" 89*0Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ 90*0Sstevel@tonic-gate 91*0Sstevel@tonic-gate /* 92*0Sstevel@tonic-gate * Classification information 93*0Sstevel@tonic-gate * - Definition of classifications 94*0Sstevel@tonic-gate * - Definition of recoverability 95*0Sstevel@tonic-gate * - Definition of source classifications 96*0Sstevel@tonic-gate */ 97*0Sstevel@tonic-gate 98*0Sstevel@tonic-gate /* 99*0Sstevel@tonic-gate * Definition of the "null" classification 100*0Sstevel@tonic-gate * MM_NULL Indicates that the classification has been omitted 101*0Sstevel@tonic-gate */ 102*0Sstevel@tonic-gate 103*0Sstevel@tonic-gate #define MM_NULL 0L 104*0Sstevel@tonic-gate 105*0Sstevel@tonic-gate /* 106*0Sstevel@tonic-gate * Definitions of type classifications: 107*0Sstevel@tonic-gate * MM_HARD Hardware 108*0Sstevel@tonic-gate * MM_SOFT Software 109*0Sstevel@tonic-gate * MM_FIRM Firmware 110*0Sstevel@tonic-gate */ 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gate #define MM_HARD 0x00000001L 113*0Sstevel@tonic-gate #define MM_SOFT 0x00000002L 114*0Sstevel@tonic-gate #define MM_FIRM 0x00000004L 115*0Sstevel@tonic-gate 116*0Sstevel@tonic-gate /* 117*0Sstevel@tonic-gate * Definitions of recoverability subclassification 118*0Sstevel@tonic-gate * MM_RECOVER Recoverable 119*0Sstevel@tonic-gate * MM_NRECOV Non-recoverable 120*0Sstevel@tonic-gate */ 121*0Sstevel@tonic-gate 122*0Sstevel@tonic-gate #define MM_RECOVER 0x00000100L 123*0Sstevel@tonic-gate #define MM_NRECOV 0x00000200L 124*0Sstevel@tonic-gate 125*0Sstevel@tonic-gate /* 126*0Sstevel@tonic-gate * Definitions of source subclassification 127*0Sstevel@tonic-gate * MM_APPL Application 128*0Sstevel@tonic-gate * MM_UTIL Utility 129*0Sstevel@tonic-gate * MM_OPSYS Kernel 130*0Sstevel@tonic-gate */ 131*0Sstevel@tonic-gate 132*0Sstevel@tonic-gate #define MM_APPL 0x00000008L 133*0Sstevel@tonic-gate #define MM_UTIL 0x00000010L 134*0Sstevel@tonic-gate #define MM_OPSYS 0x00000020L 135*0Sstevel@tonic-gate 136*0Sstevel@tonic-gate /* 137*0Sstevel@tonic-gate * Definitions for the action to take with the message: 138*0Sstevel@tonic-gate * MM_PRINT Write to the standard error stream 139*0Sstevel@tonic-gate * MM_CONSOLE Treat the message as a console message 140*0Sstevel@tonic-gate */ 141*0Sstevel@tonic-gate 142*0Sstevel@tonic-gate #define MM_PRINT 0x00000040L 143*0Sstevel@tonic-gate #define MM_CONSOLE 0x00000080L 144*0Sstevel@tonic-gate 145*0Sstevel@tonic-gate /* 146*0Sstevel@tonic-gate * Constants for severity values 147*0Sstevel@tonic-gate * 148*0Sstevel@tonic-gate * SEV_LEVEL Names the env variable that defines severities 149*0Sstevel@tonic-gate * 150*0Sstevel@tonic-gate * MM_NOSEV Message has no severity 151*0Sstevel@tonic-gate * MM_HALT Message describes a severe error condition 152*0Sstevel@tonic-gate * MM_ERROR Message describes an error condition 153*0Sstevel@tonic-gate * MM_WARNING Message tells of probable error condition 154*0Sstevel@tonic-gate * MM_INFO Message informs, not in error 155*0Sstevel@tonic-gate */ 156*0Sstevel@tonic-gate 157*0Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 158*0Sstevel@tonic-gate #define SEV_LEVEL "SEV_LEVEL" 159*0Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ 160*0Sstevel@tonic-gate 161*0Sstevel@tonic-gate #define MM_NOSEV 0 162*0Sstevel@tonic-gate #define MM_HALT 1 163*0Sstevel@tonic-gate #define MM_ERROR 2 164*0Sstevel@tonic-gate #define MM_WARNING 3 165*0Sstevel@tonic-gate #define MM_INFO 4 166*0Sstevel@tonic-gate 167*0Sstevel@tonic-gate /* 168*0Sstevel@tonic-gate * Null values for message components 169*0Sstevel@tonic-gate * MM_NULLLBL Null value for the label-component 170*0Sstevel@tonic-gate * MM_NULLSEV Null value for the severity-component 171*0Sstevel@tonic-gate * MM_NULLMC Null value for the classification-component 172*0Sstevel@tonic-gate * MM_NULLTXT Null value for the text-component 173*0Sstevel@tonic-gate * MM_NULLACT Null value for the action-component 174*0Sstevel@tonic-gate * MM_NULLTAG Null value for the tag-component 175*0Sstevel@tonic-gate */ 176*0Sstevel@tonic-gate 177*0Sstevel@tonic-gate #define MM_NULLLBL ((char *)_NULL) 178*0Sstevel@tonic-gate #define MM_NULLSEV MM_NOSEV 179*0Sstevel@tonic-gate #define MM_NULLMC MM_NULL 180*0Sstevel@tonic-gate #define MM_NULLTXT ((char *)_NULL) 181*0Sstevel@tonic-gate #define MM_NULLACT ((char *)_NULL) 182*0Sstevel@tonic-gate #define MM_NULLTAG ((char *)_NULL) 183*0Sstevel@tonic-gate 184*0Sstevel@tonic-gate /* 185*0Sstevel@tonic-gate * Values returned by fmtmsg() 186*0Sstevel@tonic-gate * 187*0Sstevel@tonic-gate * MM_NOTOK None of the requested messages were generated 188*0Sstevel@tonic-gate * MM_NOMSG No message was written to stderr 189*0Sstevel@tonic-gate * MM_NOCON No console message was generated 190*0Sstevel@tonic-gate */ 191*0Sstevel@tonic-gate 192*0Sstevel@tonic-gate #define MM_NOTOK -1 193*0Sstevel@tonic-gate #define MM_OK 0x00 194*0Sstevel@tonic-gate #define MM_NOMSG 0x01 195*0Sstevel@tonic-gate #define MM_NOCON 0x04 196*0Sstevel@tonic-gate 197*0Sstevel@tonic-gate /* Function definition */ 198*0Sstevel@tonic-gate 199*0Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 200*0Sstevel@tonic-gate #if defined(__STDC__) 201*0Sstevel@tonic-gate int addseverity(int, const char *); 202*0Sstevel@tonic-gate #else /* __STDC__ */ 203*0Sstevel@tonic-gate int addseverity(); 204*0Sstevel@tonic-gate #endif /* __STDC__ */ 205*0Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ 206*0Sstevel@tonic-gate 207*0Sstevel@tonic-gate #if defined(__STDC__) 208*0Sstevel@tonic-gate int fmtmsg(long, const char *, int, const char *, const char *, 209*0Sstevel@tonic-gate const char *); 210*0Sstevel@tonic-gate #else /* __STDC__ */ 211*0Sstevel@tonic-gate int fmtmsg(); 212*0Sstevel@tonic-gate #endif /* __STDC__ */ 213*0Sstevel@tonic-gate 214*0Sstevel@tonic-gate #ifdef __cplusplus 215*0Sstevel@tonic-gate } 216*0Sstevel@tonic-gate #endif 217*0Sstevel@tonic-gate 218*0Sstevel@tonic-gate #endif /* _FMTMSG_H */ 219