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 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #pragma ident "%Z%%M% %I% %E% SMI"
27
28 /*
29 * Kernel iconv code conversion functions (PSARC/2007/173).
30 *
31 * Man pages: kiconv_open(9F), kiconv(9F), kiconv_close(9F), and kiconvstr(9F).
32 * Interface stability: Committed.
33 */
34
35 #include <sys/types.h>
36 #include <sys/param.h>
37 #include <sys/sysmacros.h>
38 #include <sys/systm.h>
39 #include <sys/debug.h>
40 #include <sys/kmem.h>
41 #include <sys/sunddi.h>
42 #include <sys/ksynch.h>
43 #include <sys/modctl.h>
44 #include <sys/byteorder.h>
45 #include <sys/errno.h>
46 #include <sys/kiconv.h>
47 #include <sys/kiconv_latin1.h>
944 { 0, 35, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
945 { 35, 0, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
946 { 0, 36, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
947 { 36, 0, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
948 { 0, 37, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
949 { 37, 0, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
950 { 0, 38, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
951 { 38, 0, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
952 { 0, 39, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
953 { 39, 0, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
954 { 0, 40, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
955 { 40, 0, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
956 { 0, 41, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
957 { 41, 0, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
958 { 0, 42, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
959 { 42, 0, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
960 };
961
962 /* The list of implemeted and supported modules. */
963 static kiconv_mod_list_t module_list[KICONV_MAX_MODULE_ID + 1] = {
964 "kiconv_embedded", 0,
965 "kiconv_ja", 0,
966 "kiconv_sc", 0,
967 "kiconv_ko", 0,
968 "kiconv_tc", 0,
969 "kiconv_emea", 0,
970 };
971
972 /*
973 * We use conv_list_lock to restrict data access of both conv_list[] and
974 * module_list[] as they are tightly coupled critical sections that need to be
975 * dealt together as a unit.
976 */
977 static kmutex_t conv_list_lock;
978
979 void
980 kiconv_init()
981 {
982 mutex_init(&conv_list_lock, NULL, MUTEX_DEFAULT, NULL);
983 }
984
985 /*
986 * The following is used to check on whether a kiconv module is being
987 * used or not at the _fini() of the module.
988 */
989 size_t
|
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 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /*
27 * Kernel iconv code conversion functions (PSARC/2007/173).
28 *
29 * Man pages: kiconv_open(9F), kiconv(9F), kiconv_close(9F), and kiconvstr(9F).
30 * Interface stability: Committed.
31 */
32
33 #include <sys/types.h>
34 #include <sys/param.h>
35 #include <sys/sysmacros.h>
36 #include <sys/systm.h>
37 #include <sys/debug.h>
38 #include <sys/kmem.h>
39 #include <sys/sunddi.h>
40 #include <sys/ksynch.h>
41 #include <sys/modctl.h>
42 #include <sys/byteorder.h>
43 #include <sys/errno.h>
44 #include <sys/kiconv.h>
45 #include <sys/kiconv_latin1.h>
942 { 0, 35, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
943 { 35, 0, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
944 { 0, 36, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
945 { 36, 0, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
946 { 0, 37, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
947 { 37, 0, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
948 { 0, 38, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
949 { 38, 0, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
950 { 0, 39, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
951 { 39, 0, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
952 { 0, 40, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
953 { 40, 0, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
954 { 0, 41, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
955 { 41, 0, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
956 { 0, 42, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
957 { 42, 0, KICONV_MODULE_ID_EMEA, NULL, NULL, NULL, NULL },
958 };
959
960 /* The list of implemeted and supported modules. */
961 static kiconv_mod_list_t module_list[KICONV_MAX_MODULE_ID + 1] = {
962 { "kiconv_embedded", 0 },
963 { "kiconv_ja", 0 },
964 { "kiconv_sc", 0 },
965 { "kiconv_ko", 0 },
966 { "kiconv_tc", 0 },
967 { "kiconv_emea", 0 }
968 };
969
970 /*
971 * We use conv_list_lock to restrict data access of both conv_list[] and
972 * module_list[] as they are tightly coupled critical sections that need to be
973 * dealt together as a unit.
974 */
975 static kmutex_t conv_list_lock;
976
977 void
978 kiconv_init()
979 {
980 mutex_init(&conv_list_lock, NULL, MUTEX_DEFAULT, NULL);
981 }
982
983 /*
984 * The following is used to check on whether a kiconv module is being
985 * used or not at the _fini() of the module.
986 */
987 size_t
|