Change tty code to use clist interface, but with ring buffer implementation.
Also, fix a couple of bugs in tty.c and pccons.c, and some gross kluginess in the hp300 stuff.
This commit is contained in:
parent
7ef782c7d7
commit
3be4221095
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)dca.c 7.12 (Berkeley) 6/27/91
|
||||
* $Id: dca.c,v 1.7 1993/07/07 11:12:26 deraadt Exp $
|
||||
* $Id: dca.c,v 1.8 1993/07/12 11:38:03 mycroft Exp $
|
||||
*/
|
||||
|
||||
#include "dca.h"
|
||||
@ -47,7 +47,6 @@
|
||||
#include "sys/proc.h"
|
||||
#include "sys/conf.h"
|
||||
#include "sys/file.h"
|
||||
#include "sys/malloc.h"
|
||||
#include "sys/uio.h"
|
||||
#include "sys/kernel.h"
|
||||
#include "sys/syslog.h"
|
||||
@ -197,11 +196,9 @@ dcaopen(dev, flag, mode, p)
|
||||
unit = UNIT(dev);
|
||||
if (unit >= NDCA || (dca_active & (1 << unit)) == 0)
|
||||
return (ENXIO);
|
||||
if(!dca_tty[unit]) {
|
||||
MALLOC(tp, struct tty *, sizeof(struct tty), M_TTYS, M_WAITOK);
|
||||
bzero(tp, sizeof(struct tty));
|
||||
dca_tty[unit] = tp;
|
||||
} else
|
||||
if(!dca_tty[unit])
|
||||
tp = dca_tty[unit] = ttymalloc();
|
||||
else
|
||||
tp = dca_tty[unit];
|
||||
tp->t_oproc = dcastart;
|
||||
tp->t_param = dcaparam;
|
||||
@ -227,7 +224,7 @@ dcaopen(dev, flag, mode, p)
|
||||
while ((flag&O_NONBLOCK) == 0 && (tp->t_cflag&CLOCAL) == 0 &&
|
||||
(tp->t_state & TS_CARR_ON) == 0) {
|
||||
tp->t_state |= TS_WOPEN;
|
||||
if (error = ttysleep(tp, (caddr_t)&tp->t_raw, TTIPRI | PCATCH,
|
||||
if (error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI | PCATCH,
|
||||
ttopen, 0))
|
||||
break;
|
||||
}
|
||||
@ -261,7 +258,7 @@ dcaclose(dev, flag, mode, p)
|
||||
(tp->t_state&TS_ISOPEN) == 0)
|
||||
(void) dcamctl(dev, 0, DMSET);
|
||||
ttyclose(tp);
|
||||
FREE(tp, M_TTYS);
|
||||
ttyfree(tp);
|
||||
dca_tty[unit] = (struct tty *)NULL;
|
||||
return (0);
|
||||
}
|
||||
@ -552,22 +549,22 @@ dcastart(tp)
|
||||
s = spltty();
|
||||
if (tp->t_state & (TS_TIMEOUT|TS_TTSTOP))
|
||||
goto out;
|
||||
if (RB_LEN(&tp->t_out) <= tp->t_lowat) {
|
||||
if (tp->t_outq.c_cc <= tp->t_lowat) {
|
||||
if (tp->t_state&TS_ASLEEP) {
|
||||
tp->t_state &= ~TS_ASLEEP;
|
||||
wakeup((caddr_t)&tp->t_out);
|
||||
wakeup((caddr_t)&tp->t_outq);
|
||||
}
|
||||
selwakeup(&tp->t_wsel);
|
||||
}
|
||||
if (RB_LEN(&tp->t_out) == 0)
|
||||
if (tp->t_outq.c_cc == 0)
|
||||
goto out;
|
||||
if (dca->dca_lsr & LSR_TXRDY) {
|
||||
c = rbgetc(&tp->t_out);
|
||||
c = getc(&tp->t_outq);
|
||||
tp->t_state |= TS_BUSY;
|
||||
dca->dca_data = c;
|
||||
if (dca_hasfifo & (1 << unit)) {
|
||||
for (c = 1; c < 16 && RB_LEN(&tp->t_out); ++c)
|
||||
dca->dca_data = rbgetc(&tp->t_out);
|
||||
for (c = 1; c < 16 && tp->t_outq.c_cc; ++c)
|
||||
dca->dca_data = getc(&tp->t_outq);
|
||||
#ifdef DEBUG
|
||||
if (c > 16)
|
||||
fifoout[0]++;
|
||||
|
@ -38,7 +38,7 @@
|
||||
* from: $Hdr: dcm.c 1.26 91/01/21$
|
||||
*
|
||||
* from: @(#)dcm.c 7.14 (Berkeley) 6/27/91
|
||||
* $Id: dcm.c,v 1.6 1993/07/07 11:12:33 deraadt Exp $
|
||||
* $Id: dcm.c,v 1.7 1993/07/12 11:38:07 mycroft Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -60,7 +60,6 @@
|
||||
#include "sys/conf.h"
|
||||
#include "sys/file.h"
|
||||
#include "sys/uio.h"
|
||||
#include "sys/malloc.h"
|
||||
#include "sys/kernel.h"
|
||||
#include "sys/syslog.h"
|
||||
#include "sys/time.h"
|
||||
@ -353,11 +352,9 @@ dcmopen(dev, flag, mode, p)
|
||||
brd = BOARD(unit);
|
||||
if (unit >= NDCMLINE || (dcm_active & (1 << brd)) == 0)
|
||||
return (ENXIO);
|
||||
if(!dcm_tty[unit]) {
|
||||
MALLOC(tp, struct tty *, sizeof(struct tty), M_TTYS, M_WAITOK);
|
||||
bzero(tp, sizeof(struct tty));
|
||||
dcm_tty[unit] = tp;
|
||||
} else
|
||||
if(!dcm_tty[unit])
|
||||
tp = dcm_tty[unit] = ttymalloc();
|
||||
else
|
||||
tp = dcm_tty[unit];
|
||||
tp->t_oproc = dcmstart;
|
||||
tp->t_param = dcmparam;
|
||||
@ -392,7 +389,7 @@ dcmopen(dev, flag, mode, p)
|
||||
while ((flag&O_NONBLOCK) == 0 && (tp->t_cflag&CLOCAL) == 0 &&
|
||||
(tp->t_state & TS_CARR_ON) == 0) {
|
||||
tp->t_state |= TS_WOPEN;
|
||||
if (error = ttysleep(tp, (caddr_t)&tp->t_raw, TTIPRI | PCATCH,
|
||||
if (error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI | PCATCH,
|
||||
ttopen, 0))
|
||||
break;
|
||||
}
|
||||
@ -429,7 +426,7 @@ dcmclose(dev, flag, mode, p)
|
||||
unit, tp->t_state, tp->t_flags);
|
||||
#endif
|
||||
ttyclose(tp);
|
||||
FREE(tp, M_TTYS);
|
||||
ttyfree(tp);
|
||||
dcm_tty[unit] = (struct tty *)NULL;
|
||||
return (0);
|
||||
}
|
||||
@ -904,18 +901,18 @@ dcmstart(tp)
|
||||
if (dcmdebug & DDB_OUTPUT)
|
||||
printf("dcmstart(%d): state %x flags %x outcc %d\n",
|
||||
UNIT(tp->t_dev), tp->t_state, tp->t_flags,
|
||||
RB_LEN(&tp->t_out));
|
||||
tp->t_outq.c_cc);
|
||||
#endif
|
||||
if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
|
||||
goto out;
|
||||
if (RB_LEN(&tp->t_out) <= tp->t_lowat) {
|
||||
if (tp->t_outq.c_cc <= tp->t_lowat) {
|
||||
if (tp->t_state&TS_ASLEEP) {
|
||||
tp->t_state &= ~TS_ASLEEP;
|
||||
wakeup((caddr_t)&tp->t_out);
|
||||
wakeup((caddr_t)&tp->t_outq);
|
||||
}
|
||||
selwakeup(&tp->t_wsel);
|
||||
}
|
||||
if (RB_LEN(&tp->t_out) == 0) {
|
||||
if (tp->t_outq.c_cc == 0) {
|
||||
#ifdef IOSTATS
|
||||
dsp->xempty++;
|
||||
#endif
|
||||
@ -932,12 +929,7 @@ dcmstart(tp)
|
||||
goto out;
|
||||
fifo = &dcm->dcm_tfifos[3-port][tail];
|
||||
again:
|
||||
#if 0
|
||||
nch = q_to_b(&tp->t_outq, buf, (head - next) & TX_MASK);
|
||||
#else
|
||||
nch = rbunpack(&tp->t_out, buf, nch);
|
||||
#endif
|
||||
|
||||
#ifdef IOSTATS
|
||||
tch += nch;
|
||||
#endif
|
||||
@ -970,7 +962,7 @@ again:
|
||||
* Head changed while we were loading the buffer,
|
||||
* go back and load some more if we can.
|
||||
*/
|
||||
if (RB_LEN(&tp->t_out) && head != (pp->t_head & TX_MASK)) {
|
||||
if (tp->t_outq.c_cc && head != (pp->t_head & TX_MASK)) {
|
||||
#ifdef IOSTATS
|
||||
dsp->xrestarts++;
|
||||
#endif
|
||||
@ -991,8 +983,8 @@ again:
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (dcmdebug & DDB_INTR)
|
||||
printf("dcmstart(%d): head %x tail %x outlen %d\n",
|
||||
UNIT(tp->t_dev), head, tail, RB_LEN(&tp->t_out));
|
||||
printf("dcmstart(%d): head %x tail %x outqcc %d\n",
|
||||
UNIT(tp->t_dev), head, tail, tp->t_outq.c_cc);
|
||||
#endif
|
||||
out:
|
||||
#ifdef IOSTATS
|
||||
|
@ -38,7 +38,7 @@
|
||||
* from: Utah $Hdr: hil.c 1.33 89/12/22$
|
||||
*
|
||||
* from: @(#)hil.c 7.8.1.1 (Berkeley) 6/28/91
|
||||
$Id: hil.c,v 1.4 1993/07/07 07:07:20 cgd Exp $
|
||||
$Id: hil.c,v 1.5 1993/07/12 11:38:11 mycroft Exp $
|
||||
*/
|
||||
|
||||
#include "sys/param.h"
|
||||
@ -170,14 +170,7 @@ hilopen(dev, flags, mode, p)
|
||||
* It is safe to flush the read buffer as we are guarenteed
|
||||
* that no one else is using it.
|
||||
*/
|
||||
/* ndflush(&dptr->hd_queue, RB_LEN(&dptr->hd_queue)); XXX - cgd */
|
||||
{ /* XXX - NO FUCKING WAY TO TOSS A CERTAIN NUMBER OF CHARACTERS!!! */
|
||||
rbchar *foo;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < RB_LEN(&dptr->hd_queue); i++)
|
||||
nextc(&dptr->hd_queue, &foo);
|
||||
}
|
||||
ndflush(&dptr->hd_queue, dptr->hd_queue.c_cc);
|
||||
|
||||
send_hil_cmd(hilp->hl_addr, HIL_INTON, NULL, 0, NULL);
|
||||
/*
|
||||
@ -241,15 +234,7 @@ hilclose(dev, flags)
|
||||
* Always flush the read buffer
|
||||
*/
|
||||
dptr->hd_flags &= ~(HIL_QUEUEIN|HIL_READIN|HIL_NOBLOCK);
|
||||
/* ndflush(&dptr->hd_queue, RB_LEN(&dptr->hd_queue)); XXX - cgd */
|
||||
{ /* XXX - NO FUCKING WAY TO TOSS A CERTAIN NUMBER OF CHARACTERS!!! */
|
||||
rbchar *foo;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < RB_LEN(&dptr->hd_queue); i++)
|
||||
nextc(&dptr->hd_queue, &foo);
|
||||
}
|
||||
|
||||
ndflush(&dptr->hd_queue, dptr->hd_queue.c_cc);
|
||||
/*
|
||||
* Set keyboard back to cooked mode when closed.
|
||||
*/
|
||||
@ -313,7 +298,7 @@ hilread(dev, uio)
|
||||
return(ENODEV);
|
||||
|
||||
(void) splhil();
|
||||
while (RB_LEN(&dptr->hd_queue) == 0) {
|
||||
while (dptr->hd_queue.c_cc == 0) {
|
||||
if (dptr->hd_flags & HIL_NOBLOCK) {
|
||||
spl0();
|
||||
return(EWOULDBLOCK);
|
||||
@ -684,7 +669,7 @@ hilselect(dev, rw, p)
|
||||
dptr = &hilp->hl_device[device];
|
||||
if (dptr->hd_flags & HIL_READIN) {
|
||||
s = splhil();
|
||||
if (RB_LEN(&dptr->hd_queue)) {
|
||||
if (dptr->hd_queue.c_cc) {
|
||||
splx(s);
|
||||
return (1);
|
||||
}
|
||||
@ -956,14 +941,10 @@ hpuxhilevent(hilp, dptr)
|
||||
* room in the buffer for it, and if not, toss the packet.
|
||||
*/
|
||||
len = hilp->hl_pollbp - hilp->hl_pollbuf;
|
||||
if (RB_LEN(&dptr->hd_queue) <= (HILMAXCLIST - (len+5))) {
|
||||
if (dptr->hd_queue.c_cc <= (HILMAXCLIST - (len+5))) {
|
||||
putc(len+5, &dptr->hd_queue);
|
||||
rb_cwrite(&dptr->hd_queue, (char *)&tstamp, sizeof tstamp);
|
||||
rb_cwrite(&dptr->hd_queue, (char *)&hilp->hl_pollbuf, len);
|
||||
/* XXX (void) b_to_q((char *)&tstamp, sizeof tstamp, &dptr->hd_queue);
|
||||
(void) b_to_q((char *)&tstamp, sizeof tstamp, &dptr->hd_queue);
|
||||
(void) b_to_q((char *)hilp->hl_pollbuf, len, &dptr->hd_queue);
|
||||
XXX if replacement code checked return values, we'd be fucked;
|
||||
return values aren't the same... - cgd */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -38,7 +38,7 @@
|
||||
* from: Utah $Hdr: ite.c 1.1 90/07/09$
|
||||
*
|
||||
* from: @(#)ite.c 7.6 (Berkeley) 5/16/91
|
||||
* $Id: ite.c,v 1.7 1993/07/07 11:12:37 deraadt Exp $
|
||||
* $Id: ite.c,v 1.8 1993/07/12 11:38:13 mycroft Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -60,7 +60,6 @@
|
||||
#include "ioctl.h"
|
||||
#include "tty.h"
|
||||
#include "systm.h"
|
||||
#include "malloc.h"
|
||||
|
||||
#include "itevar.h"
|
||||
#include "iteioctl.h"
|
||||
@ -220,13 +219,10 @@ iteopen(dev, mode, devtype, p)
|
||||
register int error;
|
||||
int first = 0;
|
||||
|
||||
if(!ite_tty[unit]) {
|
||||
MALLOC(tp, struct tty *, sizeof(struct tty), M_TTYS, M_WAITOK);
|
||||
bzero(tp, sizeof(struct tty));
|
||||
ite_tty[unit] = tp;
|
||||
} else
|
||||
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);
|
||||
@ -269,7 +265,7 @@ iteclose(dev, flag, mode, p)
|
||||
(*linesw[tp->t_line].l_close)(tp, flag);
|
||||
ttyclose(tp);
|
||||
iteoff(dev, 0);
|
||||
FREE(tp, M_TTYS);
|
||||
ttyfree(tp);
|
||||
ite_tty[UNIT(dev)] = (struct tty *)NULL;
|
||||
return(0);
|
||||
}
|
||||
@ -324,7 +320,7 @@ itestart(tp)
|
||||
return;
|
||||
}
|
||||
tp->t_state |= TS_BUSY;
|
||||
cc = RB_LEN(&tp->t_out);
|
||||
cc = tp->t_outq.c_cc;
|
||||
if (cc <= tp->t_lowat) {
|
||||
if (tp->t_state & TS_ASLEEP) {
|
||||
tp->t_state &= ~TS_ASLEEP;
|
||||
@ -343,7 +339,7 @@ itestart(tp)
|
||||
while (--cc >= 0) {
|
||||
register int c;
|
||||
|
||||
c = rbgetc(&tp->t_out);
|
||||
c = getc(&tp->t_outq);
|
||||
/*
|
||||
* iteputchar() may take a long time and we don't want to
|
||||
* block all interrupts for long periods of time. Since
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
|
||||
* $Id: com.c,v 1.10 1993/07/07 11:00:59 deraadt Exp $
|
||||
* $Id: com.c,v 1.11 1993/07/12 11:37:16 mycroft Exp $
|
||||
*/
|
||||
|
||||
#include "com.h"
|
||||
@ -47,7 +47,6 @@
|
||||
#include "tty.h"
|
||||
#include "proc.h"
|
||||
#include "user.h"
|
||||
#include "malloc.h"
|
||||
#include "conf.h"
|
||||
#include "file.h"
|
||||
#include "uio.h"
|
||||
@ -191,9 +190,7 @@ comopen(dev_t dev, int flag, int mode, struct proc *p)
|
||||
if (unit >= NCOM || (com_active & (1 << unit)) == 0)
|
||||
return (ENXIO);
|
||||
if(!com_tty[unit]) {
|
||||
MALLOC(tp, struct tty *, sizeof(struct tty), M_TTYS, M_WAITOK);
|
||||
bzero(tp, sizeof(struct tty));
|
||||
com_tty[minor(dev)] = tp;
|
||||
tp = com_tty[unit] = ttymalloc();
|
||||
} else
|
||||
tp = com_tty[unit];
|
||||
tp->t_oproc = comstart;
|
||||
@ -220,7 +217,7 @@ comopen(dev_t dev, int flag, int mode, struct proc *p)
|
||||
while ((flag&O_NONBLOCK) == 0 && (tp->t_cflag&CLOCAL) == 0 &&
|
||||
(tp->t_state & TS_CARR_ON) == 0) {
|
||||
tp->t_state |= TS_WOPEN;
|
||||
if (error = ttysleep(tp, (caddr_t)&tp->t_raw, TTIPRI | PCATCH,
|
||||
if (error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI | PCATCH,
|
||||
ttopen, 0))
|
||||
break;
|
||||
}
|
||||
@ -254,7 +251,7 @@ comclose(dev, flag, mode, p)
|
||||
(tp->t_state&TS_ISOPEN) == 0)
|
||||
(void) commctl(dev, 0, DMSET);
|
||||
ttyclose(tp);
|
||||
FREE(tp, M_TTYS);
|
||||
ttyfree(tp);
|
||||
com_tty[unit] = (struct tty *)NULL;
|
||||
return(0);
|
||||
}
|
||||
@ -531,22 +528,22 @@ comstart(tp)
|
||||
s = spltty();
|
||||
if (tp->t_state & (TS_TIMEOUT|TS_TTSTOP))
|
||||
goto out;
|
||||
if (RB_LEN(&tp->t_out) <= tp->t_lowat) {
|
||||
if (tp->t_outq.c_cc <= tp->t_lowat) {
|
||||
if (tp->t_state&TS_ASLEEP) {
|
||||
tp->t_state &= ~TS_ASLEEP;
|
||||
wakeup((caddr_t)&tp->t_out);
|
||||
wakeup((caddr_t)&tp->t_outq);
|
||||
}
|
||||
selwakeup(&tp->t_wsel);
|
||||
}
|
||||
if (RB_LEN(&tp->t_out) == 0)
|
||||
if (tp->t_outq.c_cc == 0)
|
||||
goto out;
|
||||
if (inb(com+com_lsr) & LSR_TXRDY) {
|
||||
c = rbgetc(&tp->t_out);
|
||||
c = getc(&tp->t_outq);
|
||||
tp->t_state |= TS_BUSY;
|
||||
outb(com+com_data, c);
|
||||
if (com_hasfifo & (1 << unit))
|
||||
for (c = 1; c < 16 && RB_LEN(&tp->t_out); ++c)
|
||||
outb(com+com_data, rbgetc(&tp->t_out));
|
||||
for (c = 1; c < 16 && tp->t_outq.c_cc; ++c)
|
||||
outb(com+com_data, getc(&tp->t_outq));
|
||||
}
|
||||
out:
|
||||
splx(s);
|
||||
@ -741,7 +738,7 @@ comselect(dev, rw, p)
|
||||
break;
|
||||
|
||||
case FWRITE:
|
||||
if (RB_LEN(&tp->t_out) <= tp->t_lowat)
|
||||
if (tp->t_outq.c_cc <= tp->t_lowat)
|
||||
goto win;
|
||||
selrecord(p, &tp->t_wsel);
|
||||
break;
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)pccons.c 5.11 (Berkeley) 5/21/91
|
||||
* $Id: pccons.c,v 1.27 1993/07/11 09:53:44 mycroft Exp $
|
||||
* $Id: pccons.c,v 1.28 1993/07/12 11:37:17 mycroft Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -47,7 +47,6 @@
|
||||
#include "user.h"
|
||||
#include "select.h"
|
||||
#include "tty.h"
|
||||
#include "malloc.h"
|
||||
#include "uio.h"
|
||||
#include "i386/isa/isa_device.h"
|
||||
#include "callout.h"
|
||||
@ -302,9 +301,7 @@ pcopen(dev, flag, mode, p)
|
||||
if (minor(dev) != 0)
|
||||
return (ENXIO);
|
||||
if(!pc_tty[0]) {
|
||||
MALLOC(tp, struct tty *, sizeof(struct tty), M_TTYS, M_WAITOK);
|
||||
bzero(tp, sizeof(struct tty));
|
||||
pc_tty[0] = tp;
|
||||
tp = pc_tty[0] = ttymalloc();
|
||||
} else {
|
||||
tp = pc_tty[0];
|
||||
}
|
||||
@ -461,9 +458,9 @@ pcxint(dev)
|
||||
pcstart(tp)
|
||||
register struct tty *tp;
|
||||
{
|
||||
register struct ringb *rbp;
|
||||
register struct clist *rbp;
|
||||
int s, len, n;
|
||||
char buf[PCBURST];
|
||||
u_char buf[PCBURST];
|
||||
|
||||
s = spltty();
|
||||
if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
|
||||
@ -474,17 +471,17 @@ register struct tty *tp;
|
||||
* We need to do this outside spl since it could be fairly
|
||||
* expensive and we don't want our serial ports to overflow.
|
||||
*/
|
||||
rbp = &tp->t_out;
|
||||
len = rb_cread(rbp, buf, PCBURST);
|
||||
rbp = &tp->t_outq;
|
||||
len = q_to_b(rbp, buf, PCBURST);
|
||||
for (n = 0; n < len; n++)
|
||||
if (buf[n]) sputc(buf[n] & 0xff, 0);
|
||||
if (buf[n]) sputc(buf[n], 0);
|
||||
s = spltty();
|
||||
tp->t_state &= ~TS_BUSY;
|
||||
if (RB_LEN(rbp)) {
|
||||
if (rbp->c_cc) {
|
||||
tp->t_state |= TS_TIMEOUT;
|
||||
timeout(ttrstrt, tp, 1);
|
||||
timeout((timeout_t)ttrstrt, (caddr_t)tp, 1);
|
||||
}
|
||||
if (RB_LEN(rbp) <= tp->t_lowat) {
|
||||
if (rbp->c_cc <= tp->t_lowat) {
|
||||
if (tp->t_state&TS_ASLEEP) {
|
||||
tp->t_state &= ~TS_ASLEEP;
|
||||
wakeup((caddr_t)rbp);
|
||||
@ -959,7 +956,7 @@ static sputc(c, ka)
|
||||
if (openf) {
|
||||
(void)sgetc(1);
|
||||
if (scroll)
|
||||
sleep(&scroll, PUSER);
|
||||
sleep((caddr_t)&scroll, PUSER);
|
||||
}
|
||||
bcopy(Crtat+vs.ncol, Crtat, vs.ncol*(vs.nrow-1)*CHR);
|
||||
fillw ((at << 8) + ' ', Crtat + vs.ncol*(vs.nrow-1),
|
||||
@ -1474,7 +1471,8 @@ loop:
|
||||
goto loop;
|
||||
lock_down |= SCROLL;
|
||||
scroll ^= 1;
|
||||
if (!scroll) wakeup(&scroll);
|
||||
if (!scroll)
|
||||
wakeup((caddr_t)&scroll);
|
||||
update_led();
|
||||
break;
|
||||
}
|
||||
@ -1577,7 +1575,8 @@ loop:
|
||||
break;
|
||||
lock_down |= SCROLL;
|
||||
scroll ^= 1;
|
||||
if (!scroll) wakeup(&scroll);
|
||||
if (!scroll)
|
||||
wakeup((caddr_t)&scroll);
|
||||
update_led();
|
||||
break;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: files,v 1.15 1993/07/07 06:03:52 cgd Exp $
|
||||
# $Id: files,v 1.16 1993/07/12 11:37:32 mycroft Exp $
|
||||
#
|
||||
ddb/db_access.c optional ddb
|
||||
ddb/db_aout.c optional ddb
|
||||
@ -60,7 +60,7 @@ kern/tty.c standard
|
||||
kern/tty_compat.c standard
|
||||
kern/tty_conf.c standard
|
||||
kern/tty_pty.c optional pty device-driver
|
||||
kern/tty_ring.c standard
|
||||
kern/tty_subr.c standard
|
||||
kern/tty_tb.c optional tb device-driver requires broken
|
||||
kern/tty_tty.c standard
|
||||
kern/uipc_domain.c standard
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: files.oldconf,v 1.15 1993/07/07 06:03:52 cgd Exp $
|
||||
# $Id: files.oldconf,v 1.16 1993/07/12 11:37:32 mycroft Exp $
|
||||
#
|
||||
ddb/db_access.c optional ddb
|
||||
ddb/db_aout.c optional ddb
|
||||
@ -60,7 +60,7 @@ kern/tty.c standard
|
||||
kern/tty_compat.c standard
|
||||
kern/tty_conf.c standard
|
||||
kern/tty_pty.c optional pty device-driver
|
||||
kern/tty_ring.c standard
|
||||
kern/tty_subr.c standard
|
||||
kern/tty_tb.c optional tb device-driver requires broken
|
||||
kern/tty_tty.c standard
|
||||
kern/uipc_domain.c standard
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
|
||||
* $Id: com.c,v 1.10 1993/07/07 11:00:59 deraadt Exp $
|
||||
* $Id: com.c,v 1.11 1993/07/12 11:37:16 mycroft Exp $
|
||||
*/
|
||||
|
||||
#include "com.h"
|
||||
@ -47,7 +47,6 @@
|
||||
#include "tty.h"
|
||||
#include "proc.h"
|
||||
#include "user.h"
|
||||
#include "malloc.h"
|
||||
#include "conf.h"
|
||||
#include "file.h"
|
||||
#include "uio.h"
|
||||
@ -191,9 +190,7 @@ comopen(dev_t dev, int flag, int mode, struct proc *p)
|
||||
if (unit >= NCOM || (com_active & (1 << unit)) == 0)
|
||||
return (ENXIO);
|
||||
if(!com_tty[unit]) {
|
||||
MALLOC(tp, struct tty *, sizeof(struct tty), M_TTYS, M_WAITOK);
|
||||
bzero(tp, sizeof(struct tty));
|
||||
com_tty[minor(dev)] = tp;
|
||||
tp = com_tty[unit] = ttymalloc();
|
||||
} else
|
||||
tp = com_tty[unit];
|
||||
tp->t_oproc = comstart;
|
||||
@ -220,7 +217,7 @@ comopen(dev_t dev, int flag, int mode, struct proc *p)
|
||||
while ((flag&O_NONBLOCK) == 0 && (tp->t_cflag&CLOCAL) == 0 &&
|
||||
(tp->t_state & TS_CARR_ON) == 0) {
|
||||
tp->t_state |= TS_WOPEN;
|
||||
if (error = ttysleep(tp, (caddr_t)&tp->t_raw, TTIPRI | PCATCH,
|
||||
if (error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI | PCATCH,
|
||||
ttopen, 0))
|
||||
break;
|
||||
}
|
||||
@ -254,7 +251,7 @@ comclose(dev, flag, mode, p)
|
||||
(tp->t_state&TS_ISOPEN) == 0)
|
||||
(void) commctl(dev, 0, DMSET);
|
||||
ttyclose(tp);
|
||||
FREE(tp, M_TTYS);
|
||||
ttyfree(tp);
|
||||
com_tty[unit] = (struct tty *)NULL;
|
||||
return(0);
|
||||
}
|
||||
@ -531,22 +528,22 @@ comstart(tp)
|
||||
s = spltty();
|
||||
if (tp->t_state & (TS_TIMEOUT|TS_TTSTOP))
|
||||
goto out;
|
||||
if (RB_LEN(&tp->t_out) <= tp->t_lowat) {
|
||||
if (tp->t_outq.c_cc <= tp->t_lowat) {
|
||||
if (tp->t_state&TS_ASLEEP) {
|
||||
tp->t_state &= ~TS_ASLEEP;
|
||||
wakeup((caddr_t)&tp->t_out);
|
||||
wakeup((caddr_t)&tp->t_outq);
|
||||
}
|
||||
selwakeup(&tp->t_wsel);
|
||||
}
|
||||
if (RB_LEN(&tp->t_out) == 0)
|
||||
if (tp->t_outq.c_cc == 0)
|
||||
goto out;
|
||||
if (inb(com+com_lsr) & LSR_TXRDY) {
|
||||
c = rbgetc(&tp->t_out);
|
||||
c = getc(&tp->t_outq);
|
||||
tp->t_state |= TS_BUSY;
|
||||
outb(com+com_data, c);
|
||||
if (com_hasfifo & (1 << unit))
|
||||
for (c = 1; c < 16 && RB_LEN(&tp->t_out); ++c)
|
||||
outb(com+com_data, rbgetc(&tp->t_out));
|
||||
for (c = 1; c < 16 && tp->t_outq.c_cc; ++c)
|
||||
outb(com+com_data, getc(&tp->t_outq));
|
||||
}
|
||||
out:
|
||||
splx(s);
|
||||
@ -741,7 +738,7 @@ comselect(dev, rw, p)
|
||||
break;
|
||||
|
||||
case FWRITE:
|
||||
if (RB_LEN(&tp->t_out) <= tp->t_lowat)
|
||||
if (tp->t_outq.c_cc <= tp->t_lowat)
|
||||
goto win;
|
||||
selrecord(p, &tp->t_wsel);
|
||||
break;
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
|
||||
* $Id: com.c,v 1.10 1993/07/07 11:00:59 deraadt Exp $
|
||||
* $Id: com.c,v 1.11 1993/07/12 11:37:16 mycroft Exp $
|
||||
*/
|
||||
|
||||
#include "com.h"
|
||||
@ -47,7 +47,6 @@
|
||||
#include "tty.h"
|
||||
#include "proc.h"
|
||||
#include "user.h"
|
||||
#include "malloc.h"
|
||||
#include "conf.h"
|
||||
#include "file.h"
|
||||
#include "uio.h"
|
||||
@ -191,9 +190,7 @@ comopen(dev_t dev, int flag, int mode, struct proc *p)
|
||||
if (unit >= NCOM || (com_active & (1 << unit)) == 0)
|
||||
return (ENXIO);
|
||||
if(!com_tty[unit]) {
|
||||
MALLOC(tp, struct tty *, sizeof(struct tty), M_TTYS, M_WAITOK);
|
||||
bzero(tp, sizeof(struct tty));
|
||||
com_tty[minor(dev)] = tp;
|
||||
tp = com_tty[unit] = ttymalloc();
|
||||
} else
|
||||
tp = com_tty[unit];
|
||||
tp->t_oproc = comstart;
|
||||
@ -220,7 +217,7 @@ comopen(dev_t dev, int flag, int mode, struct proc *p)
|
||||
while ((flag&O_NONBLOCK) == 0 && (tp->t_cflag&CLOCAL) == 0 &&
|
||||
(tp->t_state & TS_CARR_ON) == 0) {
|
||||
tp->t_state |= TS_WOPEN;
|
||||
if (error = ttysleep(tp, (caddr_t)&tp->t_raw, TTIPRI | PCATCH,
|
||||
if (error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI | PCATCH,
|
||||
ttopen, 0))
|
||||
break;
|
||||
}
|
||||
@ -254,7 +251,7 @@ comclose(dev, flag, mode, p)
|
||||
(tp->t_state&TS_ISOPEN) == 0)
|
||||
(void) commctl(dev, 0, DMSET);
|
||||
ttyclose(tp);
|
||||
FREE(tp, M_TTYS);
|
||||
ttyfree(tp);
|
||||
com_tty[unit] = (struct tty *)NULL;
|
||||
return(0);
|
||||
}
|
||||
@ -531,22 +528,22 @@ comstart(tp)
|
||||
s = spltty();
|
||||
if (tp->t_state & (TS_TIMEOUT|TS_TTSTOP))
|
||||
goto out;
|
||||
if (RB_LEN(&tp->t_out) <= tp->t_lowat) {
|
||||
if (tp->t_outq.c_cc <= tp->t_lowat) {
|
||||
if (tp->t_state&TS_ASLEEP) {
|
||||
tp->t_state &= ~TS_ASLEEP;
|
||||
wakeup((caddr_t)&tp->t_out);
|
||||
wakeup((caddr_t)&tp->t_outq);
|
||||
}
|
||||
selwakeup(&tp->t_wsel);
|
||||
}
|
||||
if (RB_LEN(&tp->t_out) == 0)
|
||||
if (tp->t_outq.c_cc == 0)
|
||||
goto out;
|
||||
if (inb(com+com_lsr) & LSR_TXRDY) {
|
||||
c = rbgetc(&tp->t_out);
|
||||
c = getc(&tp->t_outq);
|
||||
tp->t_state |= TS_BUSY;
|
||||
outb(com+com_data, c);
|
||||
if (com_hasfifo & (1 << unit))
|
||||
for (c = 1; c < 16 && RB_LEN(&tp->t_out); ++c)
|
||||
outb(com+com_data, rbgetc(&tp->t_out));
|
||||
for (c = 1; c < 16 && tp->t_outq.c_cc; ++c)
|
||||
outb(com+com_data, getc(&tp->t_outq));
|
||||
}
|
||||
out:
|
||||
splx(s);
|
||||
@ -741,7 +738,7 @@ comselect(dev, rw, p)
|
||||
break;
|
||||
|
||||
case FWRITE:
|
||||
if (RB_LEN(&tp->t_out) <= tp->t_lowat)
|
||||
if (tp->t_outq.c_cc <= tp->t_lowat)
|
||||
goto win;
|
||||
selrecord(p, &tp->t_wsel);
|
||||
break;
|
||||
|
@ -395,7 +395,7 @@ sloutput(ifp, m, dst)
|
||||
}
|
||||
IF_ENQUEUE(ifq, m);
|
||||
sc->sc_if.if_lastchange = time;
|
||||
if (RB_LEN(&sc->sc_ttyp->t_out) == 0)
|
||||
if (sc->sc_ttyp->t_outq.c_cc == 0)
|
||||
slstart(sc->sc_ttyp);
|
||||
splx(s);
|
||||
return (0);
|
||||
@ -427,9 +427,9 @@ slstart(tp)
|
||||
* We are being called in lieu of ttstart and must do what
|
||||
* it would.
|
||||
*/
|
||||
if (RB_LEN(&tp->t_out) != 0) {
|
||||
if (tp->t_outq.c_cc != 0) {
|
||||
(*tp->t_oproc)(tp);
|
||||
if (RB_LEN(&tp->t_out) > SLIP_HIWAT)
|
||||
if (tp->t_outq.c_cc > SLIP_HIWAT)
|
||||
return;
|
||||
}
|
||||
/*
|
||||
@ -442,11 +442,11 @@ slstart(tp)
|
||||
* Do not remove the packet from the IP queue if it
|
||||
* doesn't look like the packet will fit into the
|
||||
* current COM output queue, with a packet full of
|
||||
* escapes this could be as bad as SLMTU*2. The value
|
||||
* of RBSZ in tty.h also has to be upped to be at least
|
||||
* SLMTU*2.
|
||||
* escapes this could be as bad as SLMTU*2. The size
|
||||
* of the ring buffer must be at least SLMTU*2 to
|
||||
* avoid deadlock.
|
||||
*/
|
||||
if (RBSZ - RB_LEN(&tp->t_out) < 2 * SLMTU + 2)
|
||||
if (tp->t_outq.c_cn - tp->t_outq.c_cc < 2 * SLMTU)
|
||||
return;
|
||||
|
||||
/*
|
||||
@ -509,9 +509,9 @@ slstart(tp)
|
||||
* will flush any accumulated garbage. We do this whenever
|
||||
* the line may have been idle for some time.
|
||||
*/
|
||||
if (RB_LEN(&tp->t_out) == 0) {
|
||||
if (tp->t_outq.c_cc == 0) {
|
||||
++sc->sc_bytessent;
|
||||
(void) putc(FRAME_END, &tp->t_out);
|
||||
(void) putc(FRAME_END, &tp->t_outq);
|
||||
}
|
||||
|
||||
while (m) {
|
||||
@ -536,13 +536,12 @@ slstart(tp)
|
||||
out:
|
||||
if (cp > bp) {
|
||||
/*
|
||||
* Put the non-special bytes
|
||||
* Put n characters at once
|
||||
* into the tty output queue.
|
||||
*/
|
||||
sc->sc_bytessent += rb_cwrite(
|
||||
&tp->t_out,
|
||||
(char *) bp,
|
||||
cp - bp);
|
||||
if (b_to_q((u_char *)bp, cp - bp, &tp->t_outq))
|
||||
break;
|
||||
sc->sc_bytessent += cp - bp;
|
||||
}
|
||||
/*
|
||||
* If there are characters left in the mbuf,
|
||||
@ -550,12 +549,12 @@ slstart(tp)
|
||||
* Put it out in a different form.
|
||||
*/
|
||||
if (cp < ep) {
|
||||
if (putc(FRAME_ESCAPE, &tp->t_out))
|
||||
if (putc(FRAME_ESCAPE, &tp->t_outq))
|
||||
break;
|
||||
if (putc(*cp++ == FRAME_ESCAPE ?
|
||||
TRANS_FRAME_ESCAPE : TRANS_FRAME_END,
|
||||
&tp->t_out)) {
|
||||
(void) unputc(&tp->t_out);
|
||||
&tp->t_outq)) {
|
||||
(void) unputc(&tp->t_outq);
|
||||
break;
|
||||
}
|
||||
sc->sc_bytessent += 2;
|
||||
@ -565,7 +564,7 @@ slstart(tp)
|
||||
m = m2;
|
||||
}
|
||||
|
||||
if (putc(FRAME_END, &tp->t_out)) {
|
||||
if (putc(FRAME_END, &tp->t_outq)) {
|
||||
/*
|
||||
* Not enough room. Remove a char to make room
|
||||
* and end the packet normally.
|
||||
@ -573,8 +572,8 @@ slstart(tp)
|
||||
* a day) you probably do not have enough clists
|
||||
* and you should increase "nclist" in param.c.
|
||||
*/
|
||||
(void) unputc(&tp->t_out);
|
||||
(void) putc(FRAME_END, &tp->t_out);
|
||||
(void) unputc(&tp->t_outq);
|
||||
(void) putc(FRAME_END, &tp->t_outq);
|
||||
sc->sc_if.if_collisions++;
|
||||
} else {
|
||||
++sc->sc_bytessent;
|
||||
|
@ -1 +1 @@
|
||||
revision 1.8 intentionally removed
|
||||
revision 1.9 intentionally removed
|
||||
|
Loading…
Reference in New Issue
Block a user