All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@eu.citrix.com>
To: John Levon <levon@movementarian.org>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH] Fix xenconsole's "Could not read tty from store"
Date: Tue, 18 Dec 2007 18:47:50 +0000	[thread overview]
Message-ID: <20071218184750.GT4244@implementation.uk.xensource.com> (raw)
In-Reply-To: <20071218182454.GC20581@totally.trollied.org.uk>

John Levon, le Tue 18 Dec 2007 18:24:54 +0000, a écrit :
> On Tue, Dec 18, 2007 at 06:18:16PM +0000, Samuel Thibault wrote:
> > > > > > +	if (tcgetattr(master, &term) < 0) {
> > > > > > +		err = errno;
> > > > > 
> > > > > Please use the slave not the master. It doesn't matter on Linux but it's
> > > > > critical on Solaris.
> > > > 
> > > > What is the Solaris reason for this?  It really looks we can't afford
> > > > closing the slave end on Linux (hence leak it) or not open it at all
> > > > (and then we can't tcgetattr on it).
> > > 
> > > On Linux, both ends of a pty act like a pseudo-terminal and you can do
> > > term-like things on both ends (and there's apparently small variations
> > > in the effect they have). This is not true on STREAMS-based systems. In
> > > particular, you have to push the "ptem" module before you can use any of
> > > the tcget/setattr() functions (look at openpty()).
> > 
> > I'm precisely reading that part of the sun manual thanks to google, yes
> > :)
> > 
> > Can't we push those modules on such systems?
> 
> I do - on the slave. It's nonsensical to push it onto the master, I
> think. In fact it's dubious doing this tcsetattr() /at all/ - I would
> have thought that xenconsole is the right place to be doing that.

Then I guess it's the proper way to go.

> > > I'm working on a new version of the patch that just keeps the slave open
> > > (without leaking it) on both platforms - I think this should cover these
> > > differences sufficiently.
> > 
> > Well, there should be no reason to open the slave part at all, actually.
> 
> openpty() always gives us a slave fd so it's already open.

Right, but we can avoid using openpty(), but posix_openpt() or
open("/dev/ptmx"). On linux that works fine.

> There's no way on Linux to not busy-loop without keeping a slave fd
> open, since you set non-blocking on the master fd.

If the slave fd is not opened at all as suggested above, there should be
no loop.

> > To my understanding, from the server side tcsetattr should only be
> > performed on the master side (with effect on the slave side too).
> 
> See above, I don't quite follow why it's necessary at all.

That was my understanding of how pseudo terminals are supposed to work,
i.e. the master part is only for the server and the slave part is only
for client, but who is responsible for calling tcsetattr() is another
story, and as said above the best could be to let the client do it.

Samuel

  reply	other threads:[~2007-12-18 18:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-17 11:22 [PATCH] Fix xenconsole's "Could not read tty from store" Samuel Thibault
2007-12-17 16:42 ` John Levon
2007-12-17 16:54   ` Samuel Thibault
2007-12-18  1:41     ` John Levon
2007-12-18 11:57       ` Samuel Thibault
2007-12-18 13:35       ` John Levon
2007-12-18 17:43         ` Samuel Thibault
2007-12-18 17:03       ` Samuel Thibault
2007-12-18 18:01         ` John Levon
2007-12-18 18:07   ` Samuel Thibault
2007-12-18 18:13     ` John Levon
2007-12-18 18:18       ` Samuel Thibault
2007-12-18 18:24         ` John Levon
2007-12-18 18:47           ` Samuel Thibault [this message]
2007-12-18 18:48             ` Samuel Thibault
2007-12-18 18:55             ` John Levon
2007-12-19 11:39               ` Samuel Thibault
2007-12-18 18:52         ` John Levon
2007-12-18 19:00           ` Samuel Thibault
2007-12-18 19:18             ` John Levon
2007-12-19 11:35               ` Samuel Thibault
2007-12-19 11:29           ` Keir Fraser
2007-12-19 11:36             ` Samuel Thibault
2007-12-19 12:00           ` Samuel Thibault
2007-12-19 13:26             ` John Levon
2007-12-18 20:41 ` VT-d and the GPU Philip Kufeldt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071218184750.GT4244@implementation.uk.xensource.com \
    --to=samuel.thibault@eu.citrix.com \
    --cc=levon@movementarian.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.