list_last_entry_or_null(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 the list_head within 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