list_for_ea...afe_continue(9)
π list_for_each_entry_safe_continue β NAME β¨
okay so hi bestie, welcome to the Kernel API Manual π β this page is literally about list_for_each_entry_safe_continue, which is the "keep the list iteration going, but like, safely" one. No cap.
(yes the page header was out here truncating itself to list_for_ea...afe_continue(9) β she's a little dramatic, we love her anyway π
)
πΈ SYNOPSIS πΈ
list_for_each_entry_safe_continue (pos , n , head , member );
π¦ ARGUMENTS π¦
posβ the *type ** you're using as your loop cursor. this is your main character β¨nβ another *type ** β this one's just holding space as temporary storage π«Άheadβ the head of your list, the head that runs the whole thing πmemberβ the name of thelist_headsitting inside the struct, iykyk
π DESCRIPTION π
so basically: it iterates over a list of the given type, and it keeps going after the current point β but the iconic part? it's safe against removal of a list entry ππ₯
like, you can be out here deleting stuff mid-loop and she's not gonna fall apart on you. ate and left no crumbs.
lowkey important: "safe against removal" is the whole reason you'd reach for this one instead of a plain loop. don't sleep on it π«Ά
π SEE ALSO π
Kernel file ./tools/include/linux/list.h, plus the whole friend group (fr fr, it's a big group chat):
list_add(9)list_add_tail(9)list_replace(9)list_del_init(9)list_move(9)list_move_tail(9)list_is_first(9)list_is_last(9)list_empty(9)list_empty_careful(9)list_rotate_left(9)list_is_singular(9)list_cut_position(9)list_splice(9)list_splice_tail(9)list_splice_init(9)list_splice_tail_init(9)list_entry(9)list_first_entry(9)list_last_entry(9)list_first_entry_or_null(9)list_last_entry_or_null(9)list_next_entry(9)list_prev_entry(9)list_for_each(9)list_for_each_prev(9)list_for_each_safe(9)list_for_each_prev_safe(9)list_for_each_entry(9)list_for_each_entry_reverse(9)list_prepare_entry(9)list_for_each_entry_continue(9)list_for_each_entry_continue_reverse(9)list_for_each_entry_from(9)list_for_each_entry_safe(9)list_for_each_entry_safe_from(9)list_for_each_entry_safe_reverse(9)list_safe_reset_next(9)hlist_for_each_entry(9)hlist_for_each_entry_continue(9)hlist_for_each_entry_from(9)hlist_for_each_entry_safe(9)list_del_range(9)list_for_each_from(9)
and that's the whole page bestie π§π this lil drop came from ./tools/include/linux and it's dated October 2026 β screenshot it, cite it, slay π
β¨
π¦ 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