[comp.bugs.4bsd] Can't change line discipline on pty

jonathan@beta.isor.vuw.ac.nz (Jonathan Stone) (06/14/91)

Subject: Can't change line discipline on pty
Index: /sys/kern/tty_pty.c


Description:
	The pty driver refuses to change the line discipline on
	pty terminals to anything other than the standard tty line
	discipline.  Comments in the code claim that this is because
	other line disciplines may over-write the tty queues.  The
	SLIP line discipline respects the tty queues, and in certain
	regrettable circumstances it is  useful to run SLIP through a pty.
	(Please don't ask what they are.)

Repeat-By:
	Run slattach(8) or sliplogin(8) on a pty.

Fix:
	Apply the following patch to a kernel with SLIP configured,
	and rebuild the kernel.  The compile-time test for
	configuration of SLIP should not be necessary, but cannot hurt.
	Other line disciplines (such as dialup IP) may also be
	appropriate for ptys. 
	

*** /sys/kern/tty_pty.c	Sun Jul 29 06:48:41 1990
--- /mnt/old.sys/kern/tty_pty.c	Sat Jun  8 13:43:26 1991
***************
*** 38,44 ****
--- 38,49 ----
  #include "uio.h"
  #include "kernel.h"
  #include "vnode.h"
+ #include "sl.h"
  
+ #if NSL > 0
+ extern int slinput();
+ #endif
+ 
  #if NPTY == 1
  #undef NPTY
  #define	NPTY	32		/* crude XXX */
***************
*** 620,626 ****
  	 * the queues.  We can't tell anything about the discipline
  	 * from here...
  	 */
! 	if (linesw[tp->t_line].l_rint != ttyinput) {
  		(*linesw[tp->t_line].l_close)(tp);
  		tp->t_line = 0;
  		(void)(*linesw[tp->t_line].l_open)(dev, tp, flag);
--- 625,635 ----
  	 * the queues.  We can't tell anything about the discipline
  	 * from here...
  	 */
! 	if (
! #if NSL > 0	    
! 	    linesw[tp->t_line].l_rint != slinput &&
! #endif
! 	    linesw[tp->t_line].l_rint != ttyinput) {
  		(*linesw[tp->t_line].l_close)(tp);
  		tp->t_line = 0;
  		(void)(*linesw[tp->t_line].l_open)(dev, tp, flag);