bstr_printf(9)
π bstr_printf(9)
okay so welcome to bstr_printf(9) from the Kernel API Manual β yes bestie, the kernel has its own manual and we're reading it, main character energy fr fr β¨
πΈ NAME
bstr_printf β format a string from binary arguments and place it in a buffer π
β¨ SYNOPSIS
int bstr_printf (char *buf , size_t size , const char *fmt_str , const
u32 *bin_buf );
π¦ ARGUMENTS
bufβ the buffer you're dropping the result into πsizeβ how big that buffer is, including the trailing null space (yes, the null counts, don't forget it π)fmt_strβ the format string you wanna use πbin_bufβ the binary arguments for that format string π§
π DESCRIPTION
So this function is like C99 vsnprintf, but there's a difference: vsnprintf grabs its arguments off the stack, and bstr_printf grabs its arguments from bin_buf, which is a binary buffer that was generated by vbin_printf. it's giving "same vibe, different source" π«
The format follows C99 vsnprintf, but it's got some extensions β see the vsnprintf comment for the details, iykyk π
Now, the return value: it's the number of characters which would be generated for the given input, excluding the trailing number of characters written into buf as return value (not including the trailing ' '), use vscnprintf. (yes, that trailing ' ' is literally how it's printed on the page β don't come for me, I'm just the messenger π)
β οΈ And listen: if the return is greater than or equal to size, the resulting string gets truncated. so keep an eye on that π
π₯ SEE ALSO
Kernel file ./lib/vsprintf.c, plus: simple_strtoull(9), simple_strtoul(9), simple_strtol(9), simple_strtoll(9), vsnprintf(9), vscnprintf(9), snprintf(9), scnprintf(9), vsprintf(9), sprintf(9), vbin_printf(9), vsscanf(9), sscanf(9) π
and that's the page, bestie β brought to you from ./lib, dated October 2026, filed under bstr_printf(9). slay, go format something π
π
π¦ 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