vsprintf(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

vsprintf β€” bestie, this is the one that takes your format string and your va_list and just slaps the finished string straight into a buffer for you. It's from the Kernel API Manual side of town, section 9 (kernel API, iykyk) πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

int vsprintf (char *buf , const char *fmt , va_list args );

That's the whole vibe. Three args, one int coming back at you πŸ¦‹


🌸 ARGUMENTS 🌸

  • buf β€” the buffer where the final result gets dropped off. It's giving "the destination", the place the string actually lives πŸ’–
  • fmt β€” the format string you wanna use. This is the one doing all the work, okurrr πŸ”₯
  • args β€” the arguments for that format string, already wrapped up in a va_list 🎁

🧚 DESCRIPTION 🧚

So the return value? It's the number of characters written into buf, and that count does not include the trailing ' '. Yes, that's literally what the page says, I'm not gonna gaslight you πŸ’€

🚨 Real talk though: use vsnprintf or vscnprintf if you wanna avoid buffer overflows. vsprintf does not know where your buffer ends, and she will keep writing. No cap. That's a whole dangerous situation and you do not want that energy in your kernel 🫢

If you're not already dealing with a va_list, lowkey consider using sprintf instead β€” it's way less extra ✨

Also, for real, go check the vsnprintf documentation for the format string extensions over C99 β€” that's where the details live, bestie πŸ‘‘


πŸ’œ SEE ALSO πŸ’œ


okay that's the whole page, slay πŸ’…βœ¨

Signed off from ./lib, dated October 2026, and yeah β€” it's still vsprintf(9) at the bottom, iconic as ever πŸ‘‘πŸŽ€

πŸ“¦ where this page comes from