STRUCT TTY_PORT_OPERATIONS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct tty_port_operations(9) πŸ’…

okay so bestie, welcome to the Kernel API Manual β€” this one's all about struct tty_port_operations, which is literally the operations table for a tty_port. think of it as the vibe check that tells your port how to behave. πŸŽ€


✨ NAME ✨

struct tty_port_operations β€” operations on tty_port. that's it, that's the whole name, no cap. πŸ¦‹


🌸 SYNOPSIS 🌸

struct tty_port_operations {
    bool (*carrier_raised)(struct tty_port *port);
    void (*dtr_rts)(struct tty_port *port, bool active);
    void (*shutdown)(struct tty_port *port);
    int (*activate)(struct tty_port *port, struct tty_struct *tty);
    void (*destruct)(struct tty_port *port);
 };

look at that struct. iconic. five function pointers, every one of them doing its little job. πŸ‘‘


🫢 Members 🫢

  • carrier_raised β€” return true if the carrier is raised on port. like, is the line actually up? yes or no, bestie, don't leave us guessing. πŸ’–
  • dtr_rts β€” raise the DTR line if active is true, otherwise lower DTR. up or down, that's the whole assignment. ⭐
  • shutdown β€” called when the last close completes or a hangup finishes, IFF the port was initialized. > ⚠️ do NOT use this to free resources, fr fr β€” turn off the device only. it's called under the port mutex to serialize against activate and shutdown. yes, it serializes against itself too, that's what the manpage says, don't come for me. πŸ’€
  • activate β€” called under the port mutex from tty_port_open, serialized using the port mutex. supposed to turn on the device. like flipping the light switch but with more locking. πŸ”₯
  • destruct β€” called on the final put of a port. free resources, possibly incl. the port itself. yes, it can take the port down with it. main character energy honestly. 🌈

🧚 Description 🧚

FIXME: long term getting the tty argument *out* of this would be good for consoles.

that's the whole description. it's literally a FIXME and honestly? respect for the honesty. future-someone's problem, iykyk. πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

  • Kernel file ./include/linux/tty_port.h
  • struct tty_port(9)

and that's the page!! go forth and implement your port operations, bestie, you're gonna slay πŸ’œ

β€” with love from ./include/linux, October 2026, on behalf of struct tty_port_operations(9) πŸ“βœ¨

πŸ“¦ where this page comes from