kstrtoull(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ kstrtoull(9) πŸ¦‹

okay bestie, welcome to the kstrtoull(9) page from the Kernel API Manual πŸ’– this one is all about turning a string into an unsigned long long, and yes, the details matter fr fr.


🌸 NAME 🌸

kstrtoull β€” convert a string to an unsigned long long ✨


πŸŽ€ SYNOPSIS πŸŽ€

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

πŸ’… ARGUMENTS πŸ’…

  • s β€” the start of the string, bestie. The string must be null-terminated, and it may also include a single newline before its terminating null. The first character may also be a plus sign, but not a minus sign πŸ™ˆ
  • base β€” the number base to use. The maximum supported base is 16. If base is given as 0, then the base of the string is automatically detected with the conventional semantics: if it begins with 0x the number will be parsed as a hexadecimal (case insensitive), if it otherwise begins with 0, it will be parsed as an octal number. Otherwise it will be parsed as a decimal πŸ”₯
  • res β€” where to write the result of the conversion on success 🫢

🌈 DESCRIPTION 🌈

Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. Preferred over simple_strtoull. Return code must be checked. no cap, do not skip that check 😭

bestie, this is the moment to be a responsible main character: check the return code. periodt πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./lib/kstrtox.c β€” peep these icons:


mwah πŸ’‹ this lil page came from ./lib, dated October 2026, and it’s your girl kstrtoull(9) β€” slay and read the return code πŸ’–βœ¨

πŸ“¦ where this page comes from