summaryrefslogtreecommitdiff
path: root/usr.bin/window/wwiomux.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-26 18:00:42 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-26 18:00:42 +0000
commitb5ac7add8214b5b1d3a3557e63ece819dd1e7c56 (patch)
tree4f840a357fe1ddb27d0a850af958636843ab0179 /usr.bin/window/wwiomux.c
parentbc349e2e6d187585cab3ce4d8d434fc87cced2a0 (diff)
from netbsd:
Use POSIX signals. Always set FNONBLOCK on the tty. Eliminate the use of SIGIO, and some other cleanup. We don't need non-blocking mode without SIGIO.
Diffstat (limited to 'usr.bin/window/wwiomux.c')
-rw-r--r--usr.bin/window/wwiomux.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/usr.bin/window/wwiomux.c b/usr.bin/window/wwiomux.c
index 6155d5a75b6..dd77bda78ca 100644
--- a/usr.bin/window/wwiomux.c
+++ b/usr.bin/window/wwiomux.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wwiomux.c,v 1.3 1995/09/28 10:35:37 tls Exp $ */
+/* $NetBSD: wwiomux.c,v 1.4 1995/12/21 10:46:16 mycroft Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)wwiomux.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$NetBSD: wwiomux.c,v 1.3 1995/09/28 10:35:37 tls Exp $";
+static char rcsid[] = "$NetBSD: wwiomux.c,v 1.4 1995/12/21 10:46:16 mycroft Exp $";
#endif
#endif /* not lint */
@@ -57,11 +57,8 @@ static char rcsid[] = "$NetBSD: wwiomux.c,v 1.3 1995/09/28 10:35:37 tls Exp $";
* The idea is to copy window outputs to the terminal, via the
* display package. We try to give wwcurwin highest priority.
* The only return conditions are when there is keyboard input
- * and when a child process dies, which are serviced by signal
- * catchers (wwrint() and wwchild()).
+ * and when a child process dies.
* When there's nothing to do, we sleep in a select().
- * This can be done better with interrupt driven io. But that's
- * not supported on ptys, yet.
* The history of this routine is interesting.
*/
wwiomux()
@@ -87,12 +84,17 @@ wwiomux()
continue;
if (w->ww_obq < w->ww_obe) {
if (w->ww_pty > n)
- n = w->ww_pty;
+ n = w->ww_pty + 1;
FD_SET(w->ww_pty, &imask);
}
if (w->ww_obq > w->ww_obp && !w->ww_stopped)
noblock = 1;
}
+ if (wwibq < wwibe) {
+ if (0 > n)
+ n = 0 + 1;
+ FD_SET(0, &imask);
+ }
if (!noblock) {
if (wwcurwin != 0)
@@ -106,16 +108,7 @@ wwiomux()
wwclrintr();
return;
}
- /*
- * Defensive code. If somebody else (for example,
- * wall) clears the ASYNC flag on us, we will block
- * forever. So we need a finite timeout and set
- * the flag again. Anything more clever will probably
- * need even more system calls. (This is a bug
- * in the kernel.)
- * I don't like this one bit.
- */
- (void) fcntl(0, F_SETFL, wwnewtty.ww_fflags);
+ /* XXXX */
tv.tv_sec = 30;
tv.tv_usec = 0;
} else {
@@ -131,14 +124,16 @@ wwiomux()
wwnselecte++;
else if (n == 0)
wwnselectz++;
- else
+ else {
+ if (FD_ISSET(0, &imask))
+ wwrint();
for (w = wwhead.ww_forw; w != &wwhead; w = w->ww_forw) {
if (w->ww_pty < 0 ||
!FD_ISSET(w->ww_pty, &imask))
continue;
wwnwread++;
p = w->ww_obq;
- if (w->ww_ispty) {
+ if (w->ww_type == WWT_PTY) {
if (p == w->ww_ob) {
w->ww_obp++;
w->ww_obq++;
@@ -155,7 +150,7 @@ wwiomux()
wwnwreadz++;
(void) close(w->ww_pty);
w->ww_pty = -1;
- } else if (!w->ww_ispty) {
+ } else if (w->ww_type != WWT_PTY) {
wwnwreadd++;
wwnwreadc += n;
w->ww_obq += n;
@@ -176,9 +171,8 @@ wwiomux()
w->ww_ob;
}
}
- if (w->ww_ispty)
- *p = c;
}
+ }
/*
* Try the current window first, if there is output
* then process it and go back to the top to try again.