list_last_entry_or_null(9)
π NAME
list_last_entry_or_null β bestie, this one grabs the last element from a list β¨
(it's the manual page for the Kernel API Manual, in case you were wondering π)
πΈ SYNOPSIS
list_last_entry_or_null (ptr , type , member );
π¦ ARGUMENTS
ptrβ the list head you're taking the element from. like, the starting point of the whole situation π«typeβ the type of the struct this is embedded in. yes, the outer struct, the one doing the cosplay π«Άmemberβ the name of thelist_headwithin the struct. the actual list-y bit inside π
β¨ DESCRIPTION
okay so real talk: if the list is empty, it returns NULL π« that's the whole vibe check. no elements, no element, you get NULL back and you just have to deal with it π
lowkey the most important line on this whole page ngl β empty list means NULL, no cap π
π SEE ALSO
the kernel file ./tools/include/linux/list.h β that's where the magic lives π§ and literally the entire list family:
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_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)
like. the whole friend group showed up to the function ππ icon behavior tbh
β¨ that's a wrap, bestie β¨ this page is from ./tools/include/linux and it's dated October 2026 β slay, go forth and get your last element ππ
π¦ 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