string.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #ifndef _LINUX_STRING_H_
  2. #define _LINUX_STRING_H_
  3. #include <linux/types.h> /* for size_t */
  4. #include <linux/stddef.h> /* for NULL */
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. extern char * ___strtok;
  9. extern char * strpbrk(const char *,const char *);
  10. extern char * strtok(char *,const char *);
  11. extern char * strsep(char **,const char *);
  12. extern __kernel_size_t strspn(const char *,const char *);
  13. /*
  14. * Include machine specific inline routines
  15. */
  16. #include <asm/string.h>
  17. #ifndef __HAVE_ARCH_STRCPY
  18. extern char * strcpy(char *,const char *);
  19. #endif
  20. #ifndef __HAVE_ARCH_STRNCPY
  21. extern char * strncpy(char *,const char *, __kernel_size_t);
  22. #endif
  23. #ifndef __HAVE_ARCH_STRLCPY
  24. size_t strlcpy(char *, const char *, size_t);
  25. #endif
  26. #ifndef __HAVE_ARCH_STRCAT
  27. extern char * strcat(char *, const char *);
  28. #endif
  29. #ifndef __HAVE_ARCH_STRNCAT
  30. extern char * strncat(char *, const char *, __kernel_size_t);
  31. #endif
  32. #ifndef __HAVE_ARCH_STRCMP
  33. extern int strcmp(const char *,const char *);
  34. #endif
  35. #ifndef __HAVE_ARCH_STRNCMP
  36. extern int strncmp(const char *,const char *,__kernel_size_t);
  37. #endif
  38. #ifndef __HAVE_ARCH_STRCASECMP
  39. int strcasecmp(const char *s1, const char *s2);
  40. #endif
  41. #ifndef __HAVE_ARCH_STRNCASECMP
  42. extern int strncasecmp(const char *s1, const char *s2, __kernel_size_t len);
  43. #endif
  44. #ifndef __HAVE_ARCH_STRCHR
  45. extern char * strchr(const char *,int);
  46. #endif
  47. /**
  48. * strchrnul() - return position of a character in the string, or end of string
  49. *
  50. * The strchrnul() function is like strchr() except that if c is not found
  51. * in s, then it returns a pointer to the nul byte at the end of s, rather than
  52. * NULL
  53. * @s: string to search
  54. * @c: character to search for
  55. * @return position of @c in @s, or end of @s if not found
  56. */
  57. const char *strchrnul(const char *s, int c);
  58. #ifndef __HAVE_ARCH_STRRCHR
  59. extern char * strrchr(const char *,int);
  60. #endif
  61. #include <linux/linux_string.h>
  62. #ifndef __HAVE_ARCH_STRSTR
  63. extern char * strstr(const char *,const char *);
  64. #endif
  65. #ifndef __HAVE_ARCH_STRLEN
  66. extern __kernel_size_t strlen(const char *);
  67. #endif
  68. #ifndef __HAVE_ARCH_STRNLEN
  69. extern __kernel_size_t strnlen(const char *,__kernel_size_t);
  70. #endif
  71. #ifndef __HAVE_ARCH_STRCSPN
  72. /**
  73. * strcspn() - find span of string without given characters
  74. *
  75. * Calculates the length of the initial segment of @s which consists entirely
  76. * of bsytes not in reject.
  77. *
  78. * @s: string to search
  79. * @reject: strings which cause the search to halt
  80. * @return number of characters at the start of @s which are not in @reject
  81. */
  82. size_t strcspn(const char *s, const char *reject);
  83. #endif
  84. #ifdef CONFIG_SANDBOX
  85. # define strdup sandbox_strdup
  86. # define strndup sandbox_strndup
  87. #endif
  88. #ifndef __HAVE_ARCH_STRDUP
  89. extern char * strdup(const char *);
  90. extern char * strndup(const char *, size_t);
  91. #endif
  92. #ifndef __HAVE_ARCH_STRSWAB
  93. extern char * strswab(const char *);
  94. #endif
  95. #ifndef __HAVE_ARCH_MEMSET
  96. extern void * memset(void *,int,__kernel_size_t);
  97. #endif
  98. #ifndef __HAVE_ARCH_MEMCPY
  99. extern void * memcpy(void *,const void *,__kernel_size_t);
  100. #endif
  101. #ifndef __HAVE_ARCH_MEMMOVE
  102. extern void * memmove(void *,const void *,__kernel_size_t);
  103. #endif
  104. #ifndef __HAVE_ARCH_MEMSCAN
  105. extern void * memscan(void *,int,__kernel_size_t);
  106. #endif
  107. #ifndef __HAVE_ARCH_MEMCMP
  108. extern int memcmp(const void *,const void *,__kernel_size_t);
  109. #endif
  110. #ifndef __HAVE_ARCH_MEMCHR
  111. extern void * memchr(const void *,int,__kernel_size_t);
  112. #endif
  113. #ifndef __HAVE_ARCH_MEMCHR_INV
  114. void *memchr_inv(const void *, int, size_t);
  115. #endif
  116. unsigned long ustrtoul(const char *cp, char **endp, unsigned int base);
  117. unsigned long long ustrtoull(const char *cp, char **endp, unsigned int base);
  118. #ifdef __cplusplus
  119. }
  120. #endif
  121. #endif /* _LINUX_STRING_H_ */