Don't do anything in comparam() if the line speed and flags are the same.

This commit is contained in:
mycroft 1997-12-16 22:52:37 +00:00
parent feb6e077d4
commit f1170022ce
1 changed files with 12 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: com.c,v 1.128 1997/11/03 08:20:35 mycroft Exp $ */
/* $NetBSD: com.c,v 1.129 1997/12/16 22:52:37 mycroft Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996, 1997
@ -610,6 +610,8 @@ comopen(dev, flag, mode, p)
SET(t.c_cflag, CRTSCTS);
if (ISSET(sc->sc_swflags, TIOCFLAG_MDMBUF))
SET(t.c_cflag, MDMBUF);
/* Make sure comparam() will do something. */
tp->t_ospeed = 0;
(void) comparam(tp, &t);
tp->t_iflag = TTYDEF_IFLAG;
tp->t_oflag = TTYDEF_OFLAG;
@ -996,6 +998,15 @@ comparam(tp, t)
CLR(t->c_cflag, HUPCL);
}
/*
* If there were no changes, don't do anything. This avoids dropping
* input and improves performance when all we did was frob things like
* VMIN and VTIME.
*/
if (tp->t_ospeed == t->c_ospeed &&
tp->t_cflag == t->c_cflag)
return (0);
lcr = ISSET(sc->sc_lcr, LCR_SBREAK) | cflag2lcr(t->c_cflag);
s = splserial();