strlcpy(9)
π strlcpy(9) β Kernel API Manual, bestie! π
Okay so this is the kernel API manual page for strlcpy(9) and weβre gonna make it make sense, no cap. β¨
π NAME π
strlcpy β Copy a C-string into a sized buffer. Literally what it says on the tin: it copies a C-string into a buffer that has a size. π«Ά
β¨ SYNOPSIS β¨
size_t strlcpy (char *dest , const char *src , size_t size );
πΈ ARGUMENTS πΈ
destβ Where to copy the string to. The destination. The place the copy lands. π₯srcβ Where to copy the string from. The source. The original string. π€sizeβ size of destination buffer. Yes, exactly that: the size of the destination buffer. π
π¦ DESCRIPTION π¦
Compatible with *BSD: the result is always a valid NUL-terminated string that fits in the buffer (unless, of course, the buffer size is zero). So like, itβs giving βalways a valid NUL-terminated string that fitsβ energy β with one giant exception: buffer size zero. π
It does not pad out the result like strncpy does. No extra filler, no padding drama. Periodt. β¨
If libc has strlcpy then that version will override this implementation: π no cap, libcβs version takes over.
π SEE ALSO π
- Kernel file
./tools/lib/string.c memdup(9)strtobool(9)skip_spaces(9)strim(9)strreplace(9)memchr_inv(9)
Cute little sign-off, bestie: this pageβs source/version is ./tools/lib πΈ, dated October 2026 π, and itβs the strlcpy(9) page. Slay. π
π¦ 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