list_private...try_circular(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… list_private_next_entry_circular β€” the "and now back to the start" girlie πŸ’…

ok so real talk, this one lives in the Kernel API Manual and it's genuinely one of my faves because it does the thing every good playlist does: loops back around πŸ”βœ¨


✨ NAME ✨

list_private_next_entry_circular β€” grab the next element in the list, bestie. and yeah, if you're at the end? she wraps. iconic behaviour tbh πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

list_private_next_entry_circular (pos , head , member );

that's it, that's the whole vibe. three args, one very slay macro πŸ’…


🌸 ARGUMENTS 🌸

  • pos β€” the type * you're using as your cursor, like your little finger pointing at where you're at rn πŸ“
  • head β€” the list head you're taking the element from, aka the main character of this whole list situation πŸ‘‘
  • member β€” the name of the list_head inside the struct. yes you have to spell it out exactly, no guessing, iykyk 🫢

πŸ’– DESCRIPTION πŸ’–

okay so here's the tea β˜• β€” this macro wraps around if pos is the last element, and it returns the first element instead. so no matter where you are, you always get a next. she literally never leaves you hanging πŸ’€βœ¨

⚠️ heads up bestie: the list is expected to be not empty. that's not me being dramatic, that's the spec. do not come for me if you pass an empty list, okay? πŸ™ˆ

πŸ”₯ SEE ALSO πŸ”₯

the whole friend group fr fr, go read them all:


okay that's the whole page, go forth and wrap around responsibly πŸ’œπŸ¦‹

shoutout to ./include/linux for housing this masterpiece, October 2026 for the timestamp, and the manual page list_private...try_circular(9) β€” yeah the footer name is a little unhinged but we love her anyway πŸŽ€βœ¨

πŸ“¦ where this page comes from