summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1995-07-22 01:30:45 +0000
committerbde <bde@FreeBSD.org>1995-07-22 01:30:45 +0000
commit688f94b1434ed320dfa1c4a16c80bac5f308daf5 (patch)
treec4afe09d343e52acfa2524ee2edbd4e49000cf11 /sys/kern
parent94cb7648d61aaab09b106f4dfb5fcd1e8c6c3cfc (diff)
downloadFreeBSD-src-688f94b1434ed320dfa1c4a16c80bac5f308daf5.zip
FreeBSD-src-688f94b1434ed320dfa1c4a16c80bac5f308daf5.tar.gz
Move the inline code for waking up writers to a new function
ttwwakeup(). The conditions for doing the wakeup will soon become more complicated and I don't want them duplicated in all drivers. It's probably not worth making ttwwakeup() a macro or an inline function. The cost of the function call is relatively small when there is a process to wake up. There is usually a process to wake up for large writes and the system call overhead dwarfs the function call overhead for small writes.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/tty.c19
-rw-r--r--sys/kern/tty_pty.c10
2 files changed, 20 insertions, 9 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 8efe14b..9802f10 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)tty.c 8.8 (Berkeley) 1/21/94
- * $Id: tty.c,v 1.54 1995/07/21 20:52:38 bde Exp $
+ * $Id: tty.c,v 1.55 1995/07/21 22:51:50 bde Exp $
*/
/*-
@@ -2054,6 +2054,23 @@ ttwakeup(tp)
}
/*
+ * Wake up any writers on a tty.
+ */
+void
+ttwwakeup(tp)
+ register struct tty *tp;
+{
+
+ if (tp->t_outq.c_cc <= tp->t_lowat) {
+ if (tp->t_state & TS_ASLEEP) {
+ tp->t_state &= ~TS_ASLEEP;
+ wakeup(&tp->t_outq);
+ }
+ selwakeup(&tp->t_wsel);
+ }
+}
+
+/*
* Look up a code for a specified speed in a conversion table;
* used by drivers to map software speed values to hardware parameters.
*/
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c
index 0a582fe..35fe857 100644
--- a/sys/kern/tty_pty.c
+++ b/sys/kern/tty_pty.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tty_pty.c 8.2 (Berkeley) 9/23/93
- * $Id: tty_pty.c,v 1.12 1995/07/21 16:30:52 bde Exp $
+ * $Id: tty_pty.c,v 1.13 1995/07/21 20:52:40 bde Exp $
*/
/*
@@ -373,13 +373,7 @@ ptcread(dev, uio, flag)
break;
error = uiomove(buf, cc, uio);
}
- 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_outq);
- }
- selwakeup(&tp->t_wsel);
- }
+ ttwwakeup(tp);
return (error);
}
OpenPOWER on IntegriCloud