mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: hyc@symas.com
Cc: linux-kernel@vger.kernel.org, <greg@kroah.com>,
	Alan@symas.com, Cox@symas.com, Greg@symas.com, KH@symas.com
Subject: Re: [PATCH] tty: Add EXTPROC support for LINEMODE
Date: Tue, 15 Jun 2010 20:29:24 +0100	[thread overview]
Message-ID: <20100615202924.24446d28@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <E1OObIu-0004K2-3K@lirone.symas.net>

>      bit set, and the data will be the contents of a struct termios.
>      This allows the process on the server side of the pty to know
>      when the state of the terminal has changed, and what the new
>      state is.

First problem - the kernel and user idea of struct termios don't match.


> diff --git a/arch/alpha/include/asm/termbits.h b/arch/alpha/include/asm/termbits.h
> index ad854a4..879dd35 100644
> --- a/arch/alpha/include/asm/termbits.h
> +++ b/arch/alpha/include/asm/termbits.h
> @@ -180,6 +180,7 @@ struct ktermios {
>  #define FLUSHO	0x00800000
>  #define PENDIN	0x20000000
>  #define IEXTEN	0x00000400
> +#define EXTPROC	0x10000000

For Alpha this value should match OSF if possible.


> +			if (cs & TIOCPKT_IOCTL) {
> +				c = sizeof(struct termios);
> +				if (c > nr)
> +					c = nr;
> +				copy_to_user(b, tty->link->termios, c);
> +				nr -= c;
> +				b += c;
> +			}

This is where the wheels come off the bus.

The kernel use struct ktermios which is what tty->link->termios is

The C library presents this via struct termios which is a glibc invention
dependant on the C library and which is converted by libc from struct
termios or struct termios2 depending on your C library

How you fix that given a broken by design historic Unix interface which
pastes arbitary struct termios objects into the data stream is an
interesting question - doubly so when like most Unixen we have also have
extended terminal attributes as well (termiox)

Alan

  reply	other threads:[~2010-06-15 19:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-15 18:56 hyc
2010-06-15 19:29 ` Alan Cox [this message]
2010-06-15 19:54   ` Howard Chu
2010-06-15 20:23     ` Howard Chu
2010-06-16 15:13       ` Derek Fawcus
2010-06-17 20:02     ` Howard Chu
2010-06-17 20:49       ` Alan Cox
2010-06-17 21:23         ` Howard Chu
2010-06-17 23:43           ` Howard Chu
2010-06-16  1:15   ` Chris Adams
2010-06-18 19:45 hyc
2010-06-18 22:20 ` Howard Chu
2010-06-22 15:59 ` Howard Chu
2010-06-22 16:03   ` Greg KH
2010-06-22 17:28   ` Alan Cox

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=20100615202924.24446d28@lxorguk.ukuu.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=Alan@symas.com \
    --cc=Cox@symas.com \
    --cc=Greg@symas.com \
    --cc=KH@symas.com \
    --cc=greg@kroah.com \
    --cc=hyc@symas.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®