kstrdup_const (9) Linux Manual Page
kstrdup_const – conditionally duplicate an existing const string
Synopsis
const char *kstrdup_const(const char *s, gfp_t gfp);
Arguments
s
-
- the string to duplicate
gfp
- the GFP mask used in the
kmalloccall when allocating memory
Description
Function returns source string if it is in .rodata section otherwise it fallbacks to kstrdup. Strings allocated by kstrdup_const should be freed by kfree_const.
