[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: texinfo-5.9.90 pretest available

From: Gavin Smith
Subject: Re: texinfo-5.9.90 pretest available
Date: Tue, 24 Feb 2015 20:54:46 +0000

On 24 February 2015 at 20:16, Eli Zaretskii <address@hidden> wrote:
> Could you perhaps describe in more detail the job of pseudotty and its
> relation to what Init-inter.inc does?  I'd like to explore a
> possibility of writing a native Windows version of that, but there's a
> lot of stuff there of which I don't have a clear understanding.  E.g.,
> why does pseudotty "read and ignore any data sent to terminal"?  Or
> why does it need to read from file descriptor 3 (is the value
> important?).  Or what is the significance of mknod and mkfifo
> invocations in Init-inter.inc?

Pseudoterminals are an OS feature that allow the computer to pretend
it is talking to itself via a tube. They are used to emulate the
interface to an external I/O device, a terminal, which was a
bidirectional byte stream.

This tube has two ends - the master and the slave. Imagine the slave
end being at the computer end, and the master end at the terminal end.
(I remember it by saying that the computer is the "slave" of the user
at the terminal.)

The pseudotty program creates a pseudoterminal for the use of the
ginfo process. It looks like this:

pseudotty  (master) <------------> (slave) stdin/stdout ginfo

As you can see, the stdout of ginfo goes to pseudotty, and the stdin
of ginfo comes from pseudotty.

Under this arrangement, ginfo will run as normal, oblivious to the
fact that none of its output is being seen by a real human being on
the screen. It will send various escape sequences to move the cursor,
clear to end of line, or output text etc., just as if it was attached
to a real terminal, or a terminal emulator like xterm or the Linux vt.

pseudotty "reads and ignores" bytes sent from ginfo's stdout - in
theory, the test suite could check what is being displayed, but it
would be hard to process this information.

For controlling the ginfo process, input bytes are sent by the test
scripts via the pseudotty process. Here is where the FIFO's come in.
The full picture looks like this:

(test script)
 |\-----FIFO-----> fd 3   pseudotty (master) <---> (slave) stdin/stdout ginfo
 \---------FIFO--< stdout

At first, the pseudotty process will create a pseudoterminal with no
other process having opened the slave end of it. It gets the filename
of this slave device and passes it back to the test script via its
stdout. When ginfo is started, the test script can then feed bytes to
be sent through to ginfo, just as if these bytes were typed at a

reply via email to

[Prev in Thread] Current Thread [Next in Thread]