summaryrefslogtreecommitdiff
path: root/usr.bin/window/wwinit.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/wwinit.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/wwinit.c')
-rw-r--r--usr.bin/window/wwinit.c29
1 files changed, 16 insertions, 13 deletions
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;
}