strtomem(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… strtomem(9) πŸ’…

okay so welcome to the Kernel API Manual corner, bestie β€” this is the page for strtomem(9), and it's lowkey iconic for one specific job. ✨


🌸 NAME 🌸

strtomem β€” copy a NUL-terminated string to a non-NUL-terminated buffer. no cap, that's the whole serve. πŸ’–


✨ SYNOPSIS ✨

strtomem (dest , src );

πŸŽ€ ARGUMENTS πŸŽ€

  • dest β€” pointer of destination character array (marked as __nonstring) 🫢
  • src β€” pointer to a NUL-terminated string 🌈

πŸ’– DESCRIPTION πŸ’–

This is a replacement for strncpy uses where the destination is not a NUL-terminated string, but with bounds checking on the source size, and without trailing padding. it's giving "safe copy, no extra fluff." πŸ’…

If padding is required, use strtomem_pad instead β€” that's the padded bestie. πŸŽ€

note that the size of dest is not an argument, as the length of dest must be discoverable by the compiler. literally the compiler has to be able to figure it out, so don't come for this function with mystery sizes. 😭

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./include/linux/string.h is the home base, and these linked besties are all part of the crew:


this page is brought to you by ./include/linux, dated October 2026, and it's serving strtomem(9) energy from the source to the very end. πŸ’–βœ¨πŸ‘‘

πŸ“¦ where this page comes from