xref: /titanic_41/usr/src/lib/libtnfctl/prb_status.c (revision dd49f125507979bb2ab505a8daf2a46d1be27051)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1994, by Sun Microsytems, Inc.
24  */
25 
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 /*
29  * Interfaces to print error codes and to map an errno to an error code.
30  */
31 
32 #include <string.h>
33 #include <libintl.h>
34 
35 #include "tnfctl_int.h"
36 #include "dbg.h"
37 
38 
39 #if !defined(TEXT_DOMAIN)
40 #define	TEXT_DOMAIN	"SYS_TEST"
41 #endif
42 
43 /*
44  * prb_status_str() - this routine returns a pointer to a static string
45  * describing the error argument.
46  */
47 const char	 *
48 prb_status_str(prb_status_t prbstat)
49 {
50 	/* if this is in the errno range, use the errno string */
51 	if (prbstat >= PRB_STATUS_MINERRNO &&
52 		prbstat <= PRB_STATUS_MAXERRNO) {
53 		return (strerror(prbstat));
54 	} else {
55 		switch (prbstat) {
56 		case PRB_STATUS_OK:
57 			return (dgettext(TEXT_DOMAIN, "success"));
58 		case PRB_STATUS_ALLOCFAIL:
59 			return (dgettext(TEXT_DOMAIN,
60 				"memory allocation failed"));
61 		case PRB_STATUS_BADARG:
62 			return (dgettext(TEXT_DOMAIN, "bad input argument"));
63 		case PRB_STATUS_BADSYNC:
64 			return (dgettext(TEXT_DOMAIN,
65 				"couldn't sync with rtld"));
66 		case PRB_STATUS_BADLMAPSTATE:
67 			return (dgettext(TEXT_DOMAIN, "inconsistent link map"));
68 		default:
69 			return (dgettext(TEXT_DOMAIN,
70 				"Unknown libtnfctl.so prb layer error code"));
71 		}
72 	}
73 }
74 
75 /*
76  * prb_status_map() - this routine converts an errno value into a
77  * prb_status_t.
78  */
79 prb_status_t
80 prb_status_map(int val)
81 {
82 	return (val);
83 
84 }
85