disassociate_ctty(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… disassociate_ctty β€” bestie's guide to yeeting your controlling tty

okay so this one lives in the Kernel API Manual, section 9, and it's literally called disassociate_ctty(9). the whole vibe? disconnect controlling tty. that's it, that's the function πŸŽ€


✨ SYNOPSIS ✨

void disassociate_ctty (int on_exit );

🫢 ARGUMENTS 🫢

  • on_exit β€” true if you're exiting, meaning we actually need to "hang up" the session. like, fr fr hang it up πŸ‘‹

🌸 DESCRIPTION 🌸

so this function is typically called only by the session leader, when it wants to disassociate itself from its controlling tty. main character energy only, no cap πŸ’…

here's what it does, bestie β€” three whole things:

  1. Sends a SIGHUP and SIGCONT to the foreground process group πŸ“£
  2. Clears the tty from being controlling the session 🧹
  3. Clears the controlling tty for all processes in the session group 🌈

the on_exit argument gets set to 1 if it's called when a process is exiting; it's 0 if it's called by the ioctl TIOCNOTTY. iykyk ✨

Locking: BTM is taken for hysterical raisons, and held when called from no_tty. tty_mutex is taken to protect tty β†’ siglock is taken to protect ->signal/->sighand. tasklist_lock is taken to walk process list for sessions β†’ siglock is taken to protect ->signal/->sighand. yes, both of those last two really are in there twice β€” not me editing the lore πŸ™ˆ

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./drivers/tty/tty_jobctrl.c


and that's the whole page, bestie πŸ“ source lives at ./drivers/tty, dated October 2026, and it's disassociate_ctty(9) forever and always. slay, go touch some tty-less grass πŸ’œπŸ‘‘

πŸ“¦ where this page comes from