DragonFly On-Line Manual Pages
KSTRDUP(9) DragonFly Kernel Developer's Manual KSTRDUP(9)
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
The kstrdup() 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.
SEE ALSO
kfree(9), kmalloc(9)
DragonFly 4.5 June 5, 2016 DragonFly 4.5