tty_port_block_til_ready(9)
π tty_port_block_til_ready (9) β like, the Kernel API Manual, bestie π
okay so we're in the Kernel API Manual today and the main character is tty_port_block_til_ready(9). buckle up, this one's about waiting β and honestly? the waiting is the whole personality. π
β¨ NAME β¨
tty_port_block_til_ready β the waiting logic for tty open. literally just "we sit here until the tty is ready" energy. π
πΈ SYNOPSIS πΈ
int tty_port_block_til_ready (struct tty_port *port , struct tty_struct
*tty , struct file *filp );
π¦ ARGUMENTS π¦
portβ the tty port that's being opened rn. main character port, no cap.ttyβ the tty device being bound. it's getting attached to the port, slay.filpβ the file pointer of whoever's opening it, orNULL. yeah,NULLis allowed, don't panic. π
π DESCRIPTION π
so this function implements the core POSIX/SuS tty behaviour for when you're opening a tty device. it handles, and I mean it handles:
- hangup β and that's both before and during. double duty. π
- non blocking open
- rts/dtr/dcd
- signals
- port flags and counts
the port you pass in must implement the port->ops->carrier_raised method if it can do carrier detect, and it must implement the port->ops->dtr_rts method if it supports software management of these lines. like, non-negotiable bestie, that's the vibe check. β
and ngl the important little detail here: the dtr/rts raise gets done each iteration, because a hangup may have previously dropped them while we were waiting. so like, we keep re-raising them the whole time we wait. π₯
caller holds the tty lock. that's the rule. no sneak. π
π NOTE π
this one's lowkey spicy: it may drop and reacquire the tty lock when blocking. which means tty and port may have changed state while you weren't looking β eg., they may have been hung up. π so don't be out here assuming nothing moved, bestie, because things absolutely moved.
π«Ά SEE ALSO π«Ά
Kernel file ./drivers/tty/tty_port.c and honestly the whole friend group:
tty_port_init(9)tty_port_link_wq(9)tty_port_link_device(9)tty_port_register_device(9)tty_port_register_device_attr(9)tty_port_register_device_attr_serdev(9)tty_port_unregister_device(9)tty_port_destroy(9)tty_port_put(9)tty_port_tty_get(9)tty_port_tty_set(9)tty_port_shutdown(9)tty_port_hangup(9)tty_port_tty_hangup(9)tty_port_tty_vhangup(9)tty_port_tty_wakeup(9)tty_port_carrier_raised(9)tty_port_raise_dtr_rts(9)tty_port_lower_dtr_rts(9)tty_port_close_start(9)tty_port_close_end(9)tty_port_close(9)tty_port_install(9)tty_port_open(9)
and that's the whole page, bestie π this came at you from ./drivers/tty, dated October 2026, and it's signed tty_port_block_til_ready(9) β periodt. ππ¦β¨
π¦ 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