tty_port_close_start(9)
π tty_port_close_start(9) π
okay bestie, so this is a page from the Kernel API Manual and it's basically the part one of a two-part glow-up for closing a tty port. the way that kernel drivers need a whole two-step routine for "goodbye"... iconic honestly π
πΈ NAME πΈ
tty_port_close_start β the helper for tty->ops->close, part 1/2 β¨ (yes, there's a part two, we'll get there)
π¦ SYNOPSIS π¦
int tty_port_close_start (struct tty_port *port , struct tty_struct *tty
, struct file *filp );
π ARGUMENTS π
portβ thetty_portof the device, aka the whole vibe of the port itself πttyβ thettythat's being closed, the main character of this moment πfilpβ the file pointer that got passed on through, no cap
β¨ DESCRIPTION β¨
okay so here's the tea: this function decrements and checks the open count. lowkey the bouncer at the door checking how many people are still inside π«Ά
and if this happens to be the last close? it flushes the port. which means β and this is the important part, bestie β it drops the data from the output buffer on the device and waits for the sending logic to finish. literally "no more messages in the group chat, let everyone finish typing first" energy π
the rest of the close handling? that's not here. that's tty_port_close_end's job. part 2. the sequel. we love a franchise π₯
Locking note, do not skip this one: the caller holds the tty lock. not optional, not vibes-based, the caller already has it before calling. π
π RETURN π
1β this is the last close π (everyone's gone, turn off the lights)0β nope, not the last close, other openers are still here π
π SEE ALSO π
kernel file ./drivers/tty/tty_port.c, plus 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_block_til_ready(9)tty_port_close_end(9)tty_port_close(9)tty_port_install(9)tty_port_open(9)
and that's the whole page babes π go read tty_port_close_end(9) next, she's the other half of this story.
source/location: ./drivers/tty β dated October 2026 β mwah, love u, 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