ralf.habacker at freenet.de
Sat Apr 15 18:13:45 BST 2006
Thiago Macieira schrieb:
> Ralf Habacker wrote:
>>> 9. on unix, it should be able to deal with ptys
>> Can you explain a non unix user for what this is good ?
> A PTY (Pseudo-Teletype) is a special device that terminal programs use in
> Unix. Each process has one Controlling TTY, which is the terminal they
> are associated with.
> Originally, the TTYs were serial ports, when computers were accessed using
> dumb terminals. On Linux, today, the Virtual Terminals are TTYs. Also, we
> have the pseudo ones that, instead of being connected to a device (serial
> port, printer, monitor+keyboard, dumb terminal, etc.), are like pipes: a
> program behind the scenes receives the output and sends the input.
> The easiest way to understand this is the telnet daemon: when a new
> connection is received, it opens a new pty and runs the user's shell in
> there. When the user types (i.e., when the telnet server receives data on
> its network socket), it sends data over the pty to the shell. When the
> shell outputs something, the server receives data on the pty and sends it
> back over the network socket. The shell and terminal programs cannot tell
> apart a pty from a real terminal.
> Think of pty as special pipes. The difference here is that the API to open
> a new PTY (open the master, discover the name of the slave, etc.), set it
> up, fork the child process and set the PTY as its controlling terminal
> varies quite a bit between OSes.
Thanks for this detailled description. As far as I understood, are pipes
already used on unix to communicate between parent and child process for
example to detect child process termination, to receive stdin and to
send stdout/stderr data.
Is this right ?
"Adding pty support requires to add some hooks (probably by defining
virtual class methods in the QProcess implementation), which could be
used in an inherited class for setup and other required stuff."
More information about the kde-core-devel