TTY — The Linux Kernel Documentation

TTY structures¶

There are several major TTY structures. Every TTY device in a system has a corresponding struct tty_port. These devices are maintained by a TTY driver which is struct tty_driver. This structure describes the driver but also contains a reference to operations which could be performed on the TTYs. It is struct tty_operations. Then, upon open, a struct tty_struct is allocated and lives until the final close. During this time, several callbacks from struct tty_operations are invoked by the TTY layer.

Every character received by the kernel (both from devices and users) is passed through a preselected TTY Line Discipline (in short ldisc; in C, struct tty_ldisc_ops). Its task is to transform characters as defined by a particular ldisc or by user too. The default one is n_tty, implementing echoes, signal handling, jobs control, special characters processing, and more. The transformed characters are passed further to user/device, depending on the source.

In-detail description of the named TTY structures is in separate documents:

  • TTY Driver and TTY Operations
    • Allocation
    • Registration
    • TTY Driver Reference
    • TTY Operations Reference
  • TTY Port
    • TTY Port Functions
    • TTY Port Reference
    • TTY Port Operations Reference
  • TTY Struct
    • Initialization
    • Name
    • Reference counting
    • Install
    • Read & Write
    • Start & Stop
    • Wakeup
    • Hangup
    • Misc
    • TTY Struct Flags
    • TTY Struct Reference
  • TTY Line Discipline
    • Registration
    • Other Functions
    • Line Discipline Operations Reference
    • Driver Access
    • TTY Flags
    • Locking
    • Internal Functions
  • TTY Buffer
    • Flip Buffer Management
    • Other Functions
    • Buffer Locking
    • Internal Functions
  • TTY IOCTL Helpers
  • TTY Internals
    • Kopen
    • Exported Internal Functions
    • Internal Functions
  • Console
    • Struct Console
    • Struct Consw
    • Console functions

Tag » What Is Tty In Linux