memtostr(9)
π NAME π
okay so bestie, welcome to memtostr(9) from the Kernel API Manual π. The vibe is literally: Copy a possibly non-NUL-term string to a NUL-term string. That's the whole name, no cap.
β¨ SYNOPSIS β¨
Here's the call exactly as it shows up, character for character:
memtostr (dest , src );
π ARGUMENTS π
destβ pointer to destination NUL-terminates string π that's the original wording, bestie, I'm just the messenger.srcβ pointer to character array, and it's likely marked as__nonstringπ«Ά.
π¦ DESCRIPTION π¦
So this is a replacement for strncpy uses where the source is not a NUL-terminated string. Slay β¨.
And here's the big caveat, pay attention: the sizes of dest and src must be known at compile-time. Must. Not maybe. Not "whenever you feel like it." Compile-time. π
Lowkey important, bestie: don't forget that compile-time size requirement, fr fr.
π SEE ALSO π
Kernel file ./include/linux/string.h is the spot, and the whole friend group is:
memdup_array_user(9)vmemdup_array_user(9)strscpy(9)strscpy_pad(9)mem_is_zero(9)sysfs_match_string(9)memzero_explicit(9)kbasename(9)strtomem_pad(9)strtomem(9)memtostr_pad(9)memset_after(9)memset_startat(9)str_has_prefix(9)strstarts(9)strends(9)
That's the whole page, bestie. Source/version:./include/linux; date: October 2026; manual page:memtostr(9). Periodt. ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms