NAME
kstrdup
, kstrndup
— save a copy of a
string
SYNOPSIS
#include
<sys/malloc.h>
char *
kstrdup
(const
char *str, struct
malloc_type *type);
char *
kstrndup
(const
char *str, size_t
maxlen, struct
malloc_type *type);
DESCRIPTION
Thekstrdup
()
function allocates sufficient memory of type type for a
copy of the string str, does the copy, and returns a
pointer to it. The pointer may subsequently be used as an argument to the
function kfree(9).
The
kstrndup
()
function copies at most maxlen characters from the
string str and will always NUL
terminate the copied string.