Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/libkern.h
Show First 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | |||||
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); | ||||
void *memcchr(const void *s, int c, size_t n); | void *memcchr(const void *s, int c, size_t n); | ||||
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, | ||||
int (*compar)(void *, const void *, const void *)); | int (*compar)(const void *, const void *, void *), void *thunk); | ||||
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 *); | ||||
char *strcasestr(const char *, const char *); | char *strcasestr(const char *, const char *); | ||||
char *strcat(char * __restrict, const char * __restrict); | char *strcat(char * __restrict, const char * __restrict); | ||||
char *strchr(const char *, int); | char *strchr(const char *, int); | ||||
char *strchrnul(const char *, int); | char *strchrnul(const char *, int); | ||||
int strcmp(const char *, const char *); | int strcmp(const char *, const char *); | ||||
Show All 23 Lines | #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 *, const char *); | ||||
int SAN_INTERCEPTOR(strcmp)(const char *, const char *); | int SAN_INTERCEPTOR(strcmp)(const char *, const char *); | ||||
size_t SAN_INTERCEPTOR(strlen)(const char *); | size_t SAN_INTERCEPTOR(strlen)(const char *); | ||||
#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) | ||||
kib: I am not sure why do we need this in libkern at all. | |||||
#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)) | ||||
#define strlen(s) __builtin_strlen((s)) | #define strlen(s) __builtin_strlen((s)) | ||||
#endif /* SAN_NEEDS_INTERCEPTORS */ | #endif /* SAN_NEEDS_INTERCEPTORS */ | ||||
static __inline char * | static __inline char * | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |
I am not sure why do we need this in libkern at all.