Linux/dev/console device resolution

Source: Internet
Author: User
Tty is the general name of a class of char devices. They have the same features, such as ^ C processing. The driver uses tty_register_driver to register a TTY.

/Dev/console is a virtual tty, Which is mapped to a real TTY. How to map it will be discussed later.

The console has a variety of meanings. Here, it refers to the printk output device. The driver uses register_console to register a console.

There is a big difference between the console and TTY: the console is an output-only device with simple functions and can only be accessed in the kernel. The tty is a char device and can be accessed by users.ProgramAccess.

The actual driver, for example, the serial port, registers two times for a physical device, one is tty, the other is console, and establishes a connection by recording the TTY primary and secondary device numbers in the console structure.

In the kernel, both TTY and console can register multiple. When the console = ttys0 and other parameters are specified on the kernel command line, the actual console used by printk is determined as the output, and the correspondence between the console and tty is determined, when you open/dev/console, It is mapped to the corresponding TTY. In one sentence:/dev/console maps to the TTY corresponding to the default console.

By the way, it is a coincidence that console = ttys0 and/dev/ttys0 contain the same device name.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.