disassociate_ctty(9)
π 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:
- Sends a
SIGHUPandSIGCONTto the foreground process group π£ - Clears the tty from being controlling the session π§Ή
- 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 fromno_tty.tty_mutexis taken to protect tty βsiglockis taken to protect->signal/->sighand.tasklist_lockis taken to walk process list for sessions βsiglockis 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
__tty_check_change(9)__proc_set_tty(9)tty_signal_session_leader(9)tiocsctty(9)tty_get_pgrp(9)tiocgpgrp(9)tiocspgrp(9)tiocgsid(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms