xref: /freebsd/include/fmtmsg.h (revision b3e7694832e81d7a904a10f525f8797b753bf0d3)
1823f68a2SMike Barcroft /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3e58eb3c4SPedro F. Giffuni  *
4823f68a2SMike Barcroft  * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
5823f68a2SMike Barcroft  * All rights reserved.
6823f68a2SMike Barcroft  *
7823f68a2SMike Barcroft  * Redistribution and use in source and binary forms, with or without
8823f68a2SMike Barcroft  * modification, are permitted provided that the following conditions
9823f68a2SMike Barcroft  * are met:
10823f68a2SMike Barcroft  * 1. Redistributions of source code must retain the above copyright
11823f68a2SMike Barcroft  *    notice, this list of conditions and the following disclaimer.
12823f68a2SMike Barcroft  * 2. Redistributions in binary form must reproduce the above copyright
13823f68a2SMike Barcroft  *    notice, this list of conditions and the following disclaimer in the
14823f68a2SMike Barcroft  *    documentation and/or other materials provided with the distribution.
15823f68a2SMike Barcroft  *
16823f68a2SMike Barcroft  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17823f68a2SMike Barcroft  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18823f68a2SMike Barcroft  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19823f68a2SMike Barcroft  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20823f68a2SMike Barcroft  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21823f68a2SMike Barcroft  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22823f68a2SMike Barcroft  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23823f68a2SMike Barcroft  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24823f68a2SMike Barcroft  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25823f68a2SMike Barcroft  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26823f68a2SMike Barcroft  * SUCH DAMAGE.
27823f68a2SMike Barcroft  */
28823f68a2SMike Barcroft 
29823f68a2SMike Barcroft #ifndef _FMTMSG_H_
30823f68a2SMike Barcroft #define	_FMTMSG_H_
31823f68a2SMike Barcroft 
32823f68a2SMike Barcroft /* Source of condition is... */
33b79204a1SMike Barcroft #define	MM_HARD		0x0001	/* ...hardware. */
34b79204a1SMike Barcroft #define	MM_SOFT		0x0002	/* ...software. */
359b1ae081SEd Schouten #define	MM_FIRM		0x0004	/* ...firmware. */
36823f68a2SMike Barcroft 
37823f68a2SMike Barcroft /* Condition detected by... */
38b79204a1SMike Barcroft #define	MM_APPL		0x0010	/* ...application. */
39b79204a1SMike Barcroft #define	MM_UTIL		0x0020	/* ...utility. */
40b79204a1SMike Barcroft #define	MM_OPSYS	0x0040	/* ...operating system. */
41823f68a2SMike Barcroft 
42823f68a2SMike Barcroft /* Display on... */
43b79204a1SMike Barcroft #define	MM_PRINT	0x0100	/* ...standard error. */
44b79204a1SMike Barcroft #define	MM_CONSOLE	0x0200	/* ...system console. */
45823f68a2SMike Barcroft 
46823f68a2SMike Barcroft #define	MM_RECOVER	0x1000	/* Recoverable error. */
47823f68a2SMike Barcroft #define	MM_NRECOV	0x2000	/* Non-recoverable error. */
48823f68a2SMike Barcroft 
49823f68a2SMike Barcroft /* Severity levels. */
50823f68a2SMike Barcroft #define	MM_NOSEV	0	/* No severity level provided. */
51823f68a2SMike Barcroft #define	MM_HALT		1	/* Error causing application to halt. */
52823f68a2SMike Barcroft #define	MM_ERROR	2	/* Non-fault fault. */
53823f68a2SMike Barcroft #define	MM_WARNING	3	/* Unusual non-error condition. */
54823f68a2SMike Barcroft #define	MM_INFO		4	/* Informative message. */
55823f68a2SMike Barcroft 
56823f68a2SMike Barcroft /* Null options. */
57823f68a2SMike Barcroft #define	MM_NULLLBL	(char *)0
58823f68a2SMike Barcroft #define	MM_NULLSEV	0
59823f68a2SMike Barcroft #define	MM_NULLMC	0L
60823f68a2SMike Barcroft #define	MM_NULLTXT	(char *)0
61823f68a2SMike Barcroft #define	MM_NULLACT	(char *)0
62823f68a2SMike Barcroft #define	MM_NULLTAG	(char *)0
63823f68a2SMike Barcroft 
64823f68a2SMike Barcroft /* Return values. */
65823f68a2SMike Barcroft #define	MM_OK		0	/* Success. */
66823f68a2SMike Barcroft #define	MM_NOMSG	1	/* Failed to output to stderr. */
67823f68a2SMike Barcroft #define	MM_NOCON	2	/* Failed to output to console. */
68823f68a2SMike Barcroft #define	MM_NOTOK	3	/* Failed to output anything. */
69823f68a2SMike Barcroft 
70b79204a1SMike Barcroft int	fmtmsg(long, const char *, int, const char *, const char *,
71b79204a1SMike Barcroft 	    const char *);
72823f68a2SMike Barcroft 
73b79204a1SMike Barcroft #endif /* !_FMTMSG_H_ */
74