1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 #include <dtrace.h> 30 31 /* 32 * Not currently providing name equivalents of dtrace_errno, only the error 33 * message provided by libdtrace (which cannot be localized). The reason is 34 * that the EDT_ enumeration is still private. The DTRACEFLT_ values are 35 * public, however, so the API provides string equivalents for runtime faults 36 * encountered in the error handler (see dtrace_handle_err()). The API provides 37 * the error as a string rather than an integer so that user applications do not 38 * break if the integer values change. 39 */ 40 41 const char * dtj_get_fault_name(int fault)42dtj_get_fault_name(int fault) 43 { 44 const char *name = NULL; 45 46 switch (fault) { 47 case DTRACEFLT_BADADDR: 48 name = "DTRACEFLT_BADADDR"; 49 break; 50 case DTRACEFLT_BADALIGN: 51 name = "DTRACEFLT_BADALIGN"; 52 break; 53 case DTRACEFLT_ILLOP: 54 name = "DTRACEFLT_ILLOP"; 55 break; 56 case DTRACEFLT_DIVZERO: 57 name = "DTRACEFLT_DIVZERO"; 58 break; 59 case DTRACEFLT_NOSCRATCH: 60 name = "DTRACEFLT_NOSCRATCH"; 61 break; 62 case DTRACEFLT_KPRIV: 63 name = "DTRACEFLT_KPRIV"; 64 break; 65 case DTRACEFLT_UPRIV: 66 name = "DTRACEFLT_UPRIV"; 67 break; 68 case DTRACEFLT_TUPOFLOW: 69 name = "DTRACEFLT_TUPOFLOW"; 70 break; 71 case DTRACEFLT_BADSTACK: 72 name = "DTRACEFLT_BADSTACK"; 73 break; 74 case DTRACEFLT_LIBRARY: 75 name = "DTRACEFLT_LIBRARY"; 76 break; 77 default: 78 name = NULL; 79 } 80 81 return (name); 82 } 83