diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-11-23 23:42:46 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-11-23 23:42:46 +0000 |
commit | 32fea44a447452ba1d025ef563097a2b639c7b5f (patch) | |
tree | 26a2a640432cd0308153cf45b4be2391d8473309 | |
parent | 2b5bf0455cfdd3b06f52578c304a38c1bf3a7b71 (diff) |
back out changes that break kernel compiles. good testing jobmk install!
-rw-r--r-- | usr.bin/make/compat.c | 94 | ||||
-rw-r--r-- | usr.bin/make/gnode.h | 3 | ||||
-rw-r--r-- | usr.bin/make/make.c | 5 | ||||
-rw-r--r-- | usr.bin/make/suff.c | 4 |
4 files changed, 56 insertions, 50 deletions
diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c index a3c0994b5c6..d5ee0f2156a 100644 --- a/usr.bin/make/compat.c +++ b/usr.bin/make/compat.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: compat.c,v 1.43 2001/11/22 23:56:43 espie Exp $ */ +/* $OpenBSD: compat.c,v 1.44 2001/11/23 23:42:45 deraadt Exp $ */ /* $NetBSD: compat.c,v 1.14 1996/11/06 17:59:01 christos Exp $ */ /* @@ -77,20 +77,45 @@ static char meta[256]; +static GNode *curTarg = NULL; static GNode *ENDNode; static void CompatInterrupt(int); static int CompatRunCommand(void *, void *); static void CompatMake(void *, void *); static int shellneed(char **); -static volatile sig_atomic_t interrupted; - -static void +/*- + *----------------------------------------------------------------------- + * CompatInterrupt -- + * Interrupt the creation of the current target and remove it if + * it ain't precious. + * + * Side Effects: + * The target is removed and the process exits. If .INTERRUPT exists, + * its commands are run first WITH INTERRUPTS IGNORED.. + *----------------------------------------------------------------------- + */ +static void CompatInterrupt(signo) - int signo; + int signo; { - if (interrupted != SIGINT) - interrupted = signo; + GNode *gn; + + if (curTarg != NULL && !Targ_Precious(curTarg)) { + char *file = Varq_Value(TARGET_INDEX, curTarg); + + if (!noExecute && eunlink(file) != -1) + Error("*** %s removed\n", file); + + /* Run .INTERRUPT only if hit with interrupt signal. */ + if (signo == SIGINT) { + gn = Targ_FindNode(".INTERRUPT", TARG_NOCREATE); + if (gn != NULL) + Lst_Find(&gn->commands, CompatRunCommand, gn); + } + + } + _exit(signo); } /*- @@ -318,9 +343,6 @@ CompatRunCommand(cmdp, gnp) break; } - if (interrupted) - break; - if (stat != -1) { if (WIFSTOPPED(reason)) status = WSTOPSIG(reason); /* stopped */ @@ -348,31 +370,13 @@ CompatRunCommand(cmdp, gnp) status = 0; } } - return !status; + break; } else Fatal("error in wait: %d", stat); /*NOTREACHED*/ } - /* This is reached only if interrupted */ - if (!Targ_Precious(gn)) { - char *file = Varq_Value(TARGET_INDEX, gn); - - if (!noExecute && eunlink(file) != -1) - Error("*** %s removed\n", file); - } - if (interrupted == SIGINT) { - GNode *i = Targ_FindNode(".INTERRUPT", TARG_NOCREATE); - signal(SIGINT, SIG_IGN); - signal(SIGTERM, SIG_IGN); - signal(SIGHUP, SIG_IGN); - signal(SIGQUIT, SIG_IGN); - interrupted = 0; - if (i != NULL) - Lst_Find(&i->commands, CompatRunCommand, i); - exit(SIGINT); - } - exit(interrupted); + return !status; } /*- @@ -416,9 +420,9 @@ CompatMake(gnp, pgnp) return; } - if (Lst_Member(&gn->iParents, pgn) != NULL && - (pgn->type & OP_IS_SUFFIX)) - Varq_Set(IMPSRC_INDEX, Varq_Value(TARGET_INDEX, gn), pgn); + if (Lst_Member(&gn->iParents, pgn) != NULL) { + Varq_Set(IMPSRC_INDEX, Varq_Value(TARGET_INDEX, gn), pgn); + } /* All the children were made ok. Now cmtime contains the modification * time of the newest child, we need to find out if we exist and when @@ -454,9 +458,11 @@ CompatMake(gnp, pgnp) if (Job_CheckCommands(gn, Fatal)) { /* Our commands are ok, but we still have to worry about the -t * flag... */ - if (!touchFlag) + if (!touchFlag) { + curTarg = gn; Lst_Find(&gn->commands, CompatRunCommand, gn); - else + curTarg = NULL; + } else Job_Touch(gn, gn->type & OP_SILENT); } else gn->made = ERROR; @@ -541,9 +547,9 @@ CompatMake(gnp, pgnp) * to abort. */ pgn->make = false; else { - if (Lst_Member(&gn->iParents, pgn) != NULL && - (pgn->type & OP_IS_SUFFIX)) - Varq_Set(IMPSRC_INDEX, Varq_Value(TARGET_INDEX, gn), pgn); + if (Lst_Member(&gn->iParents, pgn) != NULL) { + Varq_Set(IMPSRC_INDEX, Varq_Value(TARGET_INDEX, gn), pgn); + } switch (gn->made) { case BEINGMADE: Error("Graph cycles through %s\n", gn->name); @@ -574,10 +580,14 @@ Compat_Run(targs) GNode *gn = NULL;/* Current root target */ int errors; /* Number of targets not remade due to errors */ - signal(SIGINT, CompatInterrupt); - signal(SIGTERM, CompatInterrupt); - signal(SIGHUP, CompatInterrupt); - signal(SIGQUIT, CompatInterrupt); + if (signal(SIGINT, SIG_IGN) != SIG_IGN) + signal(SIGINT, CompatInterrupt); + if (signal(SIGTERM, SIG_IGN) != SIG_IGN) + signal(SIGTERM, CompatInterrupt); + if (signal(SIGHUP, SIG_IGN) != SIG_IGN) + signal(SIGHUP, CompatInterrupt); + if (signal(SIGQUIT, SIG_IGN) != SIG_IGN) + signal(SIGQUIT, CompatInterrupt); for (cp = "#=|^(){};&<>*?[]:$`\\\n"; *cp != '\0'; cp++) meta[(unsigned char) *cp] = 1; diff --git a/usr.bin/make/gnode.h b/usr.bin/make/gnode.h index 4087a885991..a4ce27b1ce6 100644 --- a/usr.bin/make/gnode.h +++ b/usr.bin/make/gnode.h @@ -1,7 +1,7 @@ #ifndef GNODE_H #define GNODE_H /* $OpenPackages$ */ -/* $OpenBSD: gnode.h,v 1.3 2001/11/22 21:18:10 espie Exp $ */ +/* $OpenBSD: gnode.h,v 1.4 2001/11/23 23:42:45 deraadt Exp $ */ /* * Copyright (c) 2001 Marc Espie. @@ -176,7 +176,6 @@ struct GNode_ { * commands for a target */ #define OP_SAVE_CMDS 0x04000000 /* Saving commands on .END (Compat) */ #define OP_DEPS_FOUND 0x02000000 /* Already processed by Suff_FindDeps */ -#define OP_IS_SUFFIX 0x01000000 /* Cmds filled by suffix rule */ /* * OP_NOP will return true if the node with the given type was not the diff --git a/usr.bin/make/make.c b/usr.bin/make/make.c index a0f0a1d4e20..0621810ffdb 100644 --- a/usr.bin/make/make.c +++ b/usr.bin/make/make.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: make.c,v 1.31 2001/11/22 21:18:10 espie Exp $ */ +/* $OpenBSD: make.c,v 1.32 2001/11/23 23:42:45 deraadt Exp $ */ /* $NetBSD: make.c,v 1.10 1996/11/06 17:59:15 christos Exp $ */ /* @@ -512,8 +512,7 @@ Make_Update(cgn) for (ln = Lst_First(&cgn->iParents); ln != NULL; ln = Lst_Adv(ln)) { pgn = (GNode *)Lst_Datum(ln); if (pgn->make) { - if (pgn->type & OP_IS_SUFFIX) - Varq_Set(IMPSRC_INDEX, cname, pgn); + Varq_Set(IMPSRC_INDEX, cname, pgn); Varq_Set(PREFIX_INDEX, cpref, pgn); } } diff --git a/usr.bin/make/suff.c b/usr.bin/make/suff.c index b0ce597a434..f35459ccd32 100644 --- a/usr.bin/make/suff.c +++ b/usr.bin/make/suff.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: suff.c,v 1.47 2001/11/22 21:18:10 espie Exp $ */ +/* $OpenBSD: suff.c,v 1.48 2001/11/23 23:42:45 deraadt Exp $ */ /* $NetBSD: suff.c,v 1.13 1996/11/06 17:59:25 christos Exp $ */ /* @@ -1431,8 +1431,6 @@ SuffApplyTransform(tGn, sGn, t, s) /* Record last child for expansion purposes. */ ln = Lst_Last(&tGn->children); - if (Lst_IsEmpty(&tGn->commands)) - tGn->type |= OP_IS_SUFFIX; /* Pass the buck to Make_HandleUse to apply the rule. */ Make_HandleUse(gn, tGn); |