STRUCT BINDER_THREAD(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct binder_thread(9) β€” binder thread bookkeeping πŸ’–

hey bestie 🫢 welcome to the Kernel API Manual page for struct binder_thread(9). this is literally the bookkeeping arc for binder threads, and it's lowkey iconic how much tiny state lives in this one struct πŸ’…


🌸 NAME 🌸

struct binder_thread β€” binder thread bookkeeping. that's the whole vibe: binder's per-thread little admin nest ✨


πŸŽ€ SYNOPSIS πŸŽ€

       struct binder_thread {
           struct binder_proc *proc;
           struct rb_node rb_node;
           struct list_head waiting_thread_node;
           int pid;
           int looper;
           bool looper_need_return;
           struct binder_transaction *transaction_stack;
           struct list_head todo;
           bool process_todo;
           struct binder_error return_error;
           struct binder_error reply_error;
           struct binder_extended_error ee;
           wait_queue_head_t wait;
           struct binder_stats stats;
           atomic_t tmp_ref;
           bool is_dead;
        };

πŸ¦‹ Members πŸ¦‹

  • proc β€” the binder process this thread belongs to. it's invariant after initialization, so once it's set, it stays set β€” no cap 🫢
  • rb_node β€” the element for the proc->threads rbtree. protected by proc->inner_lock, so respect the lock bestie πŸ”’
  • waiting_thread_node β€” element for the proc->waiting_threads list. also protected by proc->inner_lock ✨
  • pid β€” the PID for this thread. invariant after initialization, meaning it's not out here changing its whole personality πŸ’…
  • looper β€” bitmap of looping state. only accessed by this thread, so it's giving "no sharing, no drama" energy πŸ¦‹
  • transaction_stack β€” stack of in-progress transactions for this thread. protected by proc->inner_lock πŸ”₯
  • todo β€” list of work to do for this thread. protected by proc->inner_lock πŸ“‹
  • process_todo β€” whether work in todo should be processed. protected by proc->inner_lock βœ…
  • return_error β€” transaction errors reported by this thread. only accessed by this thread β€” personal error journal vibes 😭
  • reply_error β€” transaction errors reported by the target thread. protected by proc->inner_lock πŸ’Œ
  • ee β€” extended error information from this thread. protected by proc->inner_lock πŸ”
  • wait β€” wait queue for thread work. the thread waits here for work, cute πŸŽ€
  • stats β€” per-thread statistics. they're atomics, so no lock needed πŸ“Š
  • tmp_ref β€” temporary reference to indicate the thread is in use. it's atomic since proc->inner_lock cannot always be acquired β€” this is a real caveat, not just lore bestie ⚠️
  • is_dead β€” thread is dead and awaiting free when outstanding transactions are cleaned up. protected by proc->inner_lock πŸ’€
tiny note bestie: looper_need_return shows up in the struct up top, but this page doesn't give it a separate member blurb, so i'm not making one up πŸ’…

🌈 Description 🌈

okay so this is the bookkeeping structure for binder threads. that's it, that's the tea β€” it's the struct that keeps binder threads' bookkeeping together, and this page is the field-by-field tour βœ¨πŸ’–


⭐ SEE ALSO ⭐

bestie, go peek at these:

  • Kernel file ./drivers/android/binder_internal.h
  • struct binder_device(9)
  • struct binder_work(9)
  • struct binder_node(9)
  • struct binder_ref_data(9)
  • struct binder_ref(9)
  • struct binder_proc(9)
  • struct binder_txn_fd_fixup(9)
  • struct binder_object(9)

k that's the page 🫢 source/version: ./drivers/android Β· date: October 2026 Β· page: struct binder_thread(9) β€” slay and stay bookkept βœ¨πŸ’–

πŸ“¦ where this page comes from