xref: /onnv-gate/usr/src/lib/fm/libfmd_snmp/common/debug_subr.c (revision 11050:be69f645ce17)
11303Swesolows /*
21303Swesolows  * CDDL HEADER START
31303Swesolows  *
41303Swesolows  * The contents of this file are subject to the terms of the
51303Swesolows  * Common Development and Distribution License (the "License").
61303Swesolows  * You may not use this file except in compliance with the License.
71303Swesolows  *
81303Swesolows  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
91303Swesolows  * or http://www.opensolaris.org/os/licensing.
101303Swesolows  * See the License for the specific language governing permissions
111303Swesolows  * and limitations under the License.
121303Swesolows  *
131303Swesolows  * When distributing Covered Code, include this CDDL HEADER in each
141303Swesolows  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
151303Swesolows  * If applicable, add the following below this CDDL HEADER, with the
161303Swesolows  * fields enclosed by brackets "[]" replaced with your own identifying
171303Swesolows  * information: Portions Copyright [yyyy] [name of copyright owner]
181303Swesolows  *
191303Swesolows  * CDDL HEADER END
201303Swesolows  */
211303Swesolows 
221303Swesolows /*
23*11050SRobert.Johnston@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
241303Swesolows  * Use is subject to license terms.
251303Swesolows  */
261303Swesolows 
271303Swesolows #include <net-snmp/net-snmp-config.h>
281303Swesolows #include <net-snmp/net-snmp-includes.h>
291303Swesolows #include <net-snmp/agent/net-snmp-agent-includes.h>
301303Swesolows #include <stdarg.h>
311303Swesolows 
321303Swesolows void
sunFm_vpanic(const char * format,va_list ap)331303Swesolows sunFm_vpanic(const char *format, va_list ap)
341303Swesolows {
35*11050SRobert.Johnston@Sun.COM 	(void) snmp_vlog(LOG_ERR, format, ap);
361303Swesolows #ifdef DEBUG
371303Swesolows 	abort();
381303Swesolows 	exit(1);
391303Swesolows #endif
401303Swesolows }
411303Swesolows 
421303Swesolows void
sunFm_panic(const char * format,...)431303Swesolows sunFm_panic(const char *format, ...)
441303Swesolows {
451303Swesolows 	va_list	ap;
461303Swesolows 
471303Swesolows 	va_start(ap, format);
481303Swesolows 	sunFm_vpanic(format, ap);
491303Swesolows 	va_end(ap);
501303Swesolows }
511303Swesolows 
521303Swesolows int
sunFm_assert(const char * expr,const char * file,int line)531303Swesolows sunFm_assert(const char *expr, const char *file, int line)
541303Swesolows {
551303Swesolows 	sunFm_panic("\"%s\", line %d: assertion failed: %s\n", file, line,
561303Swesolows 	    expr);
571303Swesolows 	return (0);
581303Swesolows }
59