xref: /titanic_44/usr/src/lib/smbsrv/libfksmbsrv/common/sys/sunddi.h (revision b819cea2f73f98c5662230cc9affc8cc84f77fcf)
1*b819cea2SGordon Ross /*
2*b819cea2SGordon Ross  * CDDL HEADER START
3*b819cea2SGordon Ross  *
4*b819cea2SGordon Ross  * The contents of this file are subject to the terms of the
5*b819cea2SGordon Ross  * Common Development and Distribution License (the "License").
6*b819cea2SGordon Ross  * You may not use this file except in compliance with the License.
7*b819cea2SGordon Ross  *
8*b819cea2SGordon Ross  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*b819cea2SGordon Ross  * or http://www.opensolaris.org/os/licensing.
10*b819cea2SGordon Ross  * See the License for the specific language governing permissions
11*b819cea2SGordon Ross  * and limitations under the License.
12*b819cea2SGordon Ross  *
13*b819cea2SGordon Ross  * When distributing Covered Code, include this CDDL HEADER in each
14*b819cea2SGordon Ross  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*b819cea2SGordon Ross  * If applicable, add the following below this CDDL HEADER, with the
16*b819cea2SGordon Ross  * fields enclosed by brackets "[]" replaced with your own identifying
17*b819cea2SGordon Ross  * information: Portions Copyright [yyyy] [name of copyright owner]
18*b819cea2SGordon Ross  *
19*b819cea2SGordon Ross  * CDDL HEADER END
20*b819cea2SGordon Ross  */
21*b819cea2SGordon Ross 
22*b819cea2SGordon Ross /*
23*b819cea2SGordon Ross  * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
24*b819cea2SGordon Ross  */
25*b819cea2SGordon Ross 
26*b819cea2SGordon Ross #ifndef	_SYS_SUNDDI_H
27*b819cea2SGordon Ross #define	_SYS_SUNDDI_H
28*b819cea2SGordon Ross 
29*b819cea2SGordon Ross /*
30*b819cea2SGordon Ross  * Sun Specific DDI definitions (fakekernel version)
31*b819cea2SGordon Ross  * The real sunddi.h has become a "kitchen sink" full of
32*b819cea2SGordon Ross  * includes we don't want, and lots of places include it.
33*b819cea2SGordon Ross  * Rather than fight that battle now,  provide this one
34*b819cea2SGordon Ross  * with just the str*, mem*, and kiconv* functions.
35*b819cea2SGordon Ross  * Some day, re-factor: sunddi.h, systm.h
36*b819cea2SGordon Ross  */
37*b819cea2SGordon Ross 
38*b819cea2SGordon Ross #include <sys/isa_defs.h>
39*b819cea2SGordon Ross #include <sys/dditypes.h>
40*b819cea2SGordon Ross #include <sys/time.h>
41*b819cea2SGordon Ross #include <sys/cmn_err.h>
42*b819cea2SGordon Ross 
43*b819cea2SGordon Ross #include <sys/kmem.h>
44*b819cea2SGordon Ross #include <sys/nvpair.h>
45*b819cea2SGordon Ross #include <sys/thread.h>
46*b819cea2SGordon Ross #include <sys/stream.h>
47*b819cea2SGordon Ross 
48*b819cea2SGordon Ross #include <sys/u8_textprep.h>
49*b819cea2SGordon Ross #include <sys/kiconv.h>
50*b819cea2SGordon Ross 
51*b819cea2SGordon Ross #ifdef	__cplusplus
52*b819cea2SGordon Ross extern "C" {
53*b819cea2SGordon Ross #endif
54*b819cea2SGordon Ross 
55*b819cea2SGordon Ross #if defined(_KERNEL) || defined(_FAKE_KERNEL)
56*b819cea2SGordon Ross 
57*b819cea2SGordon Ross extern char *ddi_strdup(const char *str, int flag);
58*b819cea2SGordon Ross extern char *strdup(const char *str);
59*b819cea2SGordon Ross extern void strfree(char *str);
60*b819cea2SGordon Ross 
61*b819cea2SGordon Ross extern size_t strlen(const char *) __PURE;
62*b819cea2SGordon Ross extern size_t strnlen(const char *, size_t) __PURE;
63*b819cea2SGordon Ross extern char *strcpy(char *, const char *);
64*b819cea2SGordon Ross extern char *strncpy(char *, const char *, size_t);
65*b819cea2SGordon Ross 
66*b819cea2SGordon Ross /* Need to be consistent with <string.h> C++ definition for strchr() */
67*b819cea2SGordon Ross #if __cplusplus >= 199711L
68*b819cea2SGordon Ross extern const char *strchr(const char *, int);
69*b819cea2SGordon Ross #else
70*b819cea2SGordon Ross extern char *strchr(const char *, int);
71*b819cea2SGordon Ross #endif	/* __cplusplus >= 199711L */
72*b819cea2SGordon Ross 
73*b819cea2SGordon Ross #define	DDI_STRSAME(s1, s2)	((*(s1) == *(s2)) && (strcmp((s1), (s2)) == 0))
74*b819cea2SGordon Ross extern int strcmp(const char *, const char *) __PURE;
75*b819cea2SGordon Ross extern int strncmp(const char *, const char *, size_t) __PURE;
76*b819cea2SGordon Ross extern char *strncat(char *, const char *, size_t);
77*b819cea2SGordon Ross extern size_t strlcat(char *, const char *, size_t);
78*b819cea2SGordon Ross extern size_t strlcpy(char *, const char *, size_t);
79*b819cea2SGordon Ross extern size_t strspn(const char *, const char *);
80*b819cea2SGordon Ross extern size_t strcspn(const char *, const char *);
81*b819cea2SGordon Ross extern int bcmp(const void *, const void *, size_t) __PURE;
82*b819cea2SGordon Ross extern int stoi(char **);
83*b819cea2SGordon Ross extern void numtos(ulong_t, char *);
84*b819cea2SGordon Ross extern void bcopy(const void *, void *, size_t);
85*b819cea2SGordon Ross extern void bzero(void *, size_t);
86*b819cea2SGordon Ross 
87*b819cea2SGordon Ross extern void *memcpy(void *, const  void  *, size_t);
88*b819cea2SGordon Ross extern void *memset(void *, int, size_t);
89*b819cea2SGordon Ross extern void *memmove(void *, const void *, size_t);
90*b819cea2SGordon Ross extern int memcmp(const void *, const void *, size_t) __PURE;
91*b819cea2SGordon Ross 
92*b819cea2SGordon Ross /* Need to be consistent with <string.h> C++ definition for memchr() */
93*b819cea2SGordon Ross #if __cplusplus >= 199711L
94*b819cea2SGordon Ross extern const void *memchr(const void *, int, size_t);
95*b819cea2SGordon Ross #else
96*b819cea2SGordon Ross extern void *memchr(const void *, int, size_t);
97*b819cea2SGordon Ross #endif /* __cplusplus >= 199711L */
98*b819cea2SGordon Ross 
99*b819cea2SGordon Ross extern int ddi_strtol(const char *, char **, int, long *);
100*b819cea2SGordon Ross extern int ddi_strtoul(const char *, char **, int, unsigned long *);
101*b819cea2SGordon Ross extern int ddi_strtoll(const char *, char **, int, longlong_t *);
102*b819cea2SGordon Ross extern int ddi_strtoull(const char *, char **, int, u_longlong_t *);
103*b819cea2SGordon Ross 
104*b819cea2SGordon Ross /*
105*b819cea2SGordon Ross  * kiconv functions and their macros.
106*b819cea2SGordon Ross  */
107*b819cea2SGordon Ross #define	KICONV_IGNORE_NULL	(0x0001)
108*b819cea2SGordon Ross #define	KICONV_REPLACE_INVALID	(0x0002)
109*b819cea2SGordon Ross 
110*b819cea2SGordon Ross extern kiconv_t kiconv_open(const char *, const char *);
111*b819cea2SGordon Ross extern size_t kiconv(kiconv_t, char **, size_t *, char **, size_t *, int *);
112*b819cea2SGordon Ross extern int kiconv_close(kiconv_t);
113*b819cea2SGordon Ross extern size_t kiconvstr(const char *, const char *, char *, size_t *, char *,
114*b819cea2SGordon Ross 	size_t *, int, int *);
115*b819cea2SGordon Ross 
116*b819cea2SGordon Ross #endif	/* _KERNEL */
117*b819cea2SGordon Ross 
118*b819cea2SGordon Ross #ifdef	__cplusplus
119*b819cea2SGordon Ross }
120*b819cea2SGordon Ross #endif
121*b819cea2SGordon Ross 
122*b819cea2SGordon Ross #endif	/* _SYS_SUNDDI_H */
123