STRUCT BINDER_REF(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct binder_ref(9) β€” a Kernel API Manual moment, bestie

okay so welcome to the <pink>Kernel API Manual</pink> entry for struct binder_ref, and no cap this one is a baddie: it's literally the little bookkeeping struct that keeps track of references on nodes. come on, let's get into it πŸŽ€


✨ NAME ✨

struct binder_ref β€” the struct whose whole job is tracking references on nodes. she's giving backstage pass coordinator, and honestly? iconic. πŸ‘‘


🌸 SYNOPSIS 🌸

struct binder_ref {
    struct binder_ref_data data;
    struct rb_node rb_node_desc;
    struct rb_node rb_node_node;
    struct hlist_node node_entry;
    struct binder_proc *proc;
    struct binder_node *node;
    struct binder_ref_death *death;
    struct binder_ref_freeze *freeze;
 };

look at her. all those members. so organised. we love a structured queen πŸ’–


πŸ¦‹ Members πŸ¦‹

  • data β€” a binder_ref_data holding the id, handle, and the current refcounts. the whole personality in one member fr fr ✨
  • rb_node_desc β€” the node used for lookup by data.desc in the proc's rb_tree. red-black tree realness.
  • rb_node_node β€” the node used for lookup by node in the proc's rb_tree. yes, another one, she contains multitudes 🫢
  • node_entry β€” the list entry for the node->refs list in the target node. lowkey important: it's protected by node->lock πŸ”’
  • proc β€” the binder_proc containing this ref.
  • node β€” the binder_node of the target node. and listen, this one has lore: when cleaning up a ref for deletion in binder_cleanup_ref, a non-NULL node indicates the node must be freed. so like, don't sleep on it 😭
  • death β€” pointer to the death notification (ref_death) if it was requested. protected by node->lock πŸ’€
  • freeze β€” pointer to the freeze notification (ref_freeze) if it was requested. also protected by node->lock 🧊

πŸ’œ Description πŸ’œ

so basically, this is the structure that tracks references from procA to a target node (which lives on procB). she's the middlewoman, the group chat admin connecting two processes, and she does it beautifully 🌈

⚠️ but bestie, listen to me: this structure is unsafe to access without holding proc->outer_lock. no cap. do not touch her without that lock. that's the whole vibe check and you do not want to fail it πŸ’…

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./drivers/android/binder_internal.h, plus the whole friend group:

  • struct binder_device(9)
  • struct binder_work(9)
  • struct binder_node(9)
  • struct binder_ref_data(9)
  • struct binder_proc(9)
  • struct binder_thread(9)
  • struct binder_txn_fd_fixup(9)
  • struct binder_object(9)

go read them. they're all slaying in their own lanes πŸ“


and that's the whole page, periodt πŸ’… this came out of ./drivers/android, dated October 2026, and yes the source/version deserves its moment too β€” struct binder_ref(9), mwah. take care of her, hold that proc->outer_lock, and stan responsibly πŸ§šπŸ’–

πŸ“¦ where this page comes from