boot_kstrtoul(9)
β¨ 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 β). ifbaseis given as0, then the base of the string is auto-detected with the conventional semantics: if it begins with0xthe number will be parsed as a hexadecimal (case insensitive, so0xand0Xboth slay), if it otherwise begins with0it 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 π
- Kernel file
./arch/x86/boot/string.c simple_strtoull(9)strlen(9)strstr(9)strchr(9)
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
- 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