Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make(1): re-export variables from the actual ma...
details: https://anonhg.NetBSD.org/src/rev/3a0de4923182
branches: trunk
changeset: 948327:3a0de4923182
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Dec 27 05:16:26 2020 +0000
description:
make(1): re-export variables from the actual make process
Since make uses vfork if available, re-exporting the variables happens
in the address space of the main process anyway, so there is no point in
mentioning anything about "our client process" anywhere.
diffstat:
usr.bin/make/compat.c | 7 ++++---
usr.bin/make/job.c | 8 ++++----
usr.bin/make/main.c | 8 ++++----
3 files changed, 12 insertions(+), 11 deletions(-)
diffs (107 lines):
diff -r f8f77ef93c06 -r 3a0de4923182 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c Sun Dec 27 05:11:40 2020 +0000
+++ b/usr.bin/make/compat.c Sun Dec 27 05:16:26 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.216 2020/12/20 21:07:32 rillig Exp $ */
+/* $NetBSD: compat.c,v 1.217 2020/12/27 05:16:26 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
#include "pathnames.h"
/* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.216 2020/12/20 21:07:32 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.217 2020/12/27 05:16:26 rillig Exp $");
static GNode *curTarg = NULL;
static pid_t compatChild;
@@ -350,6 +350,8 @@
}
#endif
+ Var_ReexportVars();
+
/*
* Fork and execute the single command. If the fork fails, we abort.
*/
@@ -358,7 +360,6 @@
Fatal("Could not fork");
}
if (cpid == 0) {
- Var_ReexportVars();
#ifdef USE_META
if (useMeta) {
meta_compat_child();
diff -r f8f77ef93c06 -r 3a0de4923182 usr.bin/make/job.c
--- a/usr.bin/make/job.c Sun Dec 27 05:11:40 2020 +0000
+++ b/usr.bin/make/job.c Sun Dec 27 05:16:26 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.389 2020/12/20 21:07:32 rillig Exp $ */
+/* $NetBSD: job.c,v 1.390 2020/12/27 05:16:26 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
#include "trace.h"
/* "@(#)job.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.389 2020/12/20 21:07:32 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.390 2020/12/27 05:16:26 rillig Exp $");
/*
* A shell defines how the commands are run. All commands for a target are
@@ -1380,6 +1380,8 @@
/* Pre-emptively mark job running, pid still zero though */
job->status = JOB_ST_RUNNING;
+ Var_ReexportVars();
+
cpid = vFork();
if (cpid == -1)
Punt("Cannot vfork: %s", strerror(errno));
@@ -1461,8 +1463,6 @@
# endif
#endif
- Var_ReexportVars();
-
(void)execv(shellPath, argv);
execDie("exec", shellPath);
}
diff -r f8f77ef93c06 -r 3a0de4923182 usr.bin/make/main.c
--- a/usr.bin/make/main.c Sun Dec 27 05:11:40 2020 +0000
+++ b/usr.bin/make/main.c Sun Dec 27 05:16:26 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.503 2020/12/26 03:54:48 sjg Exp $ */
+/* $NetBSD: main.c,v 1.504 2020/12/27 05:16:26 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
#include "trace.h"
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.503 2020/12/26 03:54:48 sjg Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.504 2020/12/27 05:16:26 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@@ -1775,6 +1775,8 @@
goto bad;
}
+ Var_ReexportVars();
+
/*
* Fork
*/
@@ -1790,8 +1792,6 @@
(void)dup2(pipefds[1], 1);
(void)close(pipefds[1]);
- Var_ReexportVars();
-
(void)execv(shellPath, UNCONST(args));
_exit(1);
/*NOTREACHED*/
Home |
Main Index |
Thread Index |
Old Index