STRUCT BINDER_NODE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct binder_node(9) πŸ’…

okay bestie, welcome to the Kernel API Manual glow-up of struct binder_node(9). This is the binder node bookkeeping page, and yes, it's giving kernel-internal main character energy. Let's get into it 🫢


✨ NAME ✨

struct binder_node β€” binder node bookkeeping, but make it make sense.


πŸ’» SYNOPSIS πŸ’»

struct binder_node {
    int debug_id;
    spinlock_t lock;
    struct binder_work work;
    union {
      struct rb_node rb_node;
      struct hlist_node dead_node;
    };
    struct binder_proc *proc;
    struct hlist_head refs;
    int internal_strong_refs;
    int local_weak_refs;
    int local_strong_refs;
    int tmp_refs;
    binder_uintptr_t ptr;
    binder_uintptr_t cookie;
    struct {
      u8 has_strong_ref:1;
      u8 pending_strong_ref:1;
      u8 has_weak_ref:1;
      u8 pending_weak_ref:1;
    };
    struct {
      u8 accept_fds:1;
      u8 txn_security_ctx:1;
      u8 min_priority;
    };
    bool has_async_transaction;
    struct list_head async_todo;
 };

🫢 Members 🫢

  • debug_id β€” the unique ID for debugging, and it's invariant after initialized. No cap, it just sits there being itself.
  • lock β€” the lock for node fields. Protect the vibes πŸ”’
  • work β€” worklist element for node work, and it's protected by proc->inner_lock.
  • {unnamed_union} β€” anonymous. Literally just a union doing union things.
  • rb_node β€” element for the proc->nodes tree, protected by proc->inner_lock.
  • dead_node β€” element for the binder_dead_nodes list, protected by binder_dead_nodes_lock.
  • proc β€” the binder_proc that owns this node, and it's invariant after initialized.
  • refs β€” list of references on this node, protected by lock.
  • internal_strong_refs β€” used to take strong references when initiating a transaction. Protected by proc->inner_lock if proc and by lock.
  • local_weak_refs β€” weak user refs from the local process. Protected by proc->inner_lock if proc and by lock.
  • local_strong_refs β€” strong user refs from the local process. Protected by proc->inner_lock if proc and by lock.
  • tmp_refs β€” temporary kernel refs. Locking lore: protected by proc->inner_lock while proc is valid, and by binder_dead_nodes_lock if proc is NULL. During inc/dec and node release it is also protected by lock to provide safety as the node dies and proc becomes NULL. That's a lot of lock energy, bestie.
  • ptr β€” userspace pointer for the node. It's invariant, no lock needed.
  • cookie β€” userspace cookie for the node. Also invariant, no lock needed πŸͺ
  • {unnamed_struct} β€” anonymous. Another little struct just existing.
  • has_strong_ref β€” userspace notified of strong ref. Protected by proc->inner_lock if proc and by lock.
  • pending_strong_ref β€” userspace has acked notification of strong ref. Protected by proc->inner_lock if proc and by lock.
  • has_weak_ref β€” userspace notified of weak ref. Protected by proc->inner_lock if proc and by lock.
  • pending_weak_ref β€” userspace has acked notification of weak ref. Protected by proc->inner_lock if proc and by lock.
  • {unnamed_struct} β€” anonymous. Yes, another one. We love a mysterious bitfield moment.
  • accept_fds β€” file descriptor operations supported for the node, and it's invariant after initialized.
  • txn_security_ctx β€” require sender's security context, also invariant after initialized.
  • min_priority β€” minimum scheduling priority, invariant after initialized too.
  • has_async_transaction β€” async transaction to the node in progress, protected by lock.
  • async_todo β€” list of async work items, protected by proc->inner_lock.

🌸 Description 🌸

Bookkeeping structure for binder nodes. That's the whole plot. It's literally the bookkeeping structure for binder nodes, and it's iconic in a deeply kernel-internal way. Periodt πŸ’…


πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./drivers/android/binder_internal.h

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

okay that's the page! sourced from ./drivers/android, dated October 2026, and it's literally struct binder_node(9) β€” mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from