job.c (251422) | job.c (253883) |
---|---|
1/* $NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sjg Exp $ */ | 1/* $NetBSD: job.c,v 1.175 2013/07/30 19:09:57 sjg Exp $ */ |
2 3/* 4 * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Adam de Boor. 9 * --- 55 unchanged lines hidden (view full) --- 65 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 66 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 67 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 68 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 69 * SUCH DAMAGE. 70 */ 71 72#ifndef MAKE_NATIVE | 2 3/* 4 * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Adam de Boor. 9 * --- 55 unchanged lines hidden (view full) --- 65 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 66 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 67 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 68 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 69 * SUCH DAMAGE. 70 */ 71 72#ifndef MAKE_NATIVE |
73static char rcsid[] = "$NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sjg Exp $"; | 73static char rcsid[] = "$NetBSD: job.c,v 1.175 2013/07/30 19:09:57 sjg Exp $"; |
74#else 75#include <sys/cdefs.h> 76#ifndef lint 77#if 0 78static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; 79#else | 74#else 75#include <sys/cdefs.h> 76#ifndef lint 77#if 0 78static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; 79#else |
80__RCSID("$NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sjg Exp $"); | 80__RCSID("$NetBSD: job.c,v 1.175 2013/07/30 19:09:57 sjg Exp $"); |
81#endif 82#endif /* not lint */ 83#endif 84 85/*- 86 * job.c -- 87 * handle the creation etc. of our child processes. 88 * --- 219 unchanged lines hidden (view full) --- 308static Shell *commandShell = &shells[DEFSHELL_INDEX]; /* this is the shell to 309 * which we pass all 310 * commands in the Makefile. 311 * It is set by the 312 * Job_ParseShell function */ 313const char *shellPath = NULL, /* full pathname of 314 * executable image */ 315 *shellName = NULL; /* last component of shell */ | 81#endif 82#endif /* not lint */ 83#endif 84 85/*- 86 * job.c -- 87 * handle the creation etc. of our child processes. 88 * --- 219 unchanged lines hidden (view full) --- 308static Shell *commandShell = &shells[DEFSHELL_INDEX]; /* this is the shell to 309 * which we pass all 310 * commands in the Makefile. 311 * It is set by the 312 * Job_ParseShell function */ 313const char *shellPath = NULL, /* full pathname of 314 * executable image */ 315 *shellName = NULL; /* last component of shell */ |
316char *shellErrFlag = NULL; |
|
316static const char *shellArgv = NULL; /* Custom shell args */ 317 318 319STATIC Job *job_table; /* The structures that describe them */ 320STATIC Job *job_table_end; /* job_table + maxJobs */ 321static int wantToken; /* we want a token */ 322static int lurking_children = 0; 323static int make_suspended = 0; /* non-zero if we've seen a SIGTSTP (etc) */ --- 15 unchanged lines hidden (view full) --- 339static Job tokenWaitJob; /* token wait pseudo-job */ 340 341static Job childExitJob; /* child exit pseudo-job */ 342#define CHILD_EXIT "." 343#define DO_JOB_RESUME "R" 344 345#define TARG_FMT "%s %s ---\n" /* Default format */ 346#define MESSAGE(fp, gn) \ | 317static const char *shellArgv = NULL; /* Custom shell args */ 318 319 320STATIC Job *job_table; /* The structures that describe them */ 321STATIC Job *job_table_end; /* job_table + maxJobs */ 322static int wantToken; /* we want a token */ 323static int lurking_children = 0; 324static int make_suspended = 0; /* non-zero if we've seen a SIGTSTP (etc) */ --- 15 unchanged lines hidden (view full) --- 340static Job tokenWaitJob; /* token wait pseudo-job */ 341 342static Job childExitJob; /* child exit pseudo-job */ 343#define CHILD_EXIT "." 344#define DO_JOB_RESUME "R" 345 346#define TARG_FMT "%s %s ---\n" /* Default format */ 347#define MESSAGE(fp, gn) \ |
347 if (maxJobs != 1) \ | 348 if (maxJobs != 1 && targPrefix && *targPrefix) \ |
348 (void)fprintf(fp, TARG_FMT, targPrefix, gn->name) 349 350static sigset_t caught_signals; /* Set of signals we handle */ 351#if defined(SYSV) 352#define KILLPG(pid, sig) kill(-(pid), (sig)) 353#else 354#define KILLPG(pid, sig) killpg((pid), (sig)) 355#endif --- 1791 unchanged lines hidden (view full) --- 2147 shellPath = str_concat(_PATH_DEFSHELLDIR, shellName, STR_ADDSLASH); 2148 } 2149 if (commandShell->exit == NULL) { 2150 commandShell->exit = ""; 2151 } 2152 if (commandShell->echo == NULL) { 2153 commandShell->echo = ""; 2154 } | 349 (void)fprintf(fp, TARG_FMT, targPrefix, gn->name) 350 351static sigset_t caught_signals; /* Set of signals we handle */ 352#if defined(SYSV) 353#define KILLPG(pid, sig) kill(-(pid), (sig)) 354#else 355#define KILLPG(pid, sig) killpg((pid), (sig)) 356#endif --- 1791 unchanged lines hidden (view full) --- 2148 shellPath = str_concat(_PATH_DEFSHELLDIR, shellName, STR_ADDSLASH); 2149 } 2150 if (commandShell->exit == NULL) { 2151 commandShell->exit = ""; 2152 } 2153 if (commandShell->echo == NULL) { 2154 commandShell->echo = ""; 2155 } |
2156 if (commandShell->hasErrCtl && *commandShell->exit) { 2157 if (shellErrFlag && 2158 strcmp(commandShell->exit, &shellErrFlag[1]) != 0) { 2159 free(shellErrFlag); 2160 shellErrFlag = NULL; 2161 } 2162 if (!shellErrFlag) { 2163 int n = strlen(commandShell->exit) + 2; 2164 2165 shellErrFlag = bmake_malloc(n); 2166 if (shellErrFlag) { 2167 snprintf(shellErrFlag, n, "-%s", commandShell->exit); 2168 } 2169 } 2170 } else if (shellErrFlag) { 2171 free(shellErrFlag); 2172 shellErrFlag = NULL; 2173 } |
|
2155} 2156 2157/*- 2158 * Returns the string literal that is used in the current command shell 2159 * to produce a newline character. 2160 */ 2161const char * 2162Shell_GetNewline(void) --- 328 unchanged lines hidden (view full) --- 2491 free(words); 2492 return(FAILURE); 2493 } 2494 commandShell = sh; 2495 } else { 2496 commandShell = bmake_malloc(sizeof(Shell)); 2497 *commandShell = newShell; 2498 } | 2174} 2175 2176/*- 2177 * Returns the string literal that is used in the current command shell 2178 * to produce a newline character. 2179 */ 2180const char * 2181Shell_GetNewline(void) --- 328 unchanged lines hidden (view full) --- 2510 free(words); 2511 return(FAILURE); 2512 } 2513 commandShell = sh; 2514 } else { 2515 commandShell = bmake_malloc(sizeof(Shell)); 2516 *commandShell = newShell; 2517 } |
2518 /* this will take care of shellErrFlag */ 2519 Shell_Init(); |
|
2499 } 2500 2501 if (commandShell->echoOn && commandShell->echoOff) { 2502 commandShell->hasEchoCtl = TRUE; 2503 } 2504 2505 if (!commandShell->hasErrCtl) { 2506 if (commandShell->errCheck == NULL) { --- 526 unchanged lines hidden --- | 2520 } 2521 2522 if (commandShell->echoOn && commandShell->echoOff) { 2523 commandShell->hasEchoCtl = TRUE; 2524 } 2525 2526 if (!commandShell->hasErrCtl) { 2527 if (commandShell->errCheck == NULL) { --- 526 unchanged lines hidden --- |