[net.bugs.4bsd] rlogin sessions don't handle ^S/^Q in raw mode?

whm@arizona.UUCP (Bill Mitchell) (01/21/85)

When I rlogin to one of our 4.2bsd Vaxs and do a "stty raw", it seems
that ^S and ^Q don't get picked up on the remote machine.  For example,
something like:

	rlogin xxx
	stty raw
	^S^Q<LF>

just produces a prompt rather than "^S^Q: command not found".

Also, rlogin to a 1.2 SUN from a 4.2 Vax does pass ^S/^Q to the remote (the
SUN), so it seems like a problem with reception rather than transmission
on the Vax.

Is this a bug or a feature?  Does anybody have a fix for this?

					Thanks in advance,
					Bill Mitchell
					whm.arizona@csnet-relay
					{noao,mcnc,utah-cs}!arizona!whm

chris@umcp-cs.UUCP (Chris Torek) (01/21/85)

It's a ``feature'': the PTY driver notifies masters only about changes
in the actual characters used for flow control, and only when they
change to/from ^S/^Q.  (I think this is totally bogus; the master
should get the entire tty state if anything.)

However, you can work around it (sort of) by making every program that
does ``stty raw'' (or equivalent) also set the ^S/^Q characters to -1
(undefined), which will make rlogin do the same.  Beware: whenever you
change the flow control characters, rlogin, in its headlong rush to get
the out-of-band data used for this, flushes every last bit of data that
it hasn't yet printed.  This means that you must (in general) set the
flow characters, then print whatever you're printing.
-- 
(This line accidently left nonblank.)

In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP:	{seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland

ellis@spar.UUCP (Michael Ellis) (01/22/85)

From Bill Mitchell:
>When I rlogin to one of our 4.2bsd Vaxs and do a "stty raw", it seems
>that ^S and ^Q don't get picked up on the remote machine. 

Try `rlogin -8 <hostname>' which uses the raw interface. I don't know
why this feature is undocumented.

-michael

guy@rlgvax.UUCP (Guy Harris) (01/26/85)

> From Bill Mitchell:
> >When I rlogin to one of our 4.2bsd Vaxs and do a "stty raw", it seems
> >that ^S and ^Q don't get picked up on the remote machine. 
> 
> Try `rlogin -8 <hostname>' which uses the raw interface. I don't know
> why this feature is undocumented.

Get the 4.2 manuals from USENIX.  They fix some documentation errors
(such as the "GETGROUPS(2)" manual page), and the "RLOGIN(1C)" manual
page documents "-8".  (They're also in the cute 6x9 format pioneered
(to the best of my knowledge) by System III, and are divided up nicely.)

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy

martillo@mit-athena.ARPA (Joaquim Martillo) (01/28/85)

Using rlogin -8 is not an acceptable solution to this problem.  rlogind
is not reading a TIOCPKT_NOSTOP when stty raw is executed.  If the start
and stop characters are changed to -1 via a system call rlogind does
read a TIOCPK_NOSTOP and then propagates this back across the network.
stty raw should produce the same result.  The change I posted a week ago
takes care of the problem.

Joaquim Martillo

martillo@mit-athena.ARPA (Joaquim Martillo) (01/30/85)

My  previous  fix  to  the  rlogin  problem was incorrect.  The function
ptyioctl in tty_pty.c should be altered.  I will  send  a  copy  of  the
function if requested via private mail.

diff tty_pty.c tty_pty.c~ is:


424,425c424,425
< caddr_t data;
< dev_t dev;
---
> 	caddr_t data;
> 	dev_t dev;
430d429
< 	register int stop;
432,433d430
< /*	printf("Entering ptyioctl\n");*/
< 
436,438c433,434
< 	{
< 		switch (cmd) 
< 		{
---
> 		switch (cmd) {
> 
441d436
< 			{
443d437
< 			}
445d438
< 			{
447d439
< 			}	
448a441
> 
451d443
< 			{
453d444
< 			}
455d445
< 			{
457d446
< 			}
463d451
< 			{
465d452
< 			}
467d453
< 			{
469d454
< 			}
473d457
< /*			printf("TIOCSETP cmd is %d\n", cmd);*/
475d458
< 			{
477d459
< 			}
480,481d461
< 	}
< /*	printf("Invoking ttioctl\n");*/
484d463
< 	{
486,493c465,468
< 	}	
< 	stop = !(tp->t_flags & RAW);
< /*	printf("The variable stop is %d\n", stop);*/
< 
< 	if (pti->pt_flags & PF_NOSTOP) 
< 	{
< 		if (stop) 
< 		{
---
> 	{ int stop = (tp->t_stopc == ('s'&037) &&
> 		      tp->t_startc == ('q'&037));
> 	if (pti->pt_flags & PF_NOSTOP) {
> 		if (stop) {
499,505c474,481
< 	} 
< 	else if (stop == 0) 
< 	{
< 		pti->pt_send &= ~TIOCPKT_DOSTOP;
< 		pti->pt_send |= TIOCPKT_NOSTOP;
< 		pti->pt_flags |= PF_NOSTOP;
< 		ptcwakeup(tp);
---
> 	} else {
> 		if (stop == 0) {
> 			pti->pt_send &= ~TIOCPKT_DOSTOP;
> 			pti->pt_send |= TIOCPKT_NOSTOP;
> 			pti->pt_flags |= PF_NOSTOP;
> 			ptcwakeup(tp);
> 		}
> 	}