list_first_entry_or_null(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 the list_head within 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:


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