1749f21d3Swesolows /*
2749f21d3Swesolows  * CDDL HEADER START
3749f21d3Swesolows  *
4749f21d3Swesolows  * The contents of this file are subject to the terms of the
5749f21d3Swesolows  * Common Development and Distribution License (the "License").
6749f21d3Swesolows  * You may not use this file except in compliance with the License.
7749f21d3Swesolows  *
8749f21d3Swesolows  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9749f21d3Swesolows  * or http://www.opensolaris.org/os/licensing.
10749f21d3Swesolows  * See the License for the specific language governing permissions
11749f21d3Swesolows  * and limitations under the License.
12749f21d3Swesolows  *
13749f21d3Swesolows  * When distributing Covered Code, include this CDDL HEADER in each
14749f21d3Swesolows  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15749f21d3Swesolows  * If applicable, add the following below this CDDL HEADER, with the
16749f21d3Swesolows  * fields enclosed by brackets "[]" replaced with your own identifying
17749f21d3Swesolows  * information: Portions Copyright [yyyy] [name of copyright owner]
18749f21d3Swesolows  *
19749f21d3Swesolows  * CDDL HEADER END
20749f21d3Swesolows  */
21749f21d3Swesolows 
22749f21d3Swesolows /*
23888e0559SRobert Johnston  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24749f21d3Swesolows  * Use is subject to license terms.
25749f21d3Swesolows  */
26749f21d3Swesolows 
27*44bf619dSJohn Levon /*
28*44bf619dSJohn Levon  * Copyright 2019 Joyent, Inc.
29*44bf619dSJohn Levon  */
30*44bf619dSJohn Levon 
31749f21d3Swesolows #include <net-snmp/net-snmp-config.h>
32749f21d3Swesolows #include <net-snmp/net-snmp-includes.h>
33749f21d3Swesolows #include <net-snmp/agent/net-snmp-agent-includes.h>
34749f21d3Swesolows #include <stdarg.h>
35749f21d3Swesolows 
36749f21d3Swesolows void
sunFm_vpanic(const char * format,va_list ap)37749f21d3Swesolows sunFm_vpanic(const char *format, va_list ap)
38749f21d3Swesolows {
39888e0559SRobert Johnston 	(void) snmp_vlog(LOG_ERR, format, ap);
40749f21d3Swesolows #ifdef DEBUG
41749f21d3Swesolows 	abort();
42749f21d3Swesolows #endif
43749f21d3Swesolows }
44749f21d3Swesolows 
45749f21d3Swesolows void
sunFm_panic(const char * format,...)46749f21d3Swesolows sunFm_panic(const char *format, ...)
47749f21d3Swesolows {
48749f21d3Swesolows 	va_list	ap;
49749f21d3Swesolows 
50749f21d3Swesolows 	va_start(ap, format);
51749f21d3Swesolows 	sunFm_vpanic(format, ap);
52749f21d3Swesolows 	va_end(ap);
53749f21d3Swesolows }
54749f21d3Swesolows 
55749f21d3Swesolows int
sunFm_assert(const char * expr,const char * file,int line)56749f21d3Swesolows sunFm_assert(const char *expr, const char *file, int line)
57749f21d3Swesolows {
58749f21d3Swesolows 	sunFm_panic("\"%s\", line %d: assertion failed: %s\n", file, line,
59749f21d3Swesolows 	    expr);
60749f21d3Swesolows 	return (0);
61749f21d3Swesolows }
62