summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1997-09-03 20:55:28 +0000
committerderaadt <deraadt@openbsd.org>1997-09-03 20:55:28 +0000
commit1c52e6b0faaa94d4ae58f9ff27491e26eefb7af8 (patch)
treeacbe6b94faf6ac0d543448833094b568b240aeda
parentbye bye (diff)
downloadwireguard-openbsd-1c52e6b0faaa94d4ae58f9ff27491e26eefb7af8.tar.xz
wireguard-openbsd-1c52e6b0faaa94d4ae58f9ff27491e26eefb7af8.zip
fix cua/tty locking
-rw-r--r--sys/arch/i386/isa/pccom.c12
-rw-r--r--sys/dev/ic/com.c12
2 files changed, 16 insertions, 8 deletions
diff --git a/sys/arch/i386/isa/pccom.c b/sys/arch/i386/isa/pccom.c
index 07c14f2e873..b09e7790196 100644
--- a/sys/arch/i386/isa/pccom.c
+++ b/sys/arch/i386/isa/pccom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pccom.c,v 1.11 1997/07/07 17:08:04 niklas Exp $ */
+/* $OpenBSD: pccom.c,v 1.12 1997/09/03 20:55:29 deraadt Exp $ */
/* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */
/*-
@@ -838,12 +838,14 @@ comopen(dev, flag, mode, p)
return EBUSY;
}
} else {
- while (!(DEVCUA(dev) && sc->sc_cua) &&
- !ISSET(tp->t_cflag, CLOCAL) &&
- !ISSET(tp->t_state, TS_CARR_ON)) {
+ while (sc->sc_cua ||
+ (!ISSET(tp->t_cflag, CLOCAL) &&
+ !ISSET(tp->t_state, TS_CARR_ON))) {
SET(tp->t_state, TS_WOPEN);
error = ttysleep(tp, &tp->t_rawq, TTIPRI | PCATCH,
ttopen, 0);
+ if (!DEVCUA(dev) && sc->sc_cua && error == EINTR)
+ continue;
if (error) {
/* XXX should turn off chip if we're the
only waiter */
@@ -853,6 +855,8 @@ comopen(dev, flag, mode, p)
splx(s);
return error;
}
+ if (!DEVCUA(dev) && sc->sc_cua)
+ continue;
}
}
splx(s);
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c
index e8622f90c1b..2a41167100f 100644
--- a/sys/dev/ic/com.c
+++ b/sys/dev/ic/com.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: com.c,v 1.35 1997/07/07 16:37:12 niklas Exp $ */
+/* $OpenBSD: com.c,v 1.36 1997/09/03 20:55:28 deraadt Exp $ */
/* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */
/*-
@@ -654,12 +654,14 @@ comopen(dev, flag, mode, p)
return EBUSY;
}
} else {
- while (!(DEVCUA(dev) && sc->sc_cua) &&
- !ISSET(tp->t_cflag, CLOCAL) &&
- !ISSET(tp->t_state, TS_CARR_ON)) {
+ while (sc->sc_cua ||
+ (!ISSET(tp->t_cflag, CLOCAL) &&
+ !ISSET(tp->t_state, TS_CARR_ON))) {
SET(tp->t_state, TS_WOPEN);
error = ttysleep(tp, &tp->t_rawq, TTIPRI | PCATCH,
ttopen, 0);
+ if (!DEVCUA(dev) && sc->sc_cua && error == EINTR)
+ continue;
if (error) {
/* XXX should turn off chip if we're the
only waiter */
@@ -669,6 +671,8 @@ comopen(dev, flag, mode, p)
splx(s);
return error;
}
+ if (!DEVCUA(dev) && sc->sc_cua)
+ continue;
}
}
splx(s);