xref: /illumos-gate/usr/src/lib/libnsl/nsl/_errlst.c (revision 1da57d55)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*cb620785Sraf  * Common Development and Distribution License (the "License").
6*cb620785Sraf  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
2161961e0fSrobinson 
227c478bd9Sstevel@tonic-gate /*
23*cb620785Sraf  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
27*cb620785Sraf /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28*cb620785Sraf /*	  All Rights Reserved  	*/
29*cb620785Sraf 
307c478bd9Sstevel@tonic-gate #include "mt.h"
317c478bd9Sstevel@tonic-gate #include <stdlib.h>
327c478bd9Sstevel@tonic-gate #include <thread.h>
337c478bd9Sstevel@tonic-gate #undef t_errno
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * transport errno
377c478bd9Sstevel@tonic-gate  */
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate int t_errno = 0;
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate /*
427c478bd9Sstevel@tonic-gate  * TLI Interface exposes "t_nerr" and "t_errlist" which is a poor
437c478bd9Sstevel@tonic-gate  * choice. XTI fixes that and only documents t_error() and t_strerror()
447c478bd9Sstevel@tonic-gate  * as interface. We leave these variables here alone here. We create
457c478bd9Sstevel@tonic-gate  * replica of these as a subset for use by XTI in t_strerror(). The
467c478bd9Sstevel@tonic-gate  * first part of the replica is same as here.
477c478bd9Sstevel@tonic-gate  * The rest of the errors are defined only in XTI.
487c478bd9Sstevel@tonic-gate  */
497c478bd9Sstevel@tonic-gate int t_nerr = 19;
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate /*
527c478bd9Sstevel@tonic-gate  * transport interface error list
537c478bd9Sstevel@tonic-gate  */
547c478bd9Sstevel@tonic-gate 
5561961e0fSrobinson char *t_errlist[] = {
567c478bd9Sstevel@tonic-gate 	"No Error",					/*  0 */
577c478bd9Sstevel@tonic-gate 	"Incorrect address format",			/*  1 */
587c478bd9Sstevel@tonic-gate 	"Incorrect options format",			/*  2 */
597c478bd9Sstevel@tonic-gate 	"Illegal permissions",				/*  3 */
607c478bd9Sstevel@tonic-gate 	"Illegal file descriptor",			/*  4 */
617c478bd9Sstevel@tonic-gate 	"Couldn't allocate address",			/*  5 */
627c478bd9Sstevel@tonic-gate 	"Routine will place interface out of state",    /*  6 */
637c478bd9Sstevel@tonic-gate 	"Illegal called/calling sequence number",	/*  7 */
647c478bd9Sstevel@tonic-gate 	"System error",					/*  8 */
657c478bd9Sstevel@tonic-gate 	"An event requires attention",			/*  9 */
667c478bd9Sstevel@tonic-gate 	"Illegal amount of data",			/* 10 */
677c478bd9Sstevel@tonic-gate 	"Buffer not large enough",			/* 11 */
687c478bd9Sstevel@tonic-gate 	"Can't send message - (blocked)",		/* 12 */
697c478bd9Sstevel@tonic-gate 	"No message currently available",		/* 13 */
707c478bd9Sstevel@tonic-gate 	"Disconnect message not found",			/* 14 */
717c478bd9Sstevel@tonic-gate 	"Unitdata error message not found",		/* 15 */
727c478bd9Sstevel@tonic-gate 	"Incorrect flags specified",			/* 16 */
737c478bd9Sstevel@tonic-gate 	"Orderly release message not found",		/* 17 */
747c478bd9Sstevel@tonic-gate 	"Primitive not supported by provider",		/* 18 */
757c478bd9Sstevel@tonic-gate 	"State is in process of changing",		/* 19 */
767c478bd9Sstevel@tonic-gate 	"",
777c478bd9Sstevel@tonic-gate 	"",
787c478bd9Sstevel@tonic-gate 	"",
797c478bd9Sstevel@tonic-gate 	"",
807c478bd9Sstevel@tonic-gate 	"",
817c478bd9Sstevel@tonic-gate 	"",
827c478bd9Sstevel@tonic-gate 	"",
837c478bd9Sstevel@tonic-gate 	"",
847c478bd9Sstevel@tonic-gate 	"",
857c478bd9Sstevel@tonic-gate 	"",
867c478bd9Sstevel@tonic-gate 	"",
877c478bd9Sstevel@tonic-gate 	"",
887c478bd9Sstevel@tonic-gate 	"",
897c478bd9Sstevel@tonic-gate 	"",
907c478bd9Sstevel@tonic-gate 	"",
917c478bd9Sstevel@tonic-gate 	"",
927c478bd9Sstevel@tonic-gate 	"",
937c478bd9Sstevel@tonic-gate 	"",
947c478bd9Sstevel@tonic-gate 	"",
957c478bd9Sstevel@tonic-gate 	"",
967c478bd9Sstevel@tonic-gate 	"",
977c478bd9Sstevel@tonic-gate 	"",
987c478bd9Sstevel@tonic-gate 	"",
997c478bd9Sstevel@tonic-gate 	"",
1007c478bd9Sstevel@tonic-gate 	"",
1017c478bd9Sstevel@tonic-gate 	"",
1027c478bd9Sstevel@tonic-gate 	"",
1037c478bd9Sstevel@tonic-gate 	"",
1047c478bd9Sstevel@tonic-gate 	"",
1057c478bd9Sstevel@tonic-gate 	"",
1067c478bd9Sstevel@tonic-gate 	"",
1077c478bd9Sstevel@tonic-gate 	"",
1087c478bd9Sstevel@tonic-gate 	"",
1097c478bd9Sstevel@tonic-gate 	"",
1107c478bd9Sstevel@tonic-gate 	"",
1117c478bd9Sstevel@tonic-gate 	"",
1127c478bd9Sstevel@tonic-gate 	"",
1137c478bd9Sstevel@tonic-gate 	""
1147c478bd9Sstevel@tonic-gate 	/*
1157c478bd9Sstevel@tonic-gate 	 *	N.B.:  t_errlist must not expand beyond this point or binary
1167c478bd9Sstevel@tonic-gate 	 *	compatibility will be broken.  When necessary to accomodate
1177c478bd9Sstevel@tonic-gate 	 *	more error strings, they may only be added to the list printed
1187c478bd9Sstevel@tonic-gate 	 *	by t_strerror(), q.v..  Currently, t_strerror() conserves space
1197c478bd9Sstevel@tonic-gate 	 *	by pointing into t_errlist[].  To expand beyond 57 errors, it
1207c478bd9Sstevel@tonic-gate 	 *	will be necessary to change t_strerror() to use a different
1217c478bd9Sstevel@tonic-gate 	 *	array.
1227c478bd9Sstevel@tonic-gate 	 */
1237c478bd9Sstevel@tonic-gate };
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate int *
__t_errno(void)12761961e0fSrobinson __t_errno(void)
1287c478bd9Sstevel@tonic-gate {
129*cb620785Sraf 	static pthread_key_t t_errno_key = PTHREAD_ONCE_KEY_NP;
1307c478bd9Sstevel@tonic-gate 	int *ret;
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate 	if (thr_main())
1337c478bd9Sstevel@tonic-gate 		return (&t_errno);
1347c478bd9Sstevel@tonic-gate 	ret = thr_get_storage(&t_errno_key, sizeof (int), free);
1357c478bd9Sstevel@tonic-gate 	/* if thr_get_storage fails we return the address of t_errno */
1367c478bd9Sstevel@tonic-gate 	return (ret ? ret : &t_errno);
1377c478bd9Sstevel@tonic-gate }
138