diff --git a/sys/libkern/strdup.c b/sys/libkern/strdup.c index 74953ffeca60..82cece0c1d24 100644 --- a/sys/libkern/strdup.c +++ b/sys/libkern/strdup.c @@ -42,13 +42,13 @@ MALLOC_DEFINE(M_STRING, "string", "string buffers"); char * -strdup(const char *string) +strdup(const char *string, struct malloc_type *type) { size_t len; char *copy; len = strlen(string) + 1; - copy = malloc(len, M_STRING, M_WAITOK); + copy = malloc(len, type, M_WAITOK); bcopy(string, copy, len); return (copy); } diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h index e3efad7d2369..ba794e3fad3b 100644 --- a/sys/sys/libkern.h +++ b/sys/sys/libkern.h @@ -68,6 +68,7 @@ static __inline long labs(long a) { return (a < 0 ? -a : a); } static __inline quad_t qabs(quad_t a) { return (a < 0 ? -a : a); } /* Prototypes for non-quad routines. */ +struct malloc_type; uint32_t arc4random(void); void arc4rand(void *ptr, u_int len, int reseed); int bcmp(const void *, const void *, size_t); @@ -92,7 +93,7 @@ void srandom(u_long); char *strcat(char * __restrict, const char * __restrict); int strcmp(const char *, const char *); char *strcpy(char * __restrict, const char * __restrict); -char *strdup(const char *__restrict); +char *strdup(const char *__restrict, struct malloc_type *); size_t strlcat(char *, const char *, size_t); size_t strlcpy(char *, const char *, size_t); size_t strlen(const char *);