boot_kstrtoul(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ boot_kstrtoul(9) ✨

okay so bestie, welcome to the Kernel API Manual πŸ’– this one is short and sweet and it's literally just "string goes in, unsigned long comes out" β€” let's get into it πŸŽ€


🌸 NAME 🌸

boot_kstrtoul β€” convert a string to an unsigned long πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

int boot_kstrtoul (const char *s , unsigned int base , unsigned long *res );

πŸŽ€ ARGUMENTS πŸŽ€

  • s β€” the start of the string, bestie. it must be null-terminated, and it may also include a single newline before its terminating null (yes, one, don't get greedy πŸ™ˆ). the first character may also be a plus sign, but not a minus sign β€” no negatives allowed, periodt.
  • base β€” the number base to use. the maximum supported base is 16 (that's the ceiling, we don't go higher βœ‹). if base is given as 0, then the base of the string is auto-detected with the conventional semantics: if it begins with 0x the number will be parsed as a hexadecimal (case insensitive, so 0x and 0X both slay), if it otherwise begins with 0 it will be parsed as an octal number, and otherwise it will be parsed as a decimal. it's giving detective energy πŸ”
  • res β€” where to write the result of the conversion on success. that's the drop-off point πŸ“¦

πŸ’œ DESCRIPTION πŸ’œ

okay so here's the tea β˜• this returns 0 on success, -ERANGE on overflow (number too big, it literally can't even 😭), and -EINVAL on a parsing error (the string said something unparseable and we're not entertaining it πŸ’€).

it's used as a replacement for the simple simple_strtoull. lowkey iconic of it to step in like that πŸ‘‘


🌈 SEE ALSO 🌈

go read those too, iykyk 🫢


ngl bestie, remember: no minus sign, max base 16, and always check that return value or you WILL be sad πŸ™ˆ

and that's the whole page, fr fr πŸ’–βœ¨ this one lives in ./arch/x86/boot, dated October 2026 β€” mwah, catch you in the next manpage, bestie πŸŽ€πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from