xref: /minix3/lib/libc/citrus/citrus_module.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: citrus_module.c,v 1.12 2015/08/28 11:45:02 joerg Exp $	*/
22fe8fb19SBen Gras 
32fe8fb19SBen Gras /*-
42fe8fb19SBen Gras  * Copyright (c)1999, 2000, 2001, 2002 Citrus Project,
52fe8fb19SBen Gras  * All rights reserved.
62fe8fb19SBen Gras  *
72fe8fb19SBen Gras  * Redistribution and use in source and binary forms, with or without
82fe8fb19SBen Gras  * modification, are permitted provided that the following conditions
92fe8fb19SBen Gras  * are met:
102fe8fb19SBen Gras  * 1. Redistributions of source code must retain the above copyright
112fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer.
122fe8fb19SBen Gras  * 2. Redistributions in binary form must reproduce the above copyright
132fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer in the
142fe8fb19SBen Gras  *    documentation and/or other materials provided with the distribution.
152fe8fb19SBen Gras  *
162fe8fb19SBen Gras  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
172fe8fb19SBen Gras  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
182fe8fb19SBen Gras  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
192fe8fb19SBen Gras  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
202fe8fb19SBen Gras  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
212fe8fb19SBen Gras  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
222fe8fb19SBen Gras  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
232fe8fb19SBen Gras  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
242fe8fb19SBen Gras  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
252fe8fb19SBen Gras  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
262fe8fb19SBen Gras  * SUCH DAMAGE.
272fe8fb19SBen Gras  */
282fe8fb19SBen Gras 
292fe8fb19SBen Gras /*-
302fe8fb19SBen Gras  * Copyright (c) 1998 The NetBSD Foundation, Inc.
312fe8fb19SBen Gras  * All rights reserved.
322fe8fb19SBen Gras  *
332fe8fb19SBen Gras  * This code is derived from software contributed to The NetBSD Foundation
342fe8fb19SBen Gras  * by Paul Kranenburg.
352fe8fb19SBen Gras  *
362fe8fb19SBen Gras  * Redistribution and use in source and binary forms, with or without
372fe8fb19SBen Gras  * modification, are permitted provided that the following conditions
382fe8fb19SBen Gras  * are met:
392fe8fb19SBen Gras  * 1. Redistributions of source code must retain the above copyright
402fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer.
412fe8fb19SBen Gras  * 2. Redistributions in binary form must reproduce the above copyright
422fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer in the
432fe8fb19SBen Gras  *    documentation and/or other materials provided with the distribution.
442fe8fb19SBen Gras  *
452fe8fb19SBen Gras  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
462fe8fb19SBen Gras  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
472fe8fb19SBen Gras  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
482fe8fb19SBen Gras  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
492fe8fb19SBen Gras  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
502fe8fb19SBen Gras  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
512fe8fb19SBen Gras  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
522fe8fb19SBen Gras  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
532fe8fb19SBen Gras  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
542fe8fb19SBen Gras  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
552fe8fb19SBen Gras  * POSSIBILITY OF SUCH DAMAGE.
562fe8fb19SBen Gras  */
572fe8fb19SBen Gras 
582fe8fb19SBen Gras /*-
592fe8fb19SBen Gras  * Copyright (c) 1993
602fe8fb19SBen Gras  *	The Regents of the University of California.  All rights reserved.
612fe8fb19SBen Gras  *
622fe8fb19SBen Gras  * This code is derived from software contributed to Berkeley by
632fe8fb19SBen Gras  * Paul Borman at Krystal Technologies.
642fe8fb19SBen Gras  *
652fe8fb19SBen Gras  * Redistribution and use in source and binary forms, with or without
662fe8fb19SBen Gras  * modification, are permitted provided that the following conditions
672fe8fb19SBen Gras  * are met:
682fe8fb19SBen Gras  * 1. Redistributions of source code must retain the above copyright
692fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer.
702fe8fb19SBen Gras  * 2. Redistributions in binary form must reproduce the above copyright
712fe8fb19SBen Gras  *    notice, this list of conditions and the following disclaimer in the
722fe8fb19SBen Gras  *    documentation and/or other materials provided with the distribution.
732fe8fb19SBen Gras  * 3. Neither the name of the University nor the names of its contributors
742fe8fb19SBen Gras  *    may be used to endorse or promote products derived from this software
752fe8fb19SBen Gras  *    without specific prior written permission.
762fe8fb19SBen Gras  *
772fe8fb19SBen Gras  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
782fe8fb19SBen Gras  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
792fe8fb19SBen Gras  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
802fe8fb19SBen Gras  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
812fe8fb19SBen Gras  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
822fe8fb19SBen Gras  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
832fe8fb19SBen Gras  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
842fe8fb19SBen Gras  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
852fe8fb19SBen Gras  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
862fe8fb19SBen Gras  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
872fe8fb19SBen Gras  * SUCH DAMAGE.
882fe8fb19SBen Gras  */
892fe8fb19SBen Gras 
902fe8fb19SBen Gras #include <sys/cdefs.h>
912fe8fb19SBen Gras #if defined(LIBC_SCCS) && !defined(lint)
92*0a6a1f1dSLionel Sambuc __RCSID("$NetBSD: citrus_module.c,v 1.12 2015/08/28 11:45:02 joerg Exp $");
932fe8fb19SBen Gras #endif /* LIBC_SCCS and not lint */
942fe8fb19SBen Gras 
952fe8fb19SBen Gras #include <assert.h>
962fe8fb19SBen Gras #include <errno.h>
972fe8fb19SBen Gras #include <limits.h>
982fe8fb19SBen Gras #include <string.h>
992fe8fb19SBen Gras #include <stdio.h>
1002fe8fb19SBen Gras #include <stdlib.h>
1012fe8fb19SBen Gras #include <unistd.h>
1022fe8fb19SBen Gras #include <stddef.h>
1032fe8fb19SBen Gras #include <paths.h>
1042fe8fb19SBen Gras #include "citrus_namespace.h"
1052fe8fb19SBen Gras #include "citrus_bcs.h"
1062fe8fb19SBen Gras #include "citrus_module.h"
1072fe8fb19SBen Gras 
1082fe8fb19SBen Gras #include <sys/types.h>
1092fe8fb19SBen Gras #include <dirent.h>
1102fe8fb19SBen Gras #include <dlfcn.h>
1112fe8fb19SBen Gras 
1122fe8fb19SBen Gras #ifdef _I18N_DYNAMIC
1132fe8fb19SBen Gras 
114f14fb602SLionel Sambuc static unsigned int _getdewey(int [], char *);
115f14fb602SLionel Sambuc static int _cmpndewey(int [], unsigned int, int [], unsigned int);
1162fe8fb19SBen Gras static const char *_findshlib(char *, int *, int *);
1172fe8fb19SBen Gras 
1182fe8fb19SBen Gras static const char *_pathI18nModule = NULL;
1192fe8fb19SBen Gras 
1202fe8fb19SBen Gras /* from libexec/ld.aout_so/shlib.c */
1212fe8fb19SBen Gras #undef major
1222fe8fb19SBen Gras #undef minor
1232fe8fb19SBen Gras #define MAXDEWEY	3	/*ELF*/
1242fe8fb19SBen Gras 
125f14fb602SLionel Sambuc static unsigned int
_getdewey(int dewey[],char * cp)1262fe8fb19SBen Gras _getdewey(int dewey[], char *cp)
1272fe8fb19SBen Gras {
128f14fb602SLionel Sambuc 	unsigned int	i, n;
1292fe8fb19SBen Gras 
1302fe8fb19SBen Gras 	_DIAGASSERT(dewey != NULL);
1312fe8fb19SBen Gras 	_DIAGASSERT(cp != NULL);
1322fe8fb19SBen Gras 
1332fe8fb19SBen Gras 	for (n = 0, i = 0; i < MAXDEWEY; i++) {
1342fe8fb19SBen Gras 		if (*cp == '\0')
1352fe8fb19SBen Gras 			break;
1362fe8fb19SBen Gras 
1372fe8fb19SBen Gras 		if (*cp == '.') cp++;
1382fe8fb19SBen Gras 		if (*cp < '0' || '9' < *cp)
1392fe8fb19SBen Gras 			return 0;
1402fe8fb19SBen Gras 
1412fe8fb19SBen Gras 		dewey[n++] = (int)_bcs_strtol(cp, &cp, 10);
1422fe8fb19SBen Gras 	}
1432fe8fb19SBen Gras 
1442fe8fb19SBen Gras 	return n;
1452fe8fb19SBen Gras }
1462fe8fb19SBen Gras 
1472fe8fb19SBen Gras /*
1482fe8fb19SBen Gras  * Compare two dewey arrays.
1492fe8fb19SBen Gras  * Return -1 if `d1' represents a smaller value than `d2'.
1502fe8fb19SBen Gras  * Return  1 if `d1' represents a greater value than `d2'.
1512fe8fb19SBen Gras  * Return  0 if equal.
1522fe8fb19SBen Gras  */
1532fe8fb19SBen Gras static int
_cmpndewey(int d1[],unsigned int n1,int d2[],unsigned int n2)154f14fb602SLionel Sambuc _cmpndewey(int d1[], unsigned int n1, int d2[], unsigned int n2)
1552fe8fb19SBen Gras {
156f14fb602SLionel Sambuc 	register unsigned int	i;
1572fe8fb19SBen Gras 
1582fe8fb19SBen Gras 	_DIAGASSERT(d1 != NULL);
1592fe8fb19SBen Gras 	_DIAGASSERT(d2 != NULL);
1602fe8fb19SBen Gras 
1612fe8fb19SBen Gras 	for (i = 0; i < n1 && i < n2; i++) {
1622fe8fb19SBen Gras 		if (d1[i] < d2[i])
1632fe8fb19SBen Gras 			return -1;
1642fe8fb19SBen Gras 		if (d1[i] > d2[i])
1652fe8fb19SBen Gras 			return 1;
1662fe8fb19SBen Gras 	}
1672fe8fb19SBen Gras 
1682fe8fb19SBen Gras 	if (n1 == n2)
1692fe8fb19SBen Gras 		return 0;
1702fe8fb19SBen Gras 
1712fe8fb19SBen Gras 	if (i == n1)
1722fe8fb19SBen Gras 		return -1;
1732fe8fb19SBen Gras 
1742fe8fb19SBen Gras 	if (i == n2)
1752fe8fb19SBen Gras 		return 1;
1762fe8fb19SBen Gras 
1772fe8fb19SBen Gras 	/* XXX cannot happen */
1782fe8fb19SBen Gras 	return 0;
1792fe8fb19SBen Gras }
1802fe8fb19SBen Gras 
1812fe8fb19SBen Gras static const char *
_findshlib(char * name,int * majorp,int * minorp)1822fe8fb19SBen Gras _findshlib(char *name, int *majorp, int *minorp)
1832fe8fb19SBen Gras {
1842fe8fb19SBen Gras 	int		dewey[MAXDEWEY];
185f14fb602SLionel Sambuc 	unsigned int	ndewey;
1862fe8fb19SBen Gras 	int		tmp[MAXDEWEY];
1872fe8fb19SBen Gras 	int		i;
1882fe8fb19SBen Gras 	int		len;
1892fe8fb19SBen Gras 	char		*lname;
1902fe8fb19SBen Gras 	static char	path[PATH_MAX];
1912fe8fb19SBen Gras 	int		major, minor;
1922fe8fb19SBen Gras 	const char	*search_dirs[1];
1932fe8fb19SBen Gras 	const int	n_search_dirs = 1;
1942fe8fb19SBen Gras 
1952fe8fb19SBen Gras 	_DIAGASSERT(name != NULL);
1962fe8fb19SBen Gras 	_DIAGASSERT(majorp != NULL);
1972fe8fb19SBen Gras 	_DIAGASSERT(minorp != NULL);
1982fe8fb19SBen Gras 
1992fe8fb19SBen Gras 	major = *majorp;
2002fe8fb19SBen Gras 	minor = *minorp;
2012fe8fb19SBen Gras 	path[0] = '\0';
2022fe8fb19SBen Gras 	search_dirs[0] = _pathI18nModule;
2032fe8fb19SBen Gras 	len = strlen(name);
2042fe8fb19SBen Gras 	lname = name;
2052fe8fb19SBen Gras 
2062fe8fb19SBen Gras 	ndewey = 0;
2072fe8fb19SBen Gras 
2082fe8fb19SBen Gras 	for (i = 0; i < n_search_dirs; i++) {
2092fe8fb19SBen Gras 		DIR		*dd = opendir(search_dirs[i]);
2102fe8fb19SBen Gras 		struct dirent	*dp;
2112fe8fb19SBen Gras 		int		found_dot_a = 0;
2122fe8fb19SBen Gras 		int		found_dot_so = 0;
2132fe8fb19SBen Gras 
2142fe8fb19SBen Gras 		if (dd == NULL)
2152fe8fb19SBen Gras 			continue;
2162fe8fb19SBen Gras 
2172fe8fb19SBen Gras 		while ((dp = readdir(dd)) != NULL) {
218f14fb602SLionel Sambuc 			unsigned int	n;
2192fe8fb19SBen Gras 
2202fe8fb19SBen Gras 			if (dp->d_namlen < len + 4)
2212fe8fb19SBen Gras 				continue;
2222fe8fb19SBen Gras 			if (strncmp(dp->d_name, lname, (size_t)len) != 0)
2232fe8fb19SBen Gras 				continue;
2242fe8fb19SBen Gras 			if (strncmp(dp->d_name+len, ".so.", 4) != 0)
2252fe8fb19SBen Gras 				continue;
2262fe8fb19SBen Gras 
2272fe8fb19SBen Gras 			if ((n = _getdewey(tmp, dp->d_name+len+4)) == 0)
2282fe8fb19SBen Gras 				continue;
2292fe8fb19SBen Gras 
2302fe8fb19SBen Gras 			if (major != -1 && found_dot_a)
2312fe8fb19SBen Gras 				found_dot_a = 0;
2322fe8fb19SBen Gras 
2332fe8fb19SBen Gras 			/* XXX should verify the library is a.out/ELF? */
2342fe8fb19SBen Gras 
2352fe8fb19SBen Gras 			if (major == -1 && minor == -1) {
2362fe8fb19SBen Gras 				goto compare_version;
2372fe8fb19SBen Gras 			} else if (major != -1 && minor == -1) {
2382fe8fb19SBen Gras 				if (tmp[0] == major)
2392fe8fb19SBen Gras 					goto compare_version;
2402fe8fb19SBen Gras 			} else if (major != -1 && minor != -1) {
2412fe8fb19SBen Gras 				if (tmp[0] == major) {
2422fe8fb19SBen Gras 					if (n == 1 || tmp[1] >= minor)
2432fe8fb19SBen Gras 						goto compare_version;
2442fe8fb19SBen Gras 				}
2452fe8fb19SBen Gras 			}
2462fe8fb19SBen Gras 
2472fe8fb19SBen Gras 			/* else, this file does not qualify */
2482fe8fb19SBen Gras 			continue;
2492fe8fb19SBen Gras 
2502fe8fb19SBen Gras 		compare_version:
2512fe8fb19SBen Gras 			if (_cmpndewey(tmp, n, dewey, ndewey) <= 0)
2522fe8fb19SBen Gras 				continue;
2532fe8fb19SBen Gras 
2542fe8fb19SBen Gras 			/* We have a better version */
2552fe8fb19SBen Gras 			found_dot_so = 1;
2562fe8fb19SBen Gras 			snprintf(path, sizeof(path), "%s/%s", search_dirs[i],
2572fe8fb19SBen Gras 			    dp->d_name);
2582fe8fb19SBen Gras 			found_dot_a = 0;
2592fe8fb19SBen Gras 			bcopy(tmp, dewey, sizeof(dewey));
2602fe8fb19SBen Gras 			ndewey = n;
2612fe8fb19SBen Gras 			*majorp = dewey[0];
2622fe8fb19SBen Gras 			*minorp = dewey[1];
2632fe8fb19SBen Gras 		}
2642fe8fb19SBen Gras 		closedir(dd);
2652fe8fb19SBen Gras 
2662fe8fb19SBen Gras 		if (found_dot_a || found_dot_so)
2672fe8fb19SBen Gras 			/*
2682fe8fb19SBen Gras 			 * There's a lib in this dir; take it.
2692fe8fb19SBen Gras 			 */
2702fe8fb19SBen Gras 			return path[0] ? path : NULL;
2712fe8fb19SBen Gras 	}
2722fe8fb19SBen Gras 
2732fe8fb19SBen Gras 	return path[0] ? path : NULL;
2742fe8fb19SBen Gras }
2752fe8fb19SBen Gras 
2762fe8fb19SBen Gras void *
_citrus_find_getops(_citrus_module_t handle,const char * modname,const char * ifname)2772fe8fb19SBen Gras _citrus_find_getops(_citrus_module_t handle, const char *modname,
2782fe8fb19SBen Gras 		    const char *ifname)
2792fe8fb19SBen Gras {
2802fe8fb19SBen Gras 	char name[PATH_MAX];
2812fe8fb19SBen Gras 	void *p;
2822fe8fb19SBen Gras 
2832fe8fb19SBen Gras 	_DIAGASSERT(handle != NULL);
2842fe8fb19SBen Gras 	_DIAGASSERT(modname != NULL);
2852fe8fb19SBen Gras 	_DIAGASSERT(ifname != NULL);
2862fe8fb19SBen Gras 
2872fe8fb19SBen Gras 	snprintf(name, sizeof(name), _C_LABEL_STRING("_citrus_%s_%s_getops"),
2882fe8fb19SBen Gras 	    modname, ifname);
2892fe8fb19SBen Gras 	p = dlsym((void *)handle, name);
2902fe8fb19SBen Gras 	return p;
2912fe8fb19SBen Gras }
2922fe8fb19SBen Gras 
2932fe8fb19SBen Gras int
_citrus_load_module(_citrus_module_t * rhandle,const char * encname)2942fe8fb19SBen Gras _citrus_load_module(_citrus_module_t *rhandle, const char *encname)
2952fe8fb19SBen Gras {
2962fe8fb19SBen Gras 	const char *p;
2972fe8fb19SBen Gras 	char path[PATH_MAX];
2982fe8fb19SBen Gras 	int maj, min;
2992fe8fb19SBen Gras 	void *handle;
3002fe8fb19SBen Gras 
3012fe8fb19SBen Gras 	_DIAGASSERT(rhandle != NULL);
3022fe8fb19SBen Gras 
3032fe8fb19SBen Gras 	if (_pathI18nModule == NULL) {
3042fe8fb19SBen Gras 		p = getenv("PATH_I18NMODULE");
30584d9c625SLionel Sambuc 		if (p == NULL || issetugid()) {
30684d9c625SLionel Sambuc 			_pathI18nModule = _PATH_I18NMODULE;
30784d9c625SLionel Sambuc #ifdef MLIBDIR
30884d9c625SLionel Sambuc 			p = strrchr(_pathI18nModule, '/');
309*0a6a1f1dSLionel Sambuc 			if (p != NULL) {
31084d9c625SLionel Sambuc 				snprintf(path, sizeof(path), "%.*s/%s/%s",
31184d9c625SLionel Sambuc 				    (int)(p - _pathI18nModule),
31284d9c625SLionel Sambuc 				    _pathI18nModule, MLIBDIR, p + 1);
31384d9c625SLionel Sambuc 				p = path;
31484d9c625SLionel Sambuc 			} else
31584d9c625SLionel Sambuc 				p = NULL;
31684d9c625SLionel Sambuc #endif
31784d9c625SLionel Sambuc 		}
31884d9c625SLionel Sambuc 		if (p != NULL) {
3192fe8fb19SBen Gras 			_pathI18nModule = strdup(p);
3202fe8fb19SBen Gras 			if (_pathI18nModule == NULL)
3212fe8fb19SBen Gras 				return ENOMEM;
32284d9c625SLionel Sambuc 		}
3232fe8fb19SBen Gras 	}
3242fe8fb19SBen Gras 
3252fe8fb19SBen Gras 	(void)snprintf(path, sizeof(path), "lib%s", encname);
3262fe8fb19SBen Gras 	maj = I18NMODULE_MAJOR;
3272fe8fb19SBen Gras 	min = -1;
3282fe8fb19SBen Gras 	p = _findshlib(path, &maj, &min);
3292fe8fb19SBen Gras 	if (!p)
3302fe8fb19SBen Gras 		return (EINVAL);
3312fe8fb19SBen Gras 	handle = dlopen(p, RTLD_LAZY);
3322fe8fb19SBen Gras 	if (!handle)
3332fe8fb19SBen Gras 		return (EINVAL);
3342fe8fb19SBen Gras 
3352fe8fb19SBen Gras 	*rhandle = (_citrus_module_t)handle;
3362fe8fb19SBen Gras 
3372fe8fb19SBen Gras 	return (0);
3382fe8fb19SBen Gras }
3392fe8fb19SBen Gras 
3402fe8fb19SBen Gras void
_citrus_unload_module(_citrus_module_t handle)3412fe8fb19SBen Gras _citrus_unload_module(_citrus_module_t handle)
3422fe8fb19SBen Gras {
3432fe8fb19SBen Gras 	if (handle)
3442fe8fb19SBen Gras 		dlclose((void *)handle);
3452fe8fb19SBen Gras }
3462fe8fb19SBen Gras #else
3472fe8fb19SBen Gras /* !_I18N_DYNAMIC */
3482fe8fb19SBen Gras 
3492fe8fb19SBen Gras void *
3502fe8fb19SBen Gras /*ARGSUSED*/
_citrus_find_getops(_citrus_module_t handle,const char * modname,const char * ifname)3512fe8fb19SBen Gras _citrus_find_getops(_citrus_module_t handle, const char *modname,
3522fe8fb19SBen Gras 		    const char *ifname)
3532fe8fb19SBen Gras {
3542fe8fb19SBen Gras 	return (NULL);
3552fe8fb19SBen Gras }
3562fe8fb19SBen Gras 
3572fe8fb19SBen Gras int
3582fe8fb19SBen Gras /*ARGSUSED*/
_citrus_load_module(_citrus_module_t * rhandle,char const * modname)3592fe8fb19SBen Gras _citrus_load_module(_citrus_module_t *rhandle, char const *modname)
3602fe8fb19SBen Gras {
3612fe8fb19SBen Gras 	return (EINVAL);
3622fe8fb19SBen Gras }
3632fe8fb19SBen Gras 
3642fe8fb19SBen Gras void
3652fe8fb19SBen Gras /*ARGSUSED*/
_citrus_unload_module(_citrus_module_t handle)3662fe8fb19SBen Gras _citrus_unload_module(_citrus_module_t handle)
3672fe8fb19SBen Gras {
3682fe8fb19SBen Gras }
3692fe8fb19SBen Gras #endif
370