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 #include <dtrace.h> 28 29 /* 30 * Not currently providing name equivalents of dtrace_errno, only the error 31 * message provided by libdtrace (which cannot be localized). The reason is 32 * that the EDT_ enumeration is still private. The DTRACEFLT_ values are 33 * public, however, so the API provides string equivalents for runtime faults 34 * encountered in the error handler (see dtrace_handle_err()). The API provides 35 * the error as a string rather than an integer so that user applications do not 36 * break if the integer values change. 37 */ 38 39 const char * 40 dtj_get_fault_name(int fault) 41 { 42 const char *name = NULL; 43 44 switch (fault) { 45 case DTRACEFLT_BADADDR: 46 name = "DTRACEFLT_BADADDR"; 47 break; 48 case DTRACEFLT_BADALIGN: 49 name = "DTRACEFLT_BADALIGN"; 50 break; 51 case DTRACEFLT_ILLOP: 52 name = "DTRACEFLT_ILLOP"; 53 break; 54 case DTRACEFLT_DIVZERO: 55 name = "DTRACEFLT_DIVZERO"; 56 break; 57 case DTRACEFLT_NOSCRATCH: 58 name = "DTRACEFLT_NOSCRATCH"; 59 break; 60 case DTRACEFLT_KPRIV: 61 name = "DTRACEFLT_KPRIV"; 62 break; 63 case DTRACEFLT_UPRIV: 64 name = "DTRACEFLT_UPRIV"; 65 break; 66 case DTRACEFLT_TUPOFLOW: 67 name = "DTRACEFLT_TUPOFLOW"; 68 break; 69 case DTRACEFLT_BADSTACK: 70 name = "DTRACEFLT_BADSTACK"; 71 break; 72 case DTRACEFLT_LIBRARY: 73 name = "DTRACEFLT_LIBRARY"; 74 break; 75 default: 76 name = NULL; 77 } 78 79 return (name); 80 } 81