From: Greg KH on
On Tue, Jun 15, 2010 at 11:08:16AM -0700, Howard Chu wrote:
> Paraphrased from the 1989 BSD patch by David Borman @ cray.com:

<snip>

This is the stuff you need in the 1/2 patch, otherwise it will be lost.

Does the build break if you don't apply the second patch? Or is that
just needed to hook everything up for all of the arches? We can't break
things inbetween each patch.

Care to resend?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Howard Chu on
Greg KH wrote:
> On Tue, Jun 15, 2010 at 11:08:16AM -0700, Howard Chu wrote:
>> Paraphrased from the 1989 BSD patch by David Borman @ cray.com:
>
> <snip>
>
> This is the stuff you need in the 1/2 patch, otherwise it will be lost.
>
> Does the build break if you don't apply the second patch? Or is that
> just needed to hook everything up for all of the arches? We can't break
> things inbetween each patch.
>
> Care to resend?

Yeah, since it's not ifdef'd I imagine it will break all of the other arches
if applied separately.

And it looks like my mail client butchered the patches so I was going to have
to resend anyway. Coming up...
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Alan Cox on
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Howard Chu on
Alan Cox wrote:
>> 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.

OK, since you mention it again down below I'll respond to this last.

>> 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.

I'm grubbing around looking for a live Alpha system now, doesn't seem likely
that I'll find one. Not sure what needs to match here, it's also unlikely that
OSF/1 (or any other SVR4 platform) ever provided a definition for this bit.
Looking at the telnet README:
>>>>
This is a distribution of both client and server telnet. These programs
have been compiled on:
telnet telnetd
BSD 4.4 x x
BSD 4.3 Reno X X
UNICOS 8.0 X X
UNICOS 7.C X X
UNICOS 7.0 X X
UNICOS 6.1 X X
BSDI 1.0 X X
Solaris 2.2 x x (no linemode in server)
Solaris 2.3 x x (no linemode in server)
SunOs 4.1.3 X X (no linemode in server)
Ultrix 4.3 X X (no linemode in server)
DYNIX V3.0.17.9 X X (no linemode in server)
HP-UX 8.0 x x (no linemode in server)
<<<<

I doubt that anyone ever ported this feature over to those OSes.
>
>
>> + 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)

Are you suggesting that this is completely unfixable/unworkable? Would it be
sufficient to use kernel_termios_to_user_termios() ?

--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Howard Chu on
Howard Chu wrote:
>>> 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.
>
> I'm grubbing around looking for a live Alpha system now, doesn't seem likely
> that I'll find one. Not sure what needs to match here, it's also unlikely that
> OSF/1 (or any other SVR4 platform) ever provided a definition for this bit.
> Looking at the telnet README:
> >>>>
> This is a distribution of both client and server telnet. These programs
> have been compiled on:
> telnet telnetd
> BSD 4.4 x x
> BSD 4.3 Reno X X
> UNICOS 8.0 X X
> UNICOS 7.C X X
> UNICOS 7.0 X X
> UNICOS 6.1 X X
> BSDI 1.0 X X
> Solaris 2.2 x x (no linemode in server)
> Solaris 2.3 x x (no linemode in server)
> SunOs 4.1.3 X X (no linemode in server)
> Ultrix 4.3 X X (no linemode in server)
> DYNIX V3.0.17.9 X X (no linemode in server)
> HP-UX 8.0 x x (no linemode in server)
> <<<<
>
> I doubt that anyone ever ported this feature over to those OSes.

Closest thing I've found so far is for HPUX 11i Version 2:
http://docs.hp.com/en/B2355-90848docs/B2355-90848docs.pdf

>>>>
TIOCREMOTE This ioctl puts the STREAMS pty in and out of Remote Mode. When
Remote Mode is on, input data will be flow-controlled and passed
through ldterm without any input processing regardless of the
terminal mode. When the pty master driver receives this ioctl,
it will send an M_CTL message downstream to ldterm via ptm, pts,
and ptem. The command in the M_CTL message is set to MC_NO_CANON
or MC_DO_CANON depending whether to turn on or off the Remote
Mode. The format of this ioctl is:
int ioctl(master_fd, TIOCREMOTE, argument)
where the argument is set to 1 to turn on Remote Mode and 0 to
turn it off. Remote Mode is normally used when doing remote line
editing in a window manager, or whenever flow-controlled input is
required. Each write to the master device produces a record
boundary for the process reading the slave devices. In normal
usage, a write of data is like the data typed as a line on the
terminal; a write of 0 (zero) bytes is like typing an EOF
(End-of-File) character.

TIOCSIGNAL This ioctl allows the master process to send a signal to the slave
process. The format of this ioctl is:


int ioctl(master_fd, TIOCSIGNAL, argument)
where the argument is the signal number as defined in the header
file <sys/signal.h>. For example the master process can send an
SIGINT signal to the slave process by doing:
ioctl(master_fd, TIOCSIGNAL, SIGINT)
<<<<

TIOCREMOTE seems to be the SVR4 analogue to TIOCPKT without any of the useful
parts; it doesn't include the prefix byte, so it doesn't provide any state
change information.

--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/