pty terminal packet mode TIOCPKT
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.
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.
精彩评论