_parse_integer_limit(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

okay bestie, say hi to _parse_integer_limit(9) from the Kernel API Manual โœจ this one is a lowkey workhorse, but weโ€™re gonna get through it together, fr fr ๐Ÿ’…

๐ŸŽ€ NAME ๐ŸŽ€

_parse_integer_limit โ€” convert integer string representation to an integer ๐Ÿงฎโœจ

๐ŸŒธ SYNOPSIS ๐ŸŒธ

unsigned int _parse_integer_limit (const char *s , unsigned int base ,
       unsigned long long *p , size_t max_chars , unsigned long long init );

๐Ÿฆ‹ ARGUMENTS ๐Ÿฆ‹

  • s โ€” Integer string representation. the string bestie, the main character of this conversion ๐Ÿ’–
  • base โ€” Radix. yes, the radix ๐Ÿงฎโœจ
  • p โ€” Where to store result. this is where the result goes ๐Ÿ‘‘
  • max_chars โ€” Maximum amount of characters to convert. literally the max amount of characters to convert ๐Ÿ”ฅ
  • init โ€” Initial value of the multiply-accumulate result. the starting value for the multiply-accumulate situation ๐Ÿซถ

๐Ÿ’œ DESCRIPTION ๐Ÿ’œ

okay so what it does: it converts a non-negative integer string representation in an explicitly given radix to an integer. If overflow occurs, the value at p is set to ULLONG_MAX ๐Ÿšจ๐Ÿ˜ญ

also important: this function is the workhorse of other string conversion functions, and it is discouraged to use it explicitly. Consider the kstrto*() family instead. iykyk ๐Ÿ’…โœจ

๐ŸŒˆ RETURN ๐ŸŒˆ

Number of characters consumed, maybe ORed with overflow bit ๐Ÿ‘€๐Ÿ’ซ

โญ SEE ALSO โญ

Kernel file ./lib/kstrtox.c and the gang: kstrtoull(9), kstrtoll(9), kstrtouint(9), kstrtoint(9), kstrtobool(9), kstrtoudec64(9), kstrtodec64(9) ๐Ÿซถ go read those if youโ€™re being a good bestie ๐Ÿฆ‹


mwah ๐Ÿ’‹ โ€” source/version: ./lib, date: October 2026, signing off from the Kernel API Manual girlies ๐ŸŽ€๐ŸŒธ

๐Ÿ“ฆ where this page comes from