kernfs_link_sibling(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

Okay so real talk: this is a page from the kernel API manual, section 9, and the function we're obsessing over today is kernfs_link_sibling. Yes it's a long name. Yes it ate. Let's get into it 🫢


✨ NAME ✨

kernfs_link_sibling β€” the girlypop that links a kernfs_node into its sibling rbtree 🌸

✨ SYNOPSIS ✨

int kernfs_link_sibling (struct kernfs_node *kn );

✨ ARGUMENTS ✨

  • kn β€” the kernfs_node of interest πŸ’– like, this is the node we're talking about, the main character of this whole operation honestly

✨ DESCRIPTION ✨

So here's the vibe: kernfs_link_sibling links kn into its sibling rbtree β€” and that rbtree starts all the way up at kn->parent->dir.children. Yes, you read that right, we're going through the parent. πŸ¦‹

Locking tea β˜•: kernfs_rwsem is held exclusive. No sharing, no friends, exclusive. Do not come for this function without holding it, fr fr.

✨ RETURN ✨

  • 0 on success β€” slay, we ate πŸ’…
  • -EEXIST on failure β€” ngl, it's already there 😭

✨ SEE ALSO ✨

Kernel file ./fs/kernfs/dir.c β€” and here's the whole friend group, no cap:


And that's the whole page, bestie πŸŽ€ This one's from ./fs/kernfs, dated October 2026, and it lives at kernfs_link_sibling(9) β€” go off, icon πŸ‘‘

πŸ“¦ where this page comes from