kstrdup(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– kstrdup(9) πŸ’–

okay bestie, so this is a page from the Kernel API Manual and it's literally the whole kstrdup vibe. stay with me, it's short and it slays.


✨ NAME ✨

kstrdup β€” allocate space for and copy an existing string

like, it makes room and then copies the string into it. the whole package. πŸŽ€


🌸 SYNOPSIS 🌸

char * kstrdup (const char *s , gfp_t gfp );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • s β€” the string to duplicate. your main character string, the one getting copied πŸ’…
  • gfp β€” the GFP mask used in the kmalloc call when allocating memory. yes the memory allocation is happening, and this is the mask it uses, no cap

⭐ RETURN ⭐

it hands you a newly allocated copy of s β€” iconic β€” or NULL if something went wrong 😭 in case of error, it's NULL.

fr fr check it. NULL is a real possible answer here, don't just assume you got a string back and go dereferencing it, bestie πŸ’€

πŸ”₯ SEE ALSO πŸ”₯

this list is lowkey long but every single one of these is invited to the party, no gatekeeping:


and that's the page!! 🫢 this whole thing lives under ./mm, dated October 2026, and it's titled kstrdup(9) β€” go forth and duplicate your strings responsibly, bestie, mwah πŸ’œβœ¨πŸŒˆ

πŸ“¦ where this page comes from