pty terminal packet mode TIOCPKT

回眸只為那壹抹淺笑 提交于 2019-12-02 05:06:10

问题


If I start a terminal, how do I know what mode it starts in? Who decides that? Can I start my terminal in packet mode i.e. TIOCPKT

I came across this Packet mode link which says: Packet mode is enabled by pushing the pckt module on the master-side. - I do not understand this exactly.


回答1:


The link you refer to is for SCO Unix, which has the STREAMS I/O subsystem. There is a pretty good overview of STREAMS here (its for Solaris, but same concepts apply to other *nixes).

The manual page tells you that you have to push the pckt module onto the stream, which is done with an ioctl() call with the I_PUSH command. The first link above should make this concept clearer, as it describes how STREAMS works.

But alas, Linux does not support STREAMS. To enable packet mode of a pty on linux, you call ioctl() with TIOCPKT as in the first link of yours.

The default when you create a new pty is normal (non packet) mode.



来源:https://stackoverflow.com/questions/7460035/pty-terminal-packet-mode-tiocpkt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!