tty_set_ldisc(9)
π tty_set_ldisc(9) π
okay bestie, welcome to the Kernel API Manual β we're doing tty_set_ldisc(9) today and honestly it's giving "small function, big responsibilities" β¨
πΈ NAME πΈ
tty_set_ldisc β set line discipline
like, literally just: set the line discipline. that's the whole gig. π
β¨ SYNOPSIS β¨
int tty_set_ldisc (struct tty_struct *tty , int disc );
π¦ ARGUMENTS π¦
ttyβ the terminal you're setting. the main character terminal, if you will πdiscβ the line discipline number. the vibe you're assigning to it π
π₯ DESCRIPTION π₯
so the whole point: you're setting the discipline of a tty line. that's it, that's the function. π«Ά
β οΈ real talk though: it must be called from a process context. no cap. don't try to be cute and call it from somewhere else, that's not the move π
ngl the ldisc change logic has to be kind of paranoid, and for good reason β it has to protect itself against:
- any overlapping ldisc change (including a change happening on the other end of pty pairs π the way that pty pair is also living its own life)
- the close of one side of a tty/pty pair π
- and eventually hangup π
so yeah, it's guarding against a whole group chat of race conditions. slay that it handles it, but don't make its life harder. periodt.
π SEE ALSO π
Kernel file ./drivers/tty/tty_ldisc.c β and the whole ldisc friend group, which is honestly iconic π§:
tty_register_ldisc(9)tty_unregister_ldisc(9)tty_ldisc_get(9)tty_ldisc_put(9)tty_ldisc_ref_wait(9)tty_ldisc_ref(9)tty_ldisc_deref(9)tty_ldisc_flush(9)tty_set_termios_ldisc(9)tty_ldisc_open(9)tty_ldisc_close(9)tty_ldisc_failto(9)tty_ldisc_restore(9)tty_ldisc_kill(9)tty_reset_termios(9)tty_ldisc_reinit(9)tty_ldisc_hangup(9)tty_ldisc_setup(9)tty_ldisc_release(9)tty_ldisc_init(9)tty_ldisc_deinit(9)
π ok that's the whole page bestie, go forth and set those disciplines responsibly π
from the ./drivers/tty directory, dated October 2026, this has been tty_set_ldisc(9) β mwah, ily, bye π
β¨
π¦ 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