ttS*是面向设备
ttyn是面向进程
shell与终端的关系:shell把一些信息适当的输送到终端设备,同时还接收来自终端设备的输入。一般每个shell进程都会有一个终端关联,也可以没有。
文件都有设备号属性(主设备号和从设备号)
字符设备的特性是FIFO,是一个队列,没有缓冲区,典型的是键盘和屏幕,在用户空间对应的是(stdin,stdout,stderror,对应glibc的FILE结构体),对应的设备文件是tty或者tps/n,stdio中的读写函数(printf,scanf),使用的便是上面三个结构体打开的文件,所谓的读写缓冲区就是stdio和stdout FILE结构体对应的缓冲区,stderror没有缓冲区,因此可以直接输出。
上面的说法有些问题,因为pts和ptmx并不代表实际的设备
when open a terminal(like gome-terminal),the input and output is running on it,and it pass user's input to the shell or its son process(by fork),it's easy to be confused by the realinput and stdin
http://blog.csdn.net/lzhsdly/article/details/7218918
伪终端模仿早先时候的通信方式,主设备和从设备,主设备对应早些时候的主机,从设备对应终端。目的是为了实现进程的通信。