1 #ifndef _LINUX_STRING_H_
2 #define _LINUX_STRING_H_
4 #include <linux/types.h> /* for size_t */
5 #include <linux/stddef.h> /* for NULL */
11 extern char * ___strtok;
12 extern char * strpbrk(const char *,const char *);
13 extern char * strtok(char *,const char *);
14 extern char * strsep(char **,const char *);
15 extern __kernel_size_t strspn(const char *,const char *);
18 * Include machine specific inline routines
20 #include <asm/string.h>
22 #ifndef __HAVE_ARCH_STRCPY
23 extern char * strcpy(char *,const char *);
25 #ifndef __HAVE_ARCH_STRNCPY
26 extern char * strncpy(char *,const char *, __kernel_size_t);
28 #ifndef __HAVE_ARCH_STRLCPY
29 size_t strlcpy(char *, const char *, size_t);
31 #ifndef __HAVE_ARCH_STRCAT
32 extern char * strcat(char *, const char *);
34 #ifndef __HAVE_ARCH_STRNCAT
35 extern char * strncat(char *, const char *, __kernel_size_t);
37 #ifndef __HAVE_ARCH_STRLCAT
38 size_t strlcat(char *, const char *, size_t);
40 #ifndef __HAVE_ARCH_STRCMP
41 extern int strcmp(const char *,const char *);
43 #ifndef __HAVE_ARCH_STRNCMP
44 extern int strncmp(const char *,const char *,__kernel_size_t);
46 #ifndef __HAVE_ARCH_STRCASECMP
47 int strcasecmp(const char *s1, const char *s2);
49 #ifndef __HAVE_ARCH_STRNCASECMP
50 extern int strncasecmp(const char *s1, const char *s2, __kernel_size_t len);
52 #ifndef __HAVE_ARCH_STRCHR
53 extern char * strchr(const char *,int);
57 * strchrnul() - return position of a character in the string, or end of string
59 * The strchrnul() function is like strchr() except that if c is not found
60 * in s, then it returns a pointer to the nul byte at the end of s, rather than
62 * @s: string to search
63 * @c: character to search for
64 * Return: position of @c in @s, or end of @s if not found
66 const char *strchrnul(const char *s, int c);
68 #ifndef __HAVE_ARCH_STRRCHR
69 extern char * strrchr(const char *,int);
71 #include <linux/linux_string.h>
72 #ifndef __HAVE_ARCH_STRSTR
73 extern char * strstr(const char *,const char *);
75 #ifndef __HAVE_ARCH_STRLEN
76 extern __kernel_size_t strlen(const char *);
78 #ifndef __HAVE_ARCH_STRNLEN
79 extern __kernel_size_t strnlen(const char *,__kernel_size_t);
82 #ifndef __HAVE_ARCH_STRCSPN
84 * strcspn() - find span of string without given characters
86 * Calculates the length of the initial segment of @s which consists entirely
87 * of bsytes not in reject.
89 * @s: string to search
90 * @reject: strings which cause the search to halt
91 * Return: number of characters at the start of @s which are not in @reject
93 size_t strcspn(const char *s, const char *reject);
97 # define strdup sandbox_strdup
98 # define strndup sandbox_strndup
101 #ifndef __HAVE_ARCH_STRDUP
102 extern char * strdup(const char *);
103 extern char * strndup(const char *, size_t);
105 #ifndef __HAVE_ARCH_STRSWAB
106 extern char * strswab(const char *);
109 #ifndef __HAVE_ARCH_MEMSET
110 extern void * memset(void *,int,__kernel_size_t);
112 #ifndef __HAVE_ARCH_MEMCPY
113 extern void * memcpy(void *,const void *,__kernel_size_t);
115 #ifndef __HAVE_ARCH_MEMMOVE
116 extern void * memmove(void *,const void *,__kernel_size_t);
118 #ifndef __HAVE_ARCH_MEMSCAN
119 extern void * memscan(void *,int,__kernel_size_t);
121 #ifndef __HAVE_ARCH_MEMCMP
122 extern int memcmp(const void *,const void *,__kernel_size_t);
124 #ifndef __HAVE_ARCH_MEMCHR
125 extern void * memchr(const void *,int,__kernel_size_t);
127 #ifndef __HAVE_ARCH_MEMCHR_INV
128 void *memchr_inv(const void *, int, size_t);
132 * memdup() - allocate a buffer and copy in the contents
134 * Note that this returns a valid pointer even if @len is 0
136 * @src: data to copy in
137 * @len: number of bytes to copy
138 * Return: allocated buffer with the copied contents, or NULL if not enough
139 * memory is available
142 char *memdup(const void *src, size_t len);
144 unsigned long ustrtoul(const char *cp, char **endp, unsigned int base);
145 unsigned long long ustrtoull(const char *cp, char **endp, unsigned int base);
151 #endif /* _LINUX_STRING_H_ */