Clean up INTOFF/INTON usage a little -- none of fork{shell,parent,child}()

screw with them now, only their callers.
This commit is contained in:
mycroft 2002-09-27 21:32:24 +00:00
parent 7c22835649
commit d84d36165d
3 changed files with 13 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: error.c,v 1.26 2002/09/27 16:56:15 christos Exp $ */ /* $NetBSD: error.c,v 1.27 2002/09/27 21:32:24 mycroft Exp $ */
/*- /*-
* Copyright (c) 1991, 1993 * Copyright (c) 1991, 1993
@ -41,7 +41,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)error.c 8.2 (Berkeley) 5/4/95"; static char sccsid[] = "@(#)error.c 8.2 (Berkeley) 5/4/95";
#else #else
__RCSID("$NetBSD: error.c,v 1.26 2002/09/27 16:56:15 christos Exp $"); __RCSID("$NetBSD: error.c,v 1.27 2002/09/27 21:32:24 mycroft Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -53,6 +53,7 @@ __RCSID("$NetBSD: error.c,v 1.26 2002/09/27 16:56:15 christos Exp $");
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <stdio.h>
#include "shell.h" #include "shell.h"
#include "main.h" #include "main.h"

View File

@ -1,4 +1,4 @@
/* $NetBSD: eval.c,v 1.62 2002/09/27 20:24:36 christos Exp $ */ /* $NetBSD: eval.c,v 1.63 2002/09/27 21:32:25 mycroft Exp $ */
/*- /*-
* Copyright (c) 1993 * Copyright (c) 1993
@ -41,7 +41,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95"; static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95";
#else #else
__RCSID("$NetBSD: eval.c,v 1.62 2002/09/27 20:24:36 christos Exp $"); __RCSID("$NetBSD: eval.c,v 1.63 2002/09/27 21:32:25 mycroft Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -410,18 +410,18 @@ evalsubshell(n, flags)
int backgnd = (n->type == NBACKGND); int backgnd = (n->type == NBACKGND);
expredir(n->nredir.redirect); expredir(n->nredir.redirect);
INTOFF;
jp = makejob(n, 1); jp = makejob(n, 1);
if (forkshell(jp, n, backgnd) == 0) { if (forkshell(jp, n, backgnd) == 0) {
INTON;
if (backgnd) if (backgnd)
flags &=~ EV_TESTED; flags &=~ EV_TESTED;
redirect(n->nredir.redirect, 0); redirect(n->nredir.redirect, 0);
evaltree(n->nredir.n, flags | EV_EXIT); /* never returns */ evaltree(n->nredir.n, flags | EV_EXIT); /* never returns */
} }
if (! backgnd) { if (! backgnd)
INTOFF;
exitstatus = waitforjob(jp); exitstatus = waitforjob(jp);
INTON; INTON;
}
} }
@ -565,6 +565,7 @@ evalbackcmd(n, result)
#endif #endif
{ {
exitstatus = 0; exitstatus = 0;
INTOFF;
if (pipe(pip) < 0) if (pipe(pip) < 0)
error("Pipe call failed"); error("Pipe call failed");
jp = makejob(n, 1); jp = makejob(n, 1);
@ -582,6 +583,7 @@ evalbackcmd(n, result)
close(pip[1]); close(pip[1]);
result->fd = pip[0]; result->fd = pip[0];
result->jp = jp; result->jp = jp;
INTON;
} }
out: out:
popstackmark(&smark); popstackmark(&smark);
@ -749,7 +751,6 @@ evalcommand(cmd, flags, backcmd)
if (cmdentry.cmdtype == CMDNORMAL) { if (cmdentry.cmdtype == CMDNORMAL) {
pid_t pid; pid_t pid;
INTOFF;
savelocalvars = localvars; savelocalvars = localvars;
localvars = NULL; localvars = NULL;
for (sp = varlist.list ; sp ; sp = sp->next) for (sp = varlist.list ; sp ; sp = sp->next)

View File

@ -1,4 +1,4 @@
/* $NetBSD: jobs.c,v 1.48 2002/09/27 21:04:08 christos Exp $ */ /* $NetBSD: jobs.c,v 1.49 2002/09/27 21:32:25 mycroft Exp $ */
/*- /*-
* Copyright (c) 1991, 1993 * Copyright (c) 1991, 1993
@ -41,7 +41,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95"; static char sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95";
#else #else
__RCSID("$NetBSD: jobs.c,v 1.48 2002/09/27 21:04:08 christos Exp $"); __RCSID("$NetBSD: jobs.c,v 1.49 2002/09/27 21:32:25 mycroft Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -659,7 +659,6 @@ forkshell(jp, n, mode)
int pid; int pid;
TRACE(("forkshell(%%%d, %p, %d) called\n", jp - jobtab, n, mode)); TRACE(("forkshell(%%%d, %p, %d) called\n", jp - jobtab, n, mode));
INTOFF;
switch ((pid = fork())) { switch ((pid = fork())) {
case -1: case -1:
TRACE(("Fork failed, errno=%d", errno)); TRACE(("Fork failed, errno=%d", errno));
@ -704,7 +703,6 @@ forkparent(jp, n, mode, pid)
if (iflag && rootshell && n) if (iflag && rootshell && n)
ps->cmd = commandtext(n); ps->cmd = commandtext(n);
} }
INTON;
TRACE(("In parent shell: child = %d\n", pid)); TRACE(("In parent shell: child = %d\n", pid));
return pid; return pid;
} }
@ -732,9 +730,6 @@ forkchild(jp, n, mode, vforked)
freejob(p); freejob(p);
} }
closescript(vforked); closescript(vforked);
if (!vforked) {
INTON;
}
clear_traps(vforked); clear_traps(vforked);
#if JOBS #if JOBS
if (!vforked) if (!vforked)