list_first_entry_or_null(9)
β¨ list_first_entry_or_null(9) β¨
okay so bestie, welcome to the list_first_entry_or_null page of the Kernel API Manual β yes that's the manual name, we're fancy now π
. This one is short, sweet, and honestly kind of an icon.
πΈ NAME πΈ
list_first_entry_or_null β get the first element from a list π«Ά
π SYNOPSIS π
list_first_entry_or_null (ptr , type , member );
that's it, that's the whole vibe. three args, no drama β¨
π¦ ARGUMENTS π¦
ptrβ the list head to take the element from. like, this is where the list starts, girlie πtypeβ the type of the struct this is embedded in. the big container energy πmemberβ the name of thelist_headwithin the struct. the little handle inside the struct that we're actually grabbing π
π DESCRIPTION π
so here's the one thing you HAVE to remember: if the list is empty, it returns NULL. no cap, that's the whole note. empty list = NULL, and honestly that's the safe-and-slay behaviour right there πβ¨
π« SEE ALSO π«
Kernel file ./tools/include/linux/list.h β and now the whole group chat, fr fr:
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_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_continue(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)
ngl the whole linked-list family is in this SEE ALSO and they're all linked, so go read them if you want the full lore π§
okay that's the page!! π this little drop is from ./tools/include/linux, dated October 2026 β bookmark it, screenshot it, send it to the group chat, whatever feels right. bye bestie, go get that first element (or NULL, respectfully) πβ¨π₯
π¦ 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