Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/libkern.h
Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
/* Prototypes for non-quad routines. */ | /* Prototypes for non-quad routines. */ | ||||
struct malloc_type; | struct malloc_type; | ||||
uint32_t arc4random(void); | uint32_t arc4random(void); | ||||
void arc4random_buf(void *, size_t); | void arc4random_buf(void *, size_t); | ||||
uint32_t arc4random_uniform(uint32_t); | uint32_t arc4random_uniform(uint32_t); | ||||
void arc4rand(void *, u_int, int); | void arc4rand(void *, u_int, int); | ||||
int timingsafe_bcmp(const void *, const void *, size_t); | int timingsafe_bcmp(const void *, const void *, size_t) __pure; | ||||
void *bsearch(const void *, const void *, size_t, | void *bsearch(const void *, const void *, size_t, | ||||
size_t, int (*)(const void *, const void *)); | size_t, int (*)(const void *, const void *)); | ||||
#ifndef HAVE_INLINE_FFS | #ifndef HAVE_INLINE_FFS | ||||
int ffs(int); | int ffs(int); | ||||
#endif | #endif | ||||
#ifndef HAVE_INLINE_FFSL | #ifndef HAVE_INLINE_FFSL | ||||
int ffsl(long); | int ffsl(long); | ||||
#endif | #endif | ||||
Show All 12 Lines | |||||
#define bitcount64(x) __bitcount64((uint64_t)(x)) | #define bitcount64(x) __bitcount64((uint64_t)(x)) | ||||
#define bitcount32(x) __bitcount32((uint32_t)(x)) | #define bitcount32(x) __bitcount32((uint32_t)(x)) | ||||
#define bitcount16(x) __bitcount16((uint16_t)(x)) | #define bitcount16(x) __bitcount16((uint16_t)(x)) | ||||
#define bitcountl(x) __bitcountl((u_long)(x)) | #define bitcountl(x) __bitcountl((u_long)(x)) | ||||
#define bitcount(x) __bitcount((u_int)(x)) | #define bitcount(x) __bitcount((u_int)(x)) | ||||
int fnmatch(const char *, const char *, int); | int fnmatch(const char *, const char *, int); | ||||
int locc(int, char *, u_int); | int locc(int, char *, u_int); | ||||
void *memchr(const void *s, int c, size_t n); | void *memchr(const void *s, int c, size_t n) __pure; | ||||
void *memcchr(const void *s, int c, size_t n); | void *memcchr(const void *s, int c, size_t n) __pure; | ||||
void *memmem(const void *l, size_t l_len, const void *s, size_t s_len); | void *memmem(const void *l, size_t l_len, const void *s, size_t s_len); | ||||
void qsort(void *base, size_t nmemb, size_t size, | void qsort(void *base, size_t nmemb, size_t size, | ||||
int (*compar)(const void *, const void *)); | int (*compar)(const void *, const void *)); | ||||
void qsort_r(void *base, size_t nmemb, size_t size, void *thunk, | void qsort_r(void *base, size_t nmemb, size_t size, void *thunk, | ||||
int (*compar)(void *, const void *, const void *)); | int (*compar)(void *, const void *, const void *)); | ||||
u_long random(void); | u_long random(void); | ||||
int scanc(u_int, const u_char *, const u_char *, int); | int scanc(u_int, const u_char *, const u_char *, int); | ||||
int strcasecmp(const char *, const char *); | int strcasecmp(const char *, const char *) __pure; | ||||
char *strcasestr(const char *, const char *); | char *strcasestr(const char *, const char *) __pure; | ||||
dim: I take it that these are the kernel side versions, which don't attempt to load locales and that… | |||||
char *strcat(char * __restrict, const char * __restrict); | char *strcat(char * __restrict, const char * __restrict); | ||||
char *strchr(const char *, int); | char *strchr(const char *, int) __pure; | ||||
char *strchrnul(const char *, int); | char *strchrnul(const char *, int) __pure; | ||||
int strcmp(const char *, const char *); | int strcmp(const char *, const char *) __pure; | ||||
char *strcpy(char * __restrict, const char * __restrict); | char *strcpy(char * __restrict, const char * __restrict); | ||||
char *strdup_flags(const char *__restrict, struct malloc_type *, int); | |||||
size_t strcspn(const char *, const char *) __pure; | size_t strcspn(const char *, const char *) __pure; | ||||
char *strdup(const char *__restrict, struct malloc_type *); | char *strdup_flags(const char * __restrict, struct malloc_type *, int) __malloc_like; | ||||
char *strncat(char *, const char *, size_t); | char *strdup(const char * __restrict, struct malloc_type *) __malloc_like; | ||||
Done Inline Actions__restrict needs a space before it, but touching libkern.h files without the associated changes to the implementation is wrong. jrtc27: `__restrict` needs a space before it, but touching libkern.h files without the associated… | |||||
char *strndup(const char *__restrict, size_t, struct malloc_type *); | char *strncat(char * __restrict, const char * __restrict, size_t); | ||||
size_t strlcat(char *, const char *, size_t); | char *strndup(const char * __restrict, size_t, struct malloc_type *) __malloc_like; | ||||
size_t strlcpy(char *, const char *, size_t); | size_t strlcat(char * __restrict, const char * __restrict, size_t); | ||||
size_t strlen(const char *); | size_t strlcpy(char * __restrict, const char * __restrict, size_t); | ||||
int strncasecmp(const char *, const char *, size_t); | size_t strlen(const char *) __pure; | ||||
int strncmp(const char *, const char *, size_t); | int strncasecmp(const char *, const char *, size_t) __pure; | ||||
int strncmp(const char *, const char *, size_t) __pure; | |||||
char *strncpy(char * __restrict, const char * __restrict, size_t); | char *strncpy(char * __restrict, const char * __restrict, size_t); | ||||
size_t strnlen(const char *, size_t); | size_t strnlen(const char *, size_t) __pure; | ||||
char *strnstr(const char *, const char *, size_t); | char *strnstr(const char *, const char *, size_t); | ||||
char *strrchr(const char *, int); | char *strrchr(const char *, int) __pure; | ||||
char *strsep(char **, const char *delim); | char *strsep(char **, const char *delim); | ||||
size_t strspn(const char *, const char *); | size_t strspn(const char *, const char *) __pure; | ||||
char *strstr(const char *, const char *); | char *strstr(const char *, const char *) __pure; | ||||
int strvalid(const char *, size_t); | int strvalid(const char *, size_t) __pure; | ||||
#ifdef SAN_NEEDS_INTERCEPTORS | #ifdef SAN_NEEDS_INTERCEPTORS | ||||
#ifndef SAN_INTERCEPTOR | #ifndef SAN_INTERCEPTOR | ||||
#define SAN_INTERCEPTOR(func) \ | #define SAN_INTERCEPTOR(func) \ | ||||
__CONCAT(SAN_INTERCEPTOR_PREFIX, __CONCAT(_, func)) | __CONCAT(SAN_INTERCEPTOR_PREFIX, __CONCAT(_, func)) | ||||
#endif | #endif | ||||
char *SAN_INTERCEPTOR(strcpy)(char *, const char *); | char *SAN_INTERCEPTOR(strcpy)(char * __restrict, const char * __restrict); | ||||
int SAN_INTERCEPTOR(strcmp)(const char *, const char *); | int SAN_INTERCEPTOR(strcmp)(const char *, const char *) __pure; | ||||
size_t SAN_INTERCEPTOR(strlen)(const char *); | size_t SAN_INTERCEPTOR(strlen)(const char *) __pure; | ||||
#ifndef SAN_RUNTIME | #ifndef SAN_RUNTIME | ||||
#define strcpy(d, s) SAN_INTERCEPTOR(strcpy)((d), (s)) | #define strcpy(d, s) SAN_INTERCEPTOR(strcpy)((d), (s)) | ||||
#define strcmp(s1, s2) SAN_INTERCEPTOR(strcmp)((s1), (s2)) | #define strcmp(s1, s2) SAN_INTERCEPTOR(strcmp)((s1), (s2)) | ||||
#define strlen(s) SAN_INTERCEPTOR(strlen)(s) | #define strlen(s) SAN_INTERCEPTOR(strlen)(s) | ||||
#endif /* !SAN_RUNTIME */ | #endif /* !SAN_RUNTIME */ | ||||
#else /* !SAN_NEEDS_INTERCEPTORS */ | #else /* !SAN_NEEDS_INTERCEPTORS */ | ||||
#define strcpy(d, s) __builtin_strcpy((d), (s)) | #define strcpy(d, s) __builtin_strcpy((d), (s)) | ||||
#define strcmp(s1, s2) __builtin_strcmp((s1), (s2)) | #define strcmp(s1, s2) __builtin_strcmp((s1), (s2)) | ||||
Show All 30 Lines |
I take it that these are the kernel side versions, which don't attempt to load locales and that sort of stuff? Otherwise they're definitely not pure. :)