KProcess overhaul

Thiago Macieira thiago at kde.org
Sat Apr 15 16:32:16 BST 2006


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.

-- 
Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
  thiago.macieira (AT) trolltech.com     Trolltech AS
    GPG: 0x6EF45358                   |  Sandakerveien 116,
    E067 918B B660 DBD1 105C          |  NO-0402
    966C 33F5 F005 6EF4 5358          |  Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060415/fd1528f4/attachment.sig>


More information about the kde-core-devel mailing list