linear_range...ector_within(9)
π linear_range_get_selector_within β the manual, but make it make sense
okay bestie, this one's a Kernel API Manual page and it's lowkey tiny but it's important, so let's get into it π«Ά
β¨ NAME β¨
linear_range_get_selector_within β literally returns the linear range selector for a value. that's the whole job. icon behaviour fr π
πΈ SYNOPSIS πΈ
void linear_range_get_selector_within (const struct linear_range *r ,
unsigned int val ,
unsigned int *selector );
no cap, that's the exact signature β copy it character for character or it's not gonna compile, and we don't do that here π
π ARGUMENTS π
rβ pointer to the linear range where the selector is being looked up from. it's giving "the map, not the destination" πΊοΈvalβ the value we're hunting a selector for. the main character of this whole operation ngl β¨selectorβ the address where the found selector value gets updated. yes, it writes through a pointer. yes, that's the vibe π₯
π¦ DESCRIPTION π¦
okay so here's what's happening π§
This one returns the selector whose range value is the closest match for the input value you handed it. A value counts as matching if it is equal to or lower than the given value β like the closest thing that doesn't overshoot π―
But β and this is the plot twist β if the given value is higher than the maximum value, it returns the maximum selector instead. highkey important, don't forget it π
selector is an out-param, bestie. it's the address where the found selector value gets updated, so make sure it points somewhere real before you call this π«Ά
π SEE ALSO π
kernel file ./lib/linear_ranges.c, plus the whole friend group:
linear_range_values_in_range(9)linear_range_values_in_range_array(9)linear_range_get_max_value(9)linear_range_get_value(9)linear_range_get_value_array(9)linear_range_get_selector_low(9)linear_range_get_selector_low_array(9)linear_range_get_selector_high(9)linear_range_get_selector_high_array(9)
all of them, together, slaying in ./lib π
and that's the page, bestie π it lives in ./lib, it's dated October 2026, and it's filed under the Kernel API Manual β periodt, go read the source, iykyk πβ
π¦ 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