hlist_add_head(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– hlist_add_head(9) πŸ’–

okay so this is a page from the Kernel API Manual, and bestie, it's a short one but it's literally iconic. sit down, grab a boba, let's go ✨


🌸 NAME 🌸

hlist_add_head β€” add a new entry at the beginning of the hlist πŸŽ€

like, the very beginning. front of the line. main character spot. no cap πŸ’…


✨ SYNOPSIS ✨

void hlist_add_head (struct hlist_node *n , struct hlist_head *h );

that's it. two pointers, zero drama, returns nothing (void bestie, it's giving "I do this for the plot, not for the return value") πŸ¦‹


🫢 ARGUMENTS 🫢

  • n β€” the new entry you're adding. your little guy. your blorbo. the fresh node going in πŸ’–
  • h β€” the hlist head you're adding it after. the vibe anchor. the boss of the list πŸ‘‘

πŸ”₯ DESCRIPTION πŸ”₯

Insert a new entry after the specified head. periodt. that's the whole thing.

and the best part? this is good for implementing stacks. the way that a stack is literally just "newest thing on top" and this function is literally "newest thing at the front" β€” the synergy is unmatched, I'm obsessed 😭πŸ”₯ LIFO girlies stay winning fr fr.

ngl it's a tiny function but it's carrying entire data structures on its back. respect the hustle πŸ’…

πŸ’œ SEE ALSO πŸ’œ

Kernel file ./scripts/include/list.h β€” that's where the magic lives, go read it, iykyk πŸ“–βœ¨

and then the whole friend group:


anyway that's the page πŸŽ€ this came out of ./scripts/include, dated October 2026, and honestly? slay. go add something to the head of a list, you've earned it πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from