diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-12-26 18:00:42 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-12-26 18:00:42 +0000 |
commit | b5ac7add8214b5b1d3a3557e63ece819dd1e7c56 (patch) | |
tree | 4f840a357fe1ddb27d0a850af958636843ab0179 | |
parent | bc349e2e6d187585cab3ce4d8d434fc87cced2a0 (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.
-rw-r--r-- | usr.bin/window/Makefile | 3 | ||||
-rw-r--r-- | usr.bin/window/main.c | 15 | ||||
-rw-r--r-- | usr.bin/window/mloop.c | 10 | ||||
-rw-r--r-- | usr.bin/window/win.c | 12 | ||||
-rw-r--r-- | usr.bin/window/ww.h | 10 | ||||
-rw-r--r-- | usr.bin/window/wwenviron.c | 8 | ||||
-rw-r--r-- | usr.bin/window/wwflush.c | 15 | ||||
-rw-r--r-- | usr.bin/window/wwinit.c | 29 | ||||
-rw-r--r-- | usr.bin/window/wwiomux.c | 38 | ||||
-rw-r--r-- | usr.bin/window/wwopen.c | 19 | ||||
-rw-r--r-- | usr.bin/window/wwrint.c | 16 | ||||
-rw-r--r-- | usr.bin/window/wwsize.c | 6 | ||||
-rw-r--r-- | usr.bin/window/wwspawn.c | 15 | ||||
-rw-r--r-- | usr.bin/window/wwtty.c | 8 |
14 files changed, 104 insertions, 100 deletions
diff --git a/usr.bin/window/Makefile b/usr.bin/window/Makefile index aed25c5d122..f86f4180f05 100644 --- a/usr.bin/window/Makefile +++ b/usr.bin/window/Makefile @@ -1,8 +1,7 @@ -# $NetBSD: Makefile,v 1.5 1995/09/28 10:33:55 tls Exp $ +# $NetBSD: Makefile,v 1.6 1995/12/21 05:24:49 mycroft Exp $ # @(#)Makefile 8.1 (Berkeley) 6/6/93 PROG= window -CFLAGS+= -DVMIN_BUG SRCS= char.c cmd.c cmd1.c cmd2.c cmd3.c cmd4.c cmd5.c cmd6.c cmd7.c \ context.c error.c lcmd.c lcmd1.c lcmd2.c main.c mloop.c parser1.c \ parser2.c parser3.c parser4.c parser5.c scanner.c startup.c string.c \ diff --git a/usr.bin/window/main.c b/usr.bin/window/main.c index fba9936dfb8..e1421e16d68 100644 --- a/usr.bin/window/main.c +++ b/usr.bin/window/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.4 1995/09/28 10:34:27 tls Exp $ */ +/* $NetBSD: main.c,v 1.5 1995/12/21 10:45:28 mycroft Exp $ */ /* * Copyright (c) 1983, 1993 @@ -46,7 +46,7 @@ char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$NetBSD: main.c,v 1.4 1995/09/28 10:34:27 tls Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.5 1995/12/21 10:45:28 mycroft Exp $"; #endif #endif /* not lint */ @@ -155,8 +155,8 @@ char **argv; if (debug || xflag) (void) wwsettty(0, &wwnewtty); - if ((cmdwin = wwopen(wwbaud > 2400 ? WWO_REVERSE : 0, 1, wwncol, - 0, 0, 0)) == 0) { + if ((cmdwin = wwopen(WWT_INTERNAL, wwbaud > 2400 ? WWO_REVERSE : 0, 1, + wwncol, 0, 0, 0)) == 0) { wwflush(); (void) fprintf(stderr, "%s.\r\n", wwerror()); goto bad; @@ -165,14 +165,15 @@ char **argv; cmdwin->ww_nointr = 1; cmdwin->ww_noupdate = 1; cmdwin->ww_unctrl = 1; - if ((framewin = wwopen(WWO_GLASS|WWO_FRAME, wwnrow, wwncol, 0, 0, 0)) - == 0) { + if ((framewin = wwopen(WWT_INTERNAL, WWO_GLASS|WWO_FRAME, wwnrow, + wwncol, 0, 0, 0)) == 0) { wwflush(); (void) fprintf(stderr, "%s.\r\n", wwerror()); goto bad; } wwadd(framewin, &wwhead); - if ((boxwin = wwopen(WWO_GLASS, wwnrow, wwncol, 0, 0, 0)) == 0) { + if ((boxwin = wwopen(WWT_INTERNAL, WWO_GLASS, wwnrow, wwncol, 0, 0, 0)) + == 0) { wwflush(); (void) fprintf(stderr, "%s.\r\n", wwerror()); goto bad; diff --git a/usr.bin/window/mloop.c b/usr.bin/window/mloop.c index bb6f867be6c..4ab37698289 100644 --- a/usr.bin/window/mloop.c +++ b/usr.bin/window/mloop.c @@ -1,4 +1,4 @@ -/* $NetBSD: mloop.c,v 1.3 1995/09/28 10:34:28 tls Exp $ */ +/* $NetBSD: mloop.c,v 1.4 1995/12/21 10:45:53 mycroft Exp $ */ /* * Copyright (c) 1983, 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)mloop.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$NetBSD: mloop.c,v 1.3 1995/09/28 10:34:28 tls Exp $"; +static char rcsid[] = "$NetBSD: mloop.c,v 1.4 1995/12/21 10:45:53 mycroft Exp $"; #endif #endif /* not lint */ @@ -64,13 +64,15 @@ mloop() register char *p; register n; - if (wwibp >= wwibq) + if (wwibp >= wwibq) { + wwibp = wwibq = wwib; wwiomux(); + } for (p = wwibp; p < wwibq && wwmaskc(*p) != escapec; p++) ; if ((n = p - wwibp) > 0) { - if (!w->ww_ispty && w->ww_stopped) + if (w->ww_type != WWT_PTY && w->ww_stopped) startwin(w); #if defined(sun) && !defined(BSD) /* workaround for SunOS pty bug */ diff --git a/usr.bin/window/win.c b/usr.bin/window/win.c index da31a4c186f..e7fe8db9701 100644 --- a/usr.bin/window/win.c +++ b/usr.bin/window/win.c @@ -1,4 +1,4 @@ -/* $NetBSD: win.c,v 1.5 1995/09/29 00:44:08 cgd Exp $ */ +/* $NetBSD: win.c,v 1.6 1995/12/21 10:46:01 mycroft Exp $ */ /* * Copyright (c) 1983, 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)win.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$NetBSD: win.c,v 1.5 1995/09/29 00:44:08 cgd Exp $"; +static char rcsid[] = "$NetBSD: win.c,v 1.6 1995/12/21 10:46:01 mycroft Exp $"; #endif #endif /* not lint */ @@ -82,7 +82,7 @@ char *shf, **sh; error("Illegal window position."); return 0; } - w = wwopen(haspty ? WWO_PTY : WWO_SOCKET, nrow, ncol, row, col, nline); + w = wwopen(haspty ? WWT_PTY : WWT_SOCKET, 0, nrow, ncol, row, col, nline); if (w == 0) { error("Can't open window: %s.", wwerror()); return 0; @@ -179,7 +179,7 @@ char *label; { register struct ww *w; - if ((w = wwopen(0, nrow, wwncol, 2, 0, 0)) == 0) + if ((w = wwopen(WWT_INTERNAL, 0, nrow, wwncol, 2, 0, 0)) == 0) return 0; w->ww_mapnl = 1; w->ww_hasframe = 1; @@ -308,7 +308,7 @@ register struct ww *w; stopwin(w) register struct ww *w; { - if (w->ww_pty >= 0 && w->ww_ispty && wwstoptty(w->ww_pty) < 0) + if (w->ww_pty >= 0 && w->ww_type == WWT_PTY && wwstoptty(w->ww_pty) < 0) error("Can't stop output: %s.", wwerror()); else w->ww_stopped = 1; @@ -317,7 +317,7 @@ stopwin(w) startwin(w) register struct ww *w; { - if (w->ww_pty >= 0 && w->ww_ispty && wwstarttty(w->ww_pty) < 0) + if (w->ww_pty >= 0 && w->ww_type == WWT_PTY && wwstarttty(w->ww_pty) < 0) error("Can't start output: %s.", wwerror()); else w->ww_stopped = 0; diff --git a/usr.bin/window/ww.h b/usr.bin/window/ww.h index 51a7abca719..cea40105d05 100644 --- a/usr.bin/window/ww.h +++ b/usr.bin/window/ww.h @@ -1,4 +1,4 @@ -/* $NetBSD: ww.h,v 1.3 1995/09/28 10:35:07 tls Exp $ */ +/* $NetBSD: ww.h,v 1.5 1995/12/21 11:05:58 mycroft Exp $ */ /* * Copyright (c) 1983, 1993 @@ -97,7 +97,7 @@ struct ww { char ww_hascursor; /* has fake cursor */ /* things for the window process and io */ - char ww_ispty; /* ww_pty is really a pty, not socket pair */ + char ww_type; /* ww_pty is really a pty, not socket pair */ char ww_stopped; /* output stopped */ int ww_pty; /* file descriptor of pty or socket pair */ int ww_socket; /* other end of socket pair */ @@ -128,7 +128,6 @@ struct ww_tty { #else struct termios ww_termios; #endif - int ww_fflags; }; union ww_char { @@ -182,6 +181,11 @@ struct ww_update { #define WWF_LABEL 0x40 #define WWF_TOP 0x80 + /* ww_type values */ +#define WWT_PTY 0 /* pty */ +#define WWT_SOCKET 1 /* socket pair */ +#define WWT_INTERNAL 2 + /* flags to wwopen() */ #define WWO_PTY 0x01 /* want pty */ #define WWO_SOCKET 0x02 /* want socket pair */ diff --git a/usr.bin/window/wwenviron.c b/usr.bin/window/wwenviron.c index 69a168a3308..229bd47991d 100644 --- a/usr.bin/window/wwenviron.c +++ b/usr.bin/window/wwenviron.c @@ -1,4 +1,4 @@ -/* $NetBSD: wwenviron.c,v 1.3 1995/09/28 10:35:27 tls Exp $ */ +/* $NetBSD: wwenviron.c,v 1.4 1995/12/21 08:39:50 mycroft Exp $ */ /* * Copyright (c) 1983, 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)wwenviron.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$NetBSD: wwenviron.c,v 1.3 1995/09/28 10:35:27 tls Exp $"; +static char rcsid[] = "$NetBSD: wwenviron.c,v 1.4 1995/12/21 08:39:50 mycroft Exp $"; #endif #endif /* not lint */ @@ -61,6 +61,7 @@ register struct ww *wp; int pgrp = getpid(); #endif char buf[1024]; + sigset_t sigset; #ifndef TIOCSCTTY if ((i = open("/dev/tty", 0)) < 0) @@ -90,7 +91,8 @@ register struct ww *wp; #endif /* SIGPIPE is the only one we ignore */ (void) signal(SIGPIPE, SIG_DFL); - (void) sigsetmask(0); + sigemptyset(&sigset); + sigprocmask(SIG_SETMASK, &sigset, (sigset_t *)0); /* * Two conditions that make destructive setenv ok: * 1. setenv() copies the string, diff --git a/usr.bin/window/wwflush.c b/usr.bin/window/wwflush.c index a741ac882eb..4ccf896c106 100644 --- a/usr.bin/window/wwflush.c +++ b/usr.bin/window/wwflush.c @@ -1,4 +1,4 @@ -/* $NetBSD: wwflush.c,v 1.3 1995/09/28 10:35:30 tls Exp $ */ +/* $NetBSD: wwflush.c,v 1.5 1995/12/21 10:46:08 mycroft Exp $ */ /* * Copyright (c) 1983, 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)wwflush.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$NetBSD: wwflush.c,v 1.3 1995/09/28 10:35:30 tls Exp $"; +static char rcsid[] = "$NetBSD: wwflush.c,v 1.5 1995/12/21 10:46:08 mycroft Exp $"; #endif #endif /* not lint */ @@ -70,7 +70,11 @@ wwflush() wwcheckpoint() { - int s = sigblock(sigmask(SIGALRM) | sigmask(SIGIO)); + sigset_t sigset, osigset; + + sigemptyset(&sigset); + sigaddset(&sigset, SIGALRM); + sigprocmask(SIG_BLOCK, &sigset, &osigset); tt.tt_ack = 0; do { @@ -80,7 +84,7 @@ wwcheckpoint() #endif (void) alarm(3); for (wwdocheckpoint = 0; !wwdocheckpoint && tt.tt_ack == 0;) - (void) sigpause(s); + sigsuspend(&osigset); } while (tt.tt_ack == 0); (void) alarm(0); wwdocheckpoint = 0; @@ -94,7 +98,8 @@ wwcheckpoint() wwcopyscreen(wwos, wwcs); (void) alarm(3); } - (void) sigsetmask(s); + + sigprocmask(SIG_SETMASK, &osigset, (sigset_t *)0); } wwcopyscreen(s1, s2) diff --git a/usr.bin/window/wwinit.c b/usr.bin/window/wwinit.c index 8a7e7489e8d..1ac0f4c344d 100644 --- a/usr.bin/window/wwinit.c +++ b/usr.bin/window/wwinit.c @@ -1,4 +1,4 @@ -/* $NetBSD: wwinit.c,v 1.7 1995/09/28 10:35:33 tls Exp $ */ +/* $NetBSD: wwinit.c,v 1.10 1995/12/21 11:06:28 mycroft Exp $ */ /* * Copyright (c) 1983, 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)wwinit.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$NetBSD: wwinit.c,v 1.7 1995/09/28 10:35:33 tls Exp $"; +static char rcsid[] = "$NetBSD: wwinit.c,v 1.10 1995/12/21 11:06:28 mycroft Exp $"; #endif #endif /* not lint */ @@ -54,16 +54,20 @@ wwinit() { register i, j; char *kp; - int s; + sigset_t sigset, osigset; wwdtablesize = 3; wwhead.ww_forw = &wwhead; wwhead.ww_back = &wwhead; - s = sigblock(sigmask(SIGIO) | sigmask(SIGCHLD) | sigmask(SIGALRM) | - sigmask(SIGHUP) | sigmask(SIGTERM)); - if (signal(SIGIO, wwrint) == BADSIG || - signal(SIGCHLD, wwchild) == BADSIG || + sigemptyset(&sigset); + sigaddset(&sigset, SIGCHLD); + sigaddset(&sigset, SIGALRM); + sigaddset(&sigset, SIGHUP); + sigaddset(&sigset, SIGTERM); + sigprocmask(SIG_BLOCK, &sigset, &osigset); + + if (signal(SIGCHLD, wwchild) == BADSIG || signal(SIGHUP, wwquit) == BADSIG || signal(SIGTERM, wwquit) == BADSIG || signal(SIGPIPE, SIG_IGN) == BADSIG) { @@ -115,7 +119,6 @@ wwinit() wwnewtty.ww_termios.c_cc[VMIN] = 1; wwnewtty.ww_termios.c_cc[VTIME] = 0; #endif - wwnewtty.ww_fflags = wwoldtty.ww_fflags | FASYNC; if (wwsettty(0, &wwnewtty) < 0) goto bad; @@ -319,19 +322,19 @@ wwinit() wwerrno = WWE_SYS; goto bad; } - /* catch typeahead before ASYNC was set */ - (void) kill(getpid(), SIGIO); wwstart1(); - (void) sigsetmask(s); + + sigprocmask(SIG_SETMASK, &osigset, (sigset_t *)0); return 0; + bad: /* * Don't bother to free storage. We're supposed * to exit when wwinit fails anyway. */ (void) wwsettty(0, &wwoldtty); - (void) signal(SIGIO, SIG_DFL); - (void) sigsetmask(s); + + sigprocmask(SIG_SETMASK, &osigset, (sigset_t *)0); return -1; } 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. diff --git a/usr.bin/window/wwopen.c b/usr.bin/window/wwopen.c index 59ed3c130ea..920d2eec2ef 100644 --- a/usr.bin/window/wwopen.c +++ b/usr.bin/window/wwopen.c @@ -1,4 +1,4 @@ -/* $NetBSD: wwopen.c,v 1.4 1995/09/28 10:35:42 tls Exp $ */ +/* $NetBSD: wwopen.c,v 1.5 1995/12/21 10:46:19 mycroft Exp $ */ /* * Copyright (c) 1983, 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)wwopen.c 8.2 (Berkeley) 4/28/95"; #else -static char rcsid[] = "$NetBSD: wwopen.c,v 1.4 1995/09/28 10:35:42 tls Exp $"; +static char rcsid[] = "$NetBSD: wwopen.c,v 1.5 1995/12/21 10:46:19 mycroft Exp $"; #endif #endif /* not lint */ @@ -50,7 +50,7 @@ static char rcsid[] = "$NetBSD: wwopen.c,v 1.4 1995/09/28 10:35:42 tls Exp $"; #include <fcntl.h> struct ww * -wwopen(flags, nrow, ncol, row, col, nline) +wwopen(type, flags, nrow, ncol, row, col, nline) { register struct ww *w; register i, j; @@ -100,11 +100,14 @@ wwopen(flags, nrow, ncol, row, col, nline) w->ww_cur.r = w->ww_w.t; w->ww_cur.c = w->ww_w.l; - if (flags & WWO_PTY) { + w->ww_type = type; + switch (type) { + case WWT_PTY: if (wwgetpty(w) < 0) goto bad; - w->ww_ispty = 1; - } else if (flags & WWO_SOCKET) { + break; + case WWT_SOCKET: + { int d[2]; if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, d) < 0) { wwerrno = WWE_SYS; @@ -114,8 +117,10 @@ wwopen(flags, nrow, ncol, row, col, nline) (void) fcntl(d[1], F_SETFD, 1); w->ww_pty = d[0]; w->ww_socket = d[1]; + break; + } } - if (flags & (WWO_PTY|WWO_SOCKET)) { + if (type != WWT_INTERNAL) { if ((w->ww_ob = malloc(512)) == 0) { wwerrno = WWE_NOMEM; goto bad; diff --git a/usr.bin/window/wwrint.c b/usr.bin/window/wwrint.c index 10b70561dd1..c7ef28ed6ec 100644 --- a/usr.bin/window/wwrint.c +++ b/usr.bin/window/wwrint.c @@ -1,4 +1,4 @@ -/* $NetBSD: wwrint.c,v 1.3 1995/09/28 10:35:52 tls Exp $ */ +/* $NetBSD: wwrint.c,v 1.4 1995/12/21 10:46:24 mycroft Exp $ */ /* * Copyright (c) 1983, 1993 @@ -40,15 +40,12 @@ #if 0 static char sccsid[] = "@(#)wwrint.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$NetBSD: wwrint.c,v 1.3 1995/09/28 10:35:52 tls Exp $"; +static char rcsid[] = "$NetBSD: wwrint.c,v 1.4 1995/12/21 10:46:24 mycroft Exp $"; #endif #endif /* not lint */ #include "ww.h" #include "tt.h" -#if defined(OLD_TTY) || defined(VMIN_BUG) -#include <fcntl.h> -#endif /* * Tty input interrupt handler. @@ -65,17 +62,8 @@ wwrint() { register n; - if (wwibp == wwibq) - wwibp = wwibq = wwib; wwnread++; -#if defined(OLD_TTY) || defined(VMIN_BUG) - /* we have set c_cc[VMIN] to 0 */ - (void) fcntl(0, F_SETFL, O_NONBLOCK|wwnewtty.ww_fflags); -#endif n = read(0, wwibq, wwibe - wwibq); -#if defined(OLD_TTY) || defined(VMIN_BUG) - (void) fcntl(0, F_SETFL, wwnewtty.ww_fflags); -#endif if (n > 0) { if (tt.tt_rint) n = (*tt.tt_rint)(wwibq, n); diff --git a/usr.bin/window/wwsize.c b/usr.bin/window/wwsize.c index 2ed40d49472..a135cb43f6a 100644 --- a/usr.bin/window/wwsize.c +++ b/usr.bin/window/wwsize.c @@ -1,4 +1,4 @@ -/* $NetBSD: wwsize.c,v 1.3 1995/09/28 10:35:54 tls Exp $ */ +/* $NetBSD: wwsize.c,v 1.4 1995/12/21 10:46:28 mycroft Exp $ */ /* * Copyright (c) 1983, 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)wwsize.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$NetBSD: wwsize.c,v 1.3 1995/09/28 10:35:54 tls Exp $"; +static char rcsid[] = "$NetBSD: wwsize.c,v 1.4 1995/12/21 10:46:28 mycroft Exp $"; #endif #endif /* not lint */ @@ -181,7 +181,7 @@ register struct ww *w; /* * Fool with pty. */ - if (w->ww_ispty && w->ww_pty >= 0) + if (w->ww_type == WWT_PTY && w->ww_pty >= 0) (void) wwsetttysize(w->ww_pty, nrow, ncol); return 0; bad: diff --git a/usr.bin/window/wwspawn.c b/usr.bin/window/wwspawn.c index 300a4c4da10..4699df22843 100644 --- a/usr.bin/window/wwspawn.c +++ b/usr.bin/window/wwspawn.c @@ -1,4 +1,4 @@ -/* $NetBSD: wwspawn.c,v 1.3 1995/09/28 10:35:55 tls Exp $ */ +/* $NetBSD: wwspawn.c,v 1.4 1995/12/21 08:39:57 mycroft Exp $ */ /* * Copyright (c) 1983, 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)wwspawn.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$NetBSD: wwspawn.c,v 1.3 1995/09/28 10:35:55 tls Exp $"; +static char rcsid[] = "$NetBSD: wwspawn.c,v 1.4 1995/12/21 08:39:57 mycroft Exp $"; #endif #endif /* not lint */ @@ -59,9 +59,12 @@ char **argv; int pid; int ret; char erred = 0; - int s; + sigset_t sigset, osigset; + + sigemptyset(&sigset); + sigaddset(&sigset, SIGCHLD); + sigprocmask(SIG_BLOCK, &sigset, &osigset); - s = sigblock(sigmask(SIGCHLD)); switch (pid = vfork()) { case -1: wwerrno = WWE_SYS; @@ -82,7 +85,9 @@ char **argv; ret = pid; } } - (void) sigsetmask(s); + + sigprocmask(SIG_SETMASK, &osigset, (sigset_t *)0); + if (wp->ww_socket >= 0) { (void) close(wp->ww_socket); wp->ww_socket = -1; diff --git a/usr.bin/window/wwtty.c b/usr.bin/window/wwtty.c index 347862608ef..e20b8c5c2c4 100644 --- a/usr.bin/window/wwtty.c +++ b/usr.bin/window/wwtty.c @@ -1,4 +1,4 @@ -/* $NetBSD: wwtty.c,v 1.3 1995/09/28 10:35:58 tls Exp $ */ +/* $NetBSD: wwtty.c,v 1.4 1995/12/21 11:06:50 mycroft Exp $ */ /* * Copyright (c) 1983, 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)wwtty.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$NetBSD: wwtty.c,v 1.3 1995/09/28 10:35:58 tls Exp $"; +static char rcsid[] = "$NetBSD: wwtty.c,v 1.4 1995/12/21 11:06:50 mycroft Exp $"; #endif #endif /* not lint */ @@ -69,8 +69,6 @@ register struct ww_tty *t; if (tcgetattr(d, &t->ww_termios) < 0) goto bad; #endif - if ((t->ww_fflags = fcntl(d, F_GETFL, 0)) < 0) - goto bad; return 0; bad: wwerrno = WWE_SYS; @@ -112,8 +110,6 @@ register struct ww_tty *t; if (tcsetattr(d, TCSADRAIN, &t->ww_termios) < 0) goto bad; #endif - if (fcntl(d, F_SETFL, t->ww_fflags) < 0) - goto bad; return 0; bad: wwerrno = WWE_SYS; |