--- Net2/arch/hp300/dev/ite.c 2018/04/24 18:04:00 1.1 +++ Net2/arch/hp300/dev/ite.c 2018/04/24 18:19:13 1.1.1.2 @@ -37,7 +37,8 @@ * * from: Utah $Hdr: ite.c 1.1 90/07/09$ * - * @(#)ite.c 7.6 (Berkeley) 5/16/91 + * from: @(#)ite.c 7.6 (Berkeley) 5/16/91 + * ite.c,v 1.8 1993/07/12 11:38:13 mycroft Exp */ /* @@ -59,7 +60,6 @@ #include "ioctl.h" #include "tty.h" #include "systm.h" -#include "malloc.h" #include "itevar.h" #include "iteioctl.h" @@ -106,7 +106,7 @@ int iteburst = 64; int nite = NITE; struct tty *kbd_tty = NULL; -struct tty ite_tty[NITE]; +struct tty *ite_tty[NITE]; struct ite_softc ite_softc[NITE]; int itestart(); @@ -127,7 +127,7 @@ iteon(dev, flag) dev_t dev; { int unit = UNIT(dev); - struct tty *tp = &ite_tty[unit]; + struct tty *tp = ite_tty[unit]; struct ite_softc *ip = &ite_softc[unit]; if (unit < 0 || unit >= NITE || (ip->flags&ITE_ALIVE) == 0) @@ -214,11 +214,15 @@ iteopen(dev, mode, devtype, p) #endif { int unit = UNIT(dev); - register struct tty *tp = &ite_tty[unit]; + register struct tty *tp; register struct ite_softc *ip = &ite_softc[unit]; register int error; int first = 0; + if(!ite_tty[unit]) + tp = ite_tty[unit] = ttymalloc(); + else + tp = ite_tty[unit]; if ((tp->t_state&(TS_ISOPEN|TS_XCLUDE)) == (TS_ISOPEN|TS_XCLUDE) && p->p_ucred->cr_uid != 0) return (EBUSY); @@ -256,11 +260,13 @@ iteclose(dev, flag, mode, p) int flag, mode; struct proc *p; { - register struct tty *tp = &ite_tty[UNIT(dev)]; + register struct tty *tp = ite_tty[UNIT(dev)]; (*linesw[tp->t_line].l_close)(tp, flag); ttyclose(tp); iteoff(dev, 0); + ttyfree(tp); + ite_tty[UNIT(dev)] = (struct tty *)NULL; return(0); } @@ -268,7 +274,7 @@ iteread(dev, uio, flag) dev_t dev; struct uio *uio; { - register struct tty *tp = &ite_tty[UNIT(dev)]; + register struct tty *tp = ite_tty[UNIT(dev)]; return ((*linesw[tp->t_line].l_read)(tp, uio, flag)); } @@ -278,7 +284,7 @@ itewrite(dev, uio, flag) struct uio *uio; { int unit = UNIT(dev); - register struct tty *tp = &ite_tty[unit]; + register struct tty *tp = ite_tty[unit]; if ((ite_softc[unit].flags & ITE_ISCONS) && constty && (constty->t_state&(TS_CARR_ON|TS_ISOPEN))==(TS_CARR_ON|TS_ISOPEN)) @@ -290,7 +296,7 @@ iteioctl(dev, cmd, addr, flag) dev_t dev; caddr_t addr; { - register struct tty *tp = &ite_tty[UNIT(dev)]; + register struct tty *tp = ite_tty[UNIT(dev)]; int error; error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, addr, flag); @@ -318,13 +324,9 @@ itestart(tp) if (cc <= tp->t_lowat) { if (tp->t_state & TS_ASLEEP) { tp->t_state &= ~TS_ASLEEP; - wakeup(&tp->t_outq); - } - if (tp->t_wsel) { - selwakeup(tp->t_wsel, tp->t_state & TS_WCOLL); - tp->t_wsel = 0; - tp->t_state &= ~TS_WCOLL; + wakeup(&tp->t_out); } + selwakeup(&tp->t_wsel); } /* * Limit the amount of output we do in one burst @@ -663,7 +665,7 @@ ignore: break; case CTRL('G'): - if (&ite_tty[unit] == kbd_tty) + if (ite_tty[unit] == kbd_tty) kbdbell(); break; @@ -843,7 +845,6 @@ itecnprobe(cp) /* initialize required fields */ cp->cn_dev = makedev(maj, unit); - cp->cn_tp = &ite_tty[unit]; cp->cn_pri = pri; } @@ -856,7 +857,7 @@ itecninit(cp) ip->attrbuf = console_attributes; iteinit(cp->cn_dev); ip->flags |= (ITE_ACTIVE|ITE_ISCONS); - kbd_tty = &ite_tty[unit]; + kbd_tty = ite_tty[unit]; } /*ARGSUSED*/