bitmap_parselist(9)
π bitmap_parselist(9) β the kernel API manual, bestie edition π
okay so we're doing bitmap_parselist today, from the Kernel API Manual, and honestly? she's iconic. this is the function that takes a cute little ASCII list and turns it into a bitmap. let's get into it β¨
πΈ NAME πΈ
bitmap_parselist β convert list format ASCII string to bitmap
like, string goes in, bitmap comes out. that's the whole vibe. π
π¦ SYNOPSIS π¦
int bitmap_parselist (const char *buf , unsigned long *maskp , int
nmaskbits );
three args, no cap. she takes buf, maskp, and nmaskbits and returns an int. periodt. π
π ARGUMENTS π
bufβ read the user string from this buffer, bestie. it must be terminated with a\nor0. do not skip this, i'm literally begging π₯Ίmaskpβ write the resulting mask right here, this is where the good stuff goes β¨nmaskbitsβ the number of bits in the mask that are gonna get written. so like, the size of the whole situation π
π DESCRIPTION π
so the input format is a comma-separated list of decimal numbers and ranges. consecutively set bits get shown as two hyphen-separated decimal numbers β the smallest and the largest bit numbers set in the range. simple, slay π
optionally, each range can be postfixed to say "hey, only parts of this range should be set." the range will be divided into groups of a specific size, and from each group only a defined amount of bits gets used. the syntax is, drumroll please:
range:used_size/group_size
and here are the error values, aka the moments where she says "no β€οΈ":
`-EINVAL`: wrong region format π`-EINVAL`: invalid character in string π`-ERANGE`: bit number specified is too large for the mask π`-EOVERFLOW`: integer overflow in the input parameters π₯
β EXAMPLE β
0-1023:2/256 ==> 0,1,256,257,512,513,768,769
look at her go. genuinely obsessed π«Ά
also!! the value N can be used as a dynamically substituted token for the maximum allowed value β that's (nmaskbits - 1), iykyk. but keep in mind that it is dynamic, so if system changes cause the bitmap width to change (like, say, more cores showing up in a CPU list), then any ranges using N will change too. she's flexible like that π
π« RETURN π«
0 on success, -errno on invalid input strings. the error values are the ones listed above, in DESCRIPTION, where they live π§
π SEE ALSO π
- Kernel file
./lib/bitmap-str.c bitmap_parse_user(9)bitmap_print_to_buf(9)bitmap_print_bitmask_to_buf(9)bitmap_print_list_to_buf(9)bitmap_parselist_user(9)bitmap_parse(9)
go read the whole friend group, they're all main characters π
ngl, the error bullet list technically lives inside DESCRIPTION in this page but it's describing the RETURN values β that's just how the original rolls, don't come for me π
and that's the page, bestie!! brought to you by ./lib, October 2026 edition of bitmap_parselist(9) β she ate and left no crumbs πβ¨π
π¦ 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