TTY子系统
为什么是TTY
因为
There are dark areas of the kernel where only the bravest hackers dare to tread. Places where the code is twisted, the requirements are complex, and everything depends on ancient code which has seen little change over the years because even the most qualified developers fear the consequences. Arguably, no part of the kernel is darker and scarier than the serial terminal (TTY) code.
– Jonathan Corbet1, July, 2009
oh, wonderful! Alan2, you are a true wizard ? The tty layer is one of the very few pieces of kernel code that scares the hell out of me ?
– Ingo Molnar3, July, 2007
青铜时代
从上图可以看到,内核的tty子系统由tty核心,tty线路规程和tty驱动组成。我们不妨从tty驱动开始说起。
TTY 驱动程序
TTY驱动程序由tty_driver
结构所表示。
应使用tty_alloc_driver()
来分配该结构。
使用tty_set_operations()
设定驱动的操作函数。
然后,使用