xref: /onnv-gate/usr/src/lib/libdtrace_jni/common/dtj_error.c (revision 3682:48f0fd311ddb)
11449Stomee /*
21449Stomee  * CDDL HEADER START
31449Stomee  *
41449Stomee  * The contents of this file are subject to the terms of the
51449Stomee  * Common Development and Distribution License (the "License").
61449Stomee  * You may not use this file except in compliance with the License.
71449Stomee  *
81449Stomee  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
91449Stomee  * or http://www.opensolaris.org/os/licensing.
101449Stomee  * See the License for the specific language governing permissions
111449Stomee  * and limitations under the License.
121449Stomee  *
131449Stomee  * When distributing Covered Code, include this CDDL HEADER in each
141449Stomee  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
151449Stomee  * If applicable, add the following below this CDDL HEADER, with the
161449Stomee  * fields enclosed by brackets "[]" replaced with your own identifying
171449Stomee  * information: Portions Copyright [yyyy] [name of copyright owner]
181449Stomee  *
191449Stomee  * CDDL HEADER END
201449Stomee  */
211449Stomee 
221449Stomee /*
23*3682Sjhaslam  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
241449Stomee  * Use is subject to license terms.
251449Stomee  */
261449Stomee 
271449Stomee #pragma ident	"%Z%%M%	%I%	%E% SMI"
281449Stomee 
291449Stomee #include <dtrace.h>
301449Stomee 
311449Stomee /*
321449Stomee  * Not currently providing name equivalents of dtrace_errno, only the error
331449Stomee  * message provided by libdtrace (which cannot be localized).  The reason is
341449Stomee  * that the EDT_ enumeration is still private.  The DTRACEFLT_ values are
351449Stomee  * public, however, so the API provides string equivalents for runtime faults
361449Stomee  * encountered in the error handler (see dtrace_handle_err()).  The API provides
371449Stomee  * the error as a string rather than an integer so that user applications do not
381449Stomee  * break if the integer values change.
391449Stomee  */
401449Stomee 
411449Stomee const char *
dtj_get_fault_name(int fault)421449Stomee dtj_get_fault_name(int fault)
431449Stomee {
441449Stomee 	const char *name = NULL;
451449Stomee 
461449Stomee 	switch (fault) {
471449Stomee 	case DTRACEFLT_BADADDR:
481449Stomee 		name = "DTRACEFLT_BADADDR";
491449Stomee 		break;
501449Stomee 	case DTRACEFLT_BADALIGN:
511449Stomee 		name = "DTRACEFLT_BADALIGN";
521449Stomee 		break;
531449Stomee 	case DTRACEFLT_ILLOP:
541449Stomee 		name = "DTRACEFLT_ILLOP";
551449Stomee 		break;
561449Stomee 	case DTRACEFLT_DIVZERO:
571449Stomee 		name = "DTRACEFLT_DIVZERO";
581449Stomee 		break;
591449Stomee 	case DTRACEFLT_NOSCRATCH:
601449Stomee 		name = "DTRACEFLT_NOSCRATCH";
611449Stomee 		break;
621449Stomee 	case DTRACEFLT_KPRIV:
631449Stomee 		name = "DTRACEFLT_KPRIV";
641449Stomee 		break;
651449Stomee 	case DTRACEFLT_UPRIV:
661449Stomee 		name = "DTRACEFLT_UPRIV";
671449Stomee 		break;
681449Stomee 	case DTRACEFLT_TUPOFLOW:
691449Stomee 		name = "DTRACEFLT_TUPOFLOW";
701449Stomee 		break;
71*3682Sjhaslam 	case DTRACEFLT_BADSTACK:
72*3682Sjhaslam 		name = "DTRACEFLT_BADSTACK";
73*3682Sjhaslam 		break;
741449Stomee 	case DTRACEFLT_LIBRARY:
751449Stomee 		name = "DTRACEFLT_LIBRARY";
761449Stomee 		break;
771449Stomee 	default:
781449Stomee 		name = NULL;
791449Stomee 	}
801449Stomee 
811449Stomee 	return (name);
821449Stomee }
83