[PATCH] strndup_user()
[safe/jmp/linux-2.6] / include / linux / string.h
1 #ifndef _LINUX_STRING_H_
2 #define _LINUX_STRING_H_
3
4 /* We don't want strings.h stuff being user by user stuff by accident */
5
6 #ifdef __KERNEL__
7
8 #include <linux/compiler.h>     /* for inline */
9 #include <linux/types.h>        /* for size_t */
10 #include <linux/stddef.h>       /* for NULL */
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 extern char * strpbrk(const char *,const char *);
17 extern char * strsep(char **,const char *);
18 extern __kernel_size_t strspn(const char *,const char *);
19 extern __kernel_size_t strcspn(const char *,const char *);
20
21 extern char *strndup_user(const char __user *, long);
22
23 /*
24  * Include machine specific inline routines
25  */
26 #include <asm/string.h>
27
28 #ifndef __HAVE_ARCH_STRCPY
29 extern char * strcpy(char *,const char *);
30 #endif
31 #ifndef __HAVE_ARCH_STRNCPY
32 extern char * strncpy(char *,const char *, __kernel_size_t);
33 #endif
34 #ifndef __HAVE_ARCH_STRLCPY
35 size_t strlcpy(char *, const char *, size_t);
36 #endif
37 #ifndef __HAVE_ARCH_STRCAT
38 extern char * strcat(char *, const char *);
39 #endif
40 #ifndef __HAVE_ARCH_STRNCAT
41 extern char * strncat(char *, const char *, __kernel_size_t);
42 #endif
43 #ifndef __HAVE_ARCH_STRLCAT
44 extern size_t strlcat(char *, const char *, __kernel_size_t);
45 #endif
46 #ifndef __HAVE_ARCH_STRCMP
47 extern int strcmp(const char *,const char *);
48 #endif
49 #ifndef __HAVE_ARCH_STRNCMP
50 extern int strncmp(const char *,const char *,__kernel_size_t);
51 #endif
52 #ifndef __HAVE_ARCH_STRNICMP
53 extern int strnicmp(const char *, const char *, __kernel_size_t);
54 #endif
55 #ifndef __HAVE_ARCH_STRCHR
56 extern char * strchr(const char *,int);
57 #endif
58 #ifndef __HAVE_ARCH_STRNCHR
59 extern char * strnchr(const char *, size_t, int);
60 #endif
61 #ifndef __HAVE_ARCH_STRRCHR
62 extern char * strrchr(const char *,int);
63 #endif
64 #ifndef __HAVE_ARCH_STRSTR
65 extern char * strstr(const char *,const char *);
66 #endif
67 #ifndef __HAVE_ARCH_STRLEN
68 extern __kernel_size_t strlen(const char *);
69 #endif
70 #ifndef __HAVE_ARCH_STRNLEN
71 extern __kernel_size_t strnlen(const char *,__kernel_size_t);
72 #endif
73
74 #ifndef __HAVE_ARCH_MEMSET
75 extern void * memset(void *,int,__kernel_size_t);
76 #endif
77 #ifndef __HAVE_ARCH_MEMCPY
78 extern void * memcpy(void *,const void *,__kernel_size_t);
79 #endif
80 #ifndef __HAVE_ARCH_MEMMOVE
81 extern void * memmove(void *,const void *,__kernel_size_t);
82 #endif
83 #ifndef __HAVE_ARCH_MEMSCAN
84 extern void * memscan(void *,int,__kernel_size_t);
85 #endif
86 #ifndef __HAVE_ARCH_MEMCMP
87 extern int memcmp(const void *,const void *,__kernel_size_t);
88 #endif
89 #ifndef __HAVE_ARCH_MEMCHR
90 extern void * memchr(const void *,int,__kernel_size_t);
91 #endif
92
93 extern char *kstrdup(const char *s, gfp_t gfp);
94
95 #ifdef __cplusplus
96 }
97 #endif
98
99 #endif
100 #endif /* _LINUX_STRING_H_ */