idr_get_next_ul(9)
π NAME π
idr_get_next_ul β bestie, it finds the next populated entry. That's the whole vibe β¨
πΈ SYNOPSIS πΈ
void * idr_get_next_ul (struct idr *idr , unsigned long *nextid );
π ARGUMENTS π
idrβ your IDR handle π«Ά the little tree you're digging through.nextidβ a pointer to an ID. Yeah, a pointer β we're doing pointer things, keep up π
π¦ DESCRIPTION π¦
okay so listen. idr_get_next_ul returns the next populated entry in the tree whose ID is greater than or equal to the value that nextid is pointing at. Slay π₯
On exit, nextid gets updated to the ID of the value it found β literally it rewrites itself to tell you where it landed π
And here's the part everyone forgets, no cap: to use it in a loop, the value pointed to by nextid must be incremented by the user. Like, by you. Manually. It does not do it for you π so don't come crying to me when you get the same entry forever, iykyk.
fr fr: increment it yourself or you're stuck in an infinite loop and that's on you, not on the kernel π
π SEE ALSO π
Kernel file ./lib/idr.c β and the whole friend group:
idr_alloc_u32(9)idr_alloc(9)idr_alloc_cyclic(9)idr_remove(9)idr_find(9)idr_for_each(9)idr_get_next(9)idr_replace(9)IDA description(9)ida_alloc_range(9)ida_find_first_range(9)ida_free(9)ida_destroy(9)
mmm okay that's the whole page, you ate that π stay hydrated, go increment your nextid, and remember: this one lives in ./lib, dated October 2026, and it's idr_get_next_ul(9) β main character energy only πβ¨
π¦ 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