Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Re: midi player? & more
@ 1996-02-16 15:46 David Mosberger-Tang
  0 siblings, 0 replies; 4+ messages in thread
From: David Mosberger-Tang @ 1996-02-16 15:46 UTC (permalink / raw)


> I first added lines like:
 > 	  otty.c_lflag &= ~(ICANON|ECHO);
 >         + otty.c_cc[VMIN] = 1;   /* be sure it is 1 */
 >         + otty.c_cc[VTIME] = 0;  /* be sure it is 0 */
 > without success.

This one fixes more in util-linux-2.5 as well.  I suspect it shouldn't
be necessary.  It starts to look to me like TCGETA may not return the
correct values.  Looking at linux/include/asm-alpha/termios.h, we find
that trans_to_termio() sets the _VMIN and _VTIME entries *only* if the
ICANON flag is set in c_lflag whereas the x86 version always copies
everything unconditionally.

 > Then I noticed that ioctl() was called with (sometimes) a pointer to a
 > `struct termio' as 3rd argument, while (on Linux/Alpha/BLADE_0.3)
 > the Vxx array indexes differed beetween termio.c_cc[] and termios.c_cc[]
 > ... and in system headers VMIN * & co are overriden to suit the
 > `struct termio' variants only when <termio.h> is included  ... and it's
 > not the case in more.c.

termio and termios are not compatible on Linux/Alpha (in fact, you get
an error message when trying to include both header files).  As long
as one sticks with one or the other, everything will (should) work
fine though.  So the real bug may have been that the old more.c
included termios.h when it should have included termio.h (this is
correct in the version distributed by Red Hat).

BTW: I suspect that the reason for xterm to start up with bad tty
settings to be the same problem: including termios and using termio or
some such.

	--david

^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: midi player? &amp; more
@ 1996-02-16 19:59 Bob Manson
  0 siblings, 0 replies; 4+ messages in thread
From: Bob Manson @ 1996-02-16 19:59 UTC (permalink / raw)


>Then I noticed that ioctl() was called with (sometimes) a pointer to a
>`struct termio' as 3rd argument, while (on Linux/Alpha/BLADE_0.3)
>the Vxx array indexes differed beetween termio.c_cc[] and termios.c_cc[]

The reason for this is that they're different in the kernel. So far it
seems impossible to explain to folks that you can't reliably use both
termio and termios in the same .c file, nor can you pass termio
structs to termios calls and vice versa...No amount of #define fakery
or userlevel code is going to make the problem go away, it needs to be
fixed in the kernel. (Why it was decided to use the same macro names
for both termio and termios is beyond me...and why people mix termio
and termios code is an even greater mystery.)

NB: I may have termio and termios swapped below, because I don't
remember now if the kernel's emulating OSF/1 termio or termios (and
I'm at work so I can't get at my machine.)

The Linux/Alpha kernel currently is emulating the OSF/1 (er, Digital
Unix) termio calls, and also using the standard Linux termios calls.
The values for the VKILL, VERASE, etc. #defines are different in OSF/1
from the traditional Linux termios values.

The standard Linux termio and termios #defines for the common VKILL,
VERASE, etc. defines happen to be the same, so it's possible to
include both termio.h and termios.h in the same file and have
everything work. But, this can't work with the way things currently
are set up in the Linux/Alpha kernel--if you include termio.h, you'll
get the termio #defines. If you then include termios.h, you'll get the
termios #defines, and since they're different from what termio wants,
termio calls will fail.

The fix is to modify the kernel to swap the VKILL, VERASE, etc. array
entries around for the termios calls so they're the same as the OSF/1
termio values. The easiest fix would be to add a new set of ioctl
values for the "fixed" termios calls, so that existing programs would
continue to function while new programs will work "properly".
Otherwise, there will be some existing binaries that will break...

An alternative fix is to intercept the calls in libc and fix things
there, but this fix would be a lot uglier.
							Bob

^ permalink raw reply	[flat|nested] 4+ messages in thread
[parent not found: <Pine.LNX.3.91.960214150019.20706B-100000@redhat.com>]

end of thread, other threads:[~1996-02-16 19:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-02-16 15:46 midi player? &amp; more David Mosberger-Tang
  -- strict thread matches above, loose matches on Subject: below --
1996-02-16 19:59 Bob Manson
     [not found] <Pine.LNX.3.91.960214150019.20706B-100000@redhat.com>
1996-02-16 14:47 ` Fred Roy
1996-02-16 16:14   ` Erik Troan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox