Lines Matching +full:sig +full:- +full:dir +full:- +full:cmd

121  *	Job_Wait	Wait for all currently-running jobs to finish.
151 #include "dir.h"
188 * The command-line flags "echo" and "exit" also control the behavior. The
198 * .SHELL target. For user-defined shells, this is the full path of
236 /* Run the command even in -n or -N mode. */
255 /* we've sent 'set -x' */
262 * pass jobs queue to sub-makes.
303 * name or the full path of a sh-compatible shell, which will be used as
328 * An sh-compatible shell with a non-standard name.
331 * non-portable features that might not be supplied by all
332 * sh-compatible shells.
373 /* XXX: -q is not really echoFlag, it's more like noEchoInSysFlag. */
387 "set -v", /* .echoOn */
417 "csh -c \"%s || exit 0\"\n", /* .runIgnTmpl */
455 static Job tokenWaitJob; /* token wait pseudo-job */
457 static Job childExitJob; /* child exit pseudo-job */
462 npseudojobs = 2 /* number of pseudo-jobs */
484 (void)fprintf(stdout, "%s %s ---\n", targPrefix, gn->name); in SwitchOutputTo()
501 job->ignerr ? 'i' : '-', in Job_FlagsToString()
502 !job->echo ? 's' : '-', in Job_FlagsToString()
503 job->special ? 'S' : '-'); in Job_FlagsToString()
516 (int)(job - job_table), job->status, flags, job->pid); in DumpJobs()
529 if (gn->type & OP_JOIN) in JobDeleteTarget()
531 if (gn->type & OP_PHONY) in JobDeleteTarget()
570 if (pipe(pipe_fds) == -1) in JobCreatePipe()
574 /* Avoid using low-numbered fds */ in JobCreatePipe()
576 if (fd != -1) { in JobCreatePipe()
582 job->inPipe = pipe_fds[0]; in JobCreatePipe()
583 job->outPipe = pipe_fds[1]; in JobCreatePipe()
585 if (fcntl(job->inPipe, F_SETFD, FD_CLOEXEC) == -1) in JobCreatePipe()
586 Punt("Cannot set close-on-exec: %s", strerror(errno)); in JobCreatePipe()
587 if (fcntl(job->outPipe, F_SETFD, FD_CLOEXEC) == -1) in JobCreatePipe()
588 Punt("Cannot set close-on-exec: %s", strerror(errno)); in JobCreatePipe()
591 * We mark the input side of the pipe non-blocking; we poll(2) the in JobCreatePipe()
596 flags = fcntl(job->inPipe, F_GETFL, 0); in JobCreatePipe()
597 if (flags == -1) in JobCreatePipe()
600 if (fcntl(job->inPipe, F_SETFL, flags) == -1) in JobCreatePipe()
613 if (job->status != JOB_ST_RUNNING) in JobCondPassSig()
616 signo, job->pid); in JobCondPassSig()
617 KILLPG(job->pid, signo); in JobCondPassSig()
630 while (write(childExitJob.outPipe, CHILD_EXIT, 1) == -1 && in JobChildSig()
644 while (write(childExitJob.outPipe, DO_JOB_RESUME, 1) == -1 && in JobContinueSig()
712 * events will have happened by then - and that the waitpid() will in JobPassSig_suspend()
732 if (job->status == status && job->pid == pid) in JobFindPid()
740 /* Parse leading '@', '-' and '+', which control the exact execution mode. */
745 out_cmdFlags->echo = true; in ParseCommandFlags()
746 out_cmdFlags->ignerr = false; in ParseCommandFlags()
747 out_cmdFlags->always = false; in ParseCommandFlags()
751 out_cmdFlags->echo = DEBUG(LOUD); in ParseCommandFlags()
752 else if (*p == '-') in ParseCommandFlags()
753 out_cmdFlags->ignerr = true; in ParseCommandFlags()
755 out_cmdFlags->always = true; in ParseCommandFlags()
767 /* Escape a string for a double-quoted string literal in sh, csh and ksh. */
769 EscapeShellDblQuot(const char *cmd) in EscapeShellDblQuot() argument
774 char *esc = bmake_malloc(strlen(cmd) * 2 + 1); in EscapeShellDblQuot()
775 for (i = 0, j = 0; cmd[i] != '\0'; i++, j++) { in EscapeShellDblQuot()
776 if (cmd[i] == '$' || cmd[i] == '`' || cmd[i] == '\\' || in EscapeShellDblQuot()
777 cmd[i] == '"') in EscapeShellDblQuot()
779 esc[j] = cmd[i]; in EscapeShellDblQuot()
791 (void)fprintf(wr->f, fmt, arg); in ShellWriter_WriteFmt()
792 if (wr->f == stdout) in ShellWriter_WriteFmt()
793 (void)fflush(wr->f); in ShellWriter_WriteFmt()
805 if (shell->hasEchoCtl) in ShellWriter_EchoOff()
806 ShellWriter_WriteLine(wr, shell->echoOff); in ShellWriter_EchoOff()
812 ShellWriter_WriteFmt(wr, shell->echoTmpl, escCmd); in ShellWriter_EchoCmd()
818 if (shell->hasEchoCtl) in ShellWriter_EchoOn()
819 ShellWriter_WriteLine(wr, shell->echoOn); in ShellWriter_EchoOn()
825 if (!wr->xtraced) { in ShellWriter_TraceOn()
826 ShellWriter_WriteLine(wr, "set -x"); in ShellWriter_TraceOn()
827 wr->xtraced = true; in ShellWriter_TraceOn()
836 ShellWriter_WriteLine(wr, shell->errOff); in ShellWriter_ErrOff()
846 ShellWriter_WriteLine(wr, shell->errOn); in ShellWriter_ErrOn()
852 * The shell has no built-in error control, so emulate error control by
861 job->ignerr = true; in JobWriteSpecialsEchoCtl()
863 if (job->echo && inout_cmdFlags->echo) { in JobWriteSpecialsEchoCtl()
871 inout_cmdFlags->echo = false; in JobWriteSpecialsEchoCtl()
873 *inout_cmdTemplate = shell->runIgnTmpl; in JobWriteSpecialsEchoCtl()
880 inout_cmdFlags->ignerr = false; in JobWriteSpecialsEchoCtl()
888 inout_cmdFlags->ignerr = false; in JobWriteSpecials()
889 else if (shell->hasErrCtl) in JobWriteSpecials()
890 ShellWriter_ErrOff(wr, job->echo && inout_cmdFlags->echo); in JobWriteSpecials()
891 else if (shell->runIgnTmpl != NULL && shell->runIgnTmpl[0] != '\0') { in JobWriteSpecials()
895 inout_cmdFlags->ignerr = false; in JobWriteSpecials()
901 * If the command starts with '@' and neither the -s nor the -n flag was
902 * given to make, stick a shell-specific echoOff command in the script.
904 * If the command starts with '-' and the shell has no error control (none
910 * XXX: The manual page says the '-' "affects the entire job", but that's not
911 * accurate. The '-' does not affect the commands before the '-'.
929 run = GNode_ShouldExecute(job->node); in JobWriteCommand()
931 xcmd = Var_SubstInTarget(ucmd, job->node); in JobWriteCommand()
939 /* The '+' command flag overrides the -n or -N options. */ in JobWriteCommand()
943 * but this one needs to be - use compat mode just for it. in JobWriteCommand()
945 (void)Compat_RunCommand(ucmd, job->node, ln); in JobWriteCommand()
955 escCmd = shell->hasErrCtl ? NULL : EscapeShellDblQuot(xcmd); in JobWriteCommand()
958 if (job->echo && run && shell->hasEchoCtl) in JobWriteCommand()
960 else if (shell->hasErrCtl) in JobWriteCommand()
974 if (!shell->hasErrCtl && shell->runChkTmpl != NULL && in JobWriteCommand()
975 shell->runChkTmpl[0] != '\0') { in JobWriteCommand()
976 if (job->echo && cmdFlags.echo) { in JobWriteCommand()
985 cmdTemplate = escCmd[0] == shell->commentChar || in JobWriteCommand()
987 ? shell->runIgnTmpl in JobWriteCommand()
988 : shell->runChkTmpl; in JobWriteCommand()
1001 ShellWriter_ErrOn(wr, cmdFlags.echo && job->echo); in JobWriteCommand()
1022 wr.f = job->cmdFILE; in JobWriteCommands()
1025 for (ln = job->node->commands.first; ln != NULL; ln = ln->next) { in JobWriteCommands()
1026 const char *cmd = ln->datum; in JobWriteCommands() local
1028 if (strcmp(cmd, "...") == 0) { in JobWriteCommands()
1029 job->node->type |= OP_SAVE_CMDS; in JobWriteCommands()
1030 job->tailCmds = ln->next; in JobWriteCommands()
1034 JobWriteCommand(job, &wr, ln, ln->datum); in JobWriteCommands()
1050 for (ln = job->tailCmds; ln != NULL; ln = ln->next) { in JobSaveCommands()
1051 const char *cmd = ln->datum; in JobSaveCommands() local
1056 * expand the other variables as well; see deptgt-end.mk. in JobSaveCommands()
1058 expanded_cmd = Var_SubstInTarget(cmd, job->node); in JobSaveCommands()
1060 Lst_Append(&Targ_GetEndNode()->commands, expanded_cmd); in JobSaveCommands()
1071 (void)close(job->outPipe); in JobClosePipes()
1072 job->outPipe = -1; in JobClosePipes()
1075 (void)close(job->inPipe); in JobClosePipes()
1076 job->inPipe = -1; in JobClosePipes()
1088 debug_printf("*** Failed target: %s\n", job->node->name); in DebugFailedJob()
1091 for (ln = job->node->commands.first; ln != NULL; ln = ln->next) { in DebugFailedJob()
1092 const char *cmd = ln->datum; in DebugFailedJob() local
1093 debug_printf("\t%s\n", cmd); in DebugFailedJob()
1095 if (strchr(cmd, '$') != NULL) { in DebugFailedJob()
1096 char *xcmd = Var_Subst(cmd, job->node, VARE_EVAL); in DebugFailedJob()
1106 SwitchOutputTo(job->node); in JobFinishDoneExitedError()
1109 meta_job_error(job, job->node, in JobFinishDoneExitedError()
1110 job->ignerr, WEXITSTATUS(*inout_status)); in JobFinishDoneExitedError()
1113 if (!shouldDieQuietly(job->node, -1)) { in JobFinishDoneExitedError()
1116 job->node->name, WEXITSTATUS(*inout_status), in JobFinishDoneExitedError()
1117 job->ignerr ? " (ignored)" : ""); in JobFinishDoneExitedError()
1120 if (job->ignerr) in JobFinishDoneExitedError()
1124 JobDeleteTarget(job->node); in JobFinishDoneExitedError()
1125 PrintOnError(job->node, "\n"); in JobFinishDoneExitedError()
1132 DEBUG2(JOB, "Process %d [%s] exited.\n", job->pid, job->node->name); in JobFinishDoneExited()
1137 SwitchOutputTo(job->node); in JobFinishDoneExited()
1139 job->node->name); in JobFinishDoneExited()
1146 SwitchOutputTo(job->node); in JobFinishDoneSignaled()
1148 (void)printf("*** [%s] Signal %d\n", job->node->name, WTERMSIG(status)); in JobFinishDoneSignaled()
1150 JobDeleteTarget(job->node); in JobFinishDoneSignaled()
1175 * status sub-why job went away
1183 job->pid, job->node->name, status); in JobFinish()
1186 ((WEXITSTATUS(status) != 0 && !job->ignerr))) || in JobFinish()
1191 if (job->cmdFILE != NULL && job->cmdFILE != stdout) { in JobFinish()
1192 if (fclose(job->cmdFILE) != 0) in JobFinish()
1194 job->node->name, strerror(errno)); in JobFinish()
1195 job->cmdFILE = NULL; in JobFinish()
1201 * Deal with ignored errors in -B mode. We need to print a in JobFinish()
1228 if (!job->special) { in JobFinish()
1238 * non-zero status that we shouldn't ignore, we call in JobFinish()
1242 job->node->made = MADE; in JobFinish()
1243 if (!job->special) in JobFinish()
1245 Make_Update(job->node); in JobFinish()
1246 job->status = JOB_ST_FREE; in JobFinish()
1249 job->status = JOB_ST_FREE; in JobFinish()
1292 while (write(fd, &c, 1) == -1 && errno == EAGAIN) in TouchRegular()
1299 * Touch the given target. Called by JobStart when the -t flag was given.
1307 if (gn->type & in Job_Touch()
1318 (void)fprintf(stdout, "touch %s\n", gn->name); in Job_Touch()
1325 if (gn->type & OP_ARCHV) in Job_Touch()
1327 else if (gn->type & OP_LIB) in Job_Touch()
1351 if (!Lst_IsEmpty(&gn->commands)) in Job_CheckCommands()
1353 if ((gn->type & OP_LIB) && !Lst_IsEmpty(&gn->children)) in Job_CheckCommands()
1360 if (defaultNode != NULL && !Lst_IsEmpty(&defaultNode->commands) && in Job_CheckCommands()
1361 !(gn->type & OP_SPECIAL)) { in Job_CheckCommands()
1377 if (gn->mtime != 0 || (gn->type & OP_SPECIAL)) in Job_CheckCommands()
1383 * nothing more we can do for this branch. If the -k flag wasn't in Job_CheckCommands()
1388 if (gn->flags.fromDepend) { in Job_CheckCommands()
1389 if (!Job_RunTarget(".STALE", gn->fname)) in Job_CheckCommands()
1392 progname, gn->fname, gn->lineno, makeDependfile, in Job_CheckCommands()
1393 gn->name); in Job_CheckCommands()
1397 if (gn->type & OP_OPTIONAL) { in Job_CheckCommands()
1399 progname, gn->name, "ignored"); in Job_CheckCommands()
1406 progname, gn->name, "continuing"); in Job_CheckCommands()
1411 abortProc("don't know how to make %s. Stop", gn->name); in Job_CheckCommands()
1429 debug_printf("Running %s\n", job->node->name); in JobExec()
1443 if (job->echo) in JobExec()
1444 SwitchOutputTo(job->node); in JobExec()
1449 /* Pre-emptively mark job running, pid still zero though */ in JobExec()
1450 job->status = JOB_ST_RUNNING; in JobExec()
1452 Var_ReexportVars(job->node); in JobExec()
1455 if (cpid == -1) in JobExec()
1479 * was marked close-on-exec, we must clear that bit in the in JobExec()
1482 if (dup2(fileno(job->cmdFILE), STDIN_FILENO) == -1) in JobExec()
1483 execDie("dup2", "job->cmdFILE"); in JobExec()
1484 if (fcntl(STDIN_FILENO, F_SETFD, 0) == -1) in JobExec()
1485 execDie("fcntl clear close-on-exec", "stdin"); in JobExec()
1486 if (lseek(STDIN_FILENO, 0, SEEK_SET) == -1) in JobExec()
1490 (job->node->type & (OP_MAKE | OP_SUBMAKE))) { in JobExec()
1492 if (fcntl(tokenWaitJob.inPipe, F_SETFD, 0) == -1) in JobExec()
1493 execDie("clear close-on-exec", in JobExec()
1495 if (fcntl(tokenWaitJob.outPipe, F_SETFD, 0) == -1) in JobExec()
1496 execDie("clear close-on-exec", in JobExec()
1504 if (dup2(job->outPipe, STDOUT_FILENO) == -1) in JobExec()
1505 execDie("dup2", "job->outPipe"); in JobExec()
1513 if (fcntl(STDOUT_FILENO, F_SETFD, 0) == -1) in JobExec()
1514 execDie("clear close-on-exec", "stdout"); in JobExec()
1515 if (dup2(STDOUT_FILENO, STDERR_FILENO) == -1) in JobExec()
1528 /* XXX: dsl - I'm sure this should be setpgrp()... */ in JobExec()
1540 job->pid = cpid; in JobExec()
1553 job->curPos = 0; in JobExec()
1557 if (job->cmdFILE != NULL && job->cmdFILE != stdout) { in JobExec()
1558 if (fclose(job->cmdFILE) != 0) in JobExec()
1560 job->node->name, strerror(errno)); in JobExec()
1561 job->cmdFILE = NULL; in JobExec()
1567 job->node->name, job->pid); in JobExec()
1583 if ((shell->errFlag != NULL && shell->errFlag[0] != '-') || in JobMakeArgv()
1584 (shell->echoFlag != NULL && shell->echoFlag[0] != '-')) { in JobMakeArgv()
1589 * Grrrr. Note the ten-character limitation on the combined in JobMakeArgv()
1595 (void)snprintf(args, sizeof args, "-%s%s", in JobMakeArgv()
1596 (job->ignerr ? "" : in JobMakeArgv()
1597 (shell->errFlag != NULL ? shell->errFlag : "")), in JobMakeArgv()
1598 (!job->echo ? "" : in JobMakeArgv()
1599 (shell->echoFlag != NULL ? shell->echoFlag : ""))); in JobMakeArgv()
1606 if (!job->ignerr && shell->errFlag != NULL) { in JobMakeArgv()
1607 argv[argc] = UNCONST(shell->errFlag); in JobMakeArgv()
1610 if (job->echo && shell->echoFlag != NULL) { in JobMakeArgv()
1611 argv[argc] = UNCONST(shell->echoFlag); in JobMakeArgv()
1631 job->cmdFILE = fdopen(tfd, "w+"); in JobWriteShellCommands()
1632 if (job->cmdFILE == NULL) in JobWriteShellCommands()
1635 (void)fcntl(fileno(job->cmdFILE), F_SETFD, FD_CLOEXEC); in JobWriteShellCommands()
1640 if (gn->type & OP_SILENT) /* might have changed */ in JobWriteShellCommands()
1641 job->echo = false; in JobWriteShellCommands()
1649 * Start a target-creation process going for the target described by gn.
1671 if (job->status == JOB_ST_FREE) in JobStart()
1678 job->node = gn; in JobStart()
1679 job->tailCmds = NULL; in JobStart()
1680 job->status = JOB_ST_SET_UP; in JobStart()
1682 job->special = special || gn->type & OP_SPECIAL; in JobStart()
1683 job->ignerr = opts.ignoreErrors || gn->type & OP_IGNORE; in JobStart()
1684 job->echo = !(opts.silent || gn->type & OP_SILENT); in JobStart()
1692 job->inPollfd = NULL; in JobStart()
1694 if (Lst_IsEmpty(&gn->commands)) { in JobStart()
1695 job->cmdFILE = stdout; in JobStart()
1706 } else if (((gn->type & OP_MAKE) && !opts.noRecursiveExecute) || in JobStart()
1725 (void)fflush(job->cmdFILE); in JobStart()
1729 * This still sets up job->tailCmds correctly. in JobStart()
1732 job->cmdFILE = stdout; in JobStart()
1736 (void)fflush(job->cmdFILE); in JobStart()
1738 Job_Touch(gn, job->echo); in JobStart()
1744 if (!job->special) in JobStart()
1747 if (job->cmdFILE != NULL && job->cmdFILE != stdout) { in JobStart()
1748 (void)fclose(job->cmdFILE); in JobStart()
1749 job->cmdFILE = NULL; in JobStart()
1758 job->node->made = MADE; in JobStart()
1759 Make_Update(job->node); in JobStart()
1761 job->status = JOB_ST_FREE; in JobStart()
1791 if (shell->noPrint == NULL || shell->noPrint[0] == '\0') in PrintFilteredOutput()
1795 * XXX: What happens if shell->noPrint occurs on the boundary of in PrintFilteredOutput()
1800 while ((ep = strstr(p, shell->noPrint)) != NULL) { in PrintFilteredOutput()
1813 p = ep + shell->noPrintLen; in PrintFilteredOutput()
1852 nRead = read(job->inPipe, &job->outBuf[job->curPos], in CollectOutput()
1853 JOB_BUFSIZE - job->curPos); in CollectOutput()
1867 * If we hit the end-of-file (the job is dead), we must flush its in CollectOutput()
1871 if (nr == 0 && job->curPos != 0) { in CollectOutput()
1872 job->outBuf[job->curPos] = '\n'; in CollectOutput()
1876 max = job->curPos + nr; in CollectOutput()
1877 for (i = job->curPos; i < max; i++) in CollectOutput()
1878 if (job->outBuf[i] == '\0') in CollectOutput()
1879 job->outBuf[i] = ' '; in CollectOutput()
1882 for (i = job->curPos + nr - 1; in CollectOutput()
1883 i >= job->curPos && i != (size_t)-1; i--) { in CollectOutput()
1884 if (job->outBuf[i] == '\n') { in CollectOutput()
1891 job->curPos += nr; in CollectOutput()
1892 if (job->curPos == JOB_BUFSIZE) { in CollectOutput()
1898 i = job->curPos; in CollectOutput()
1912 job->outBuf[i] = '\0'; in CollectOutput()
1913 if (i >= job->curPos) { in CollectOutput()
1922 p = PrintFilteredOutput(job->outBuf, &job->outBuf[i]); in CollectOutput()
1931 SwitchOutputTo(job->node); in CollectOutput()
1949 (void)memmove(job->outBuf, &job->outBuf[i + 1], in CollectOutput()
1950 max - (i + 1)); in CollectOutput()
1951 job->curPos = max - (i + 1); in CollectOutput()
1954 job->curPos = 0; in CollectOutput()
1960 * end-of-file on the pipe. This is guaranteed to happen in CollectOutput()
1976 * .INTERRUPT job in the parallel job module. As of 2020-09-25, in JobRun()
1977 * unit-tests/deptgt-end-jobs.mk hangs in an endless loop. in JobRun()
1993 if (targ->made == ERROR) { in JobRun()
2025 while ((pid = waitpid((pid_t)-1, &status, WNOHANG | WUNTRACED)) > 0) { in Job_CatchChildren()
2056 job->pid, job->node->name); in JobReapChild()
2061 job->node->name); in JobReapChild()
2065 job->node->name); in JobReapChild()
2068 (void)printf("*** [%s] Stopped -- signal %d\n", in JobReapChild()
2069 job->node->name, WSTOPSIG(status)); in JobReapChild()
2071 job->suspended = true; in JobReapChild()
2077 job->status = JOB_ST_FINISHED; in JobReapChild()
2078 job->exit_status = WAIT_STATUS(status); in JobReapChild()
2080 job->node->exit_status = WEXITSTATUS(status); in JobReapChild()
2102 nready = poll(fds + 1 - wantToken, fdsLen - 1 + wantToken, in Job_CatchOutput()
2124 nready--; in Job_CatchOutput()
2135 if (job->status == JOB_ST_RUNNING) in Job_CatchOutput()
2141 * than job->inPollfd. in Job_CatchOutput()
2143 if (useMeta && job->inPollfd != &fds[i]) { in Job_CatchOutput()
2148 if (--nready == 0) in Job_CatchOutput()
2154 * Start the creation of a target. Basically a front-end for JobStart used by
2166 shellName = shell->name; in InitShellNameAndPath()
2190 if (shell->errFlag == NULL) in Shell_Init()
2191 shell->errFlag = ""; in Shell_Init()
2192 if (shell->echoFlag == NULL) in Shell_Init()
2193 shell->echoFlag = ""; in Shell_Init()
2194 if (shell->hasErrCtl && shell->errFlag[0] != '\0') { in Shell_Init()
2196 strcmp(shell->errFlag, &shellErrFlag[1]) != 0) { in Shell_Init()
2201 shellErrFlag = str_concat2("-", shell->errFlag); in Shell_Init()
2215 return shell->newline; in Shell_GetNewline()
2224 Global_Set(".MAKE.JOB.PREFIX", "---"); in Job_SetPrefix()
2232 AddSig(int sig, SignalProc handler) in AddSig() argument
2234 if (bmake_signal(sig, SIG_IGN) != SIG_IGN) { in AddSig()
2235 sigaddset(&caught_signals, sig); in AddSig()
2236 (void)bmake_signal(sig, handler); in AddSig()
2262 * There is a non-zero chance that we already have children. in Job_Init()
2263 * eg after 'make -f- <<EOF' in Job_Init()
2272 rval = waitpid((pid_t)-1, &status, WNOHANG); in Job_Init()
2331 DelSig(int sig) in DelSig() argument
2333 if (sigismember(&caught_signals, sig) != 0) in DelSig()
2334 (void)bmake_signal(sig, SIG_DFL); in DelSig()
2360 if (strcmp(name, sh->name) == 0) in FindShellByName()
2384 * operator, followed by a series of blank-separated words. Double
2386 * anything (most notably a double-quote and a space) and
2439 for (path = NULL, argv = words; argc != 0; argc--, argv++) { in Job_ParseShell()
2465 * Before 2020-12-10, these two variables had in Job_ParseShell()
2472 * Before 2020-12-10, these two variables had in Job_ParseShell()
2494 * pre-defined shells, yes? So we find the one s/he wants in Job_ParseShell()
2543 if (shell->echoOn != NULL && shell->echoOff != NULL) in Job_ParseShell()
2544 shell->hasEchoCtl = true; in Job_ParseShell()
2546 if (!shell->hasErrCtl) { in Job_ParseShell()
2547 if (shell->echoTmpl == NULL) in Job_ParseShell()
2548 shell->echoTmpl = ""; in Job_ParseShell()
2549 if (shell->runIgnTmpl == NULL) in Job_ParseShell()
2550 shell->runIgnTmpl = "%s\n"; in Job_ParseShell()
2568 * runINTERRUPT Non-zero if commands for the .INTERRUPT target
2585 if (job->status != JOB_ST_RUNNING) in JobInterrupt()
2588 gn = job->node; in JobInterrupt()
2591 if (job->pid != 0) { in JobInterrupt()
2594 signo, job->pid); in JobInterrupt()
2595 KILLPG(job->pid, signo); in JobInterrupt()
2621 if (!Lst_IsEmpty(&endNode->commands) || in Job_Finish()
2622 !Lst_IsEmpty(&endNode->children)) { in Job_Finish()
2671 if (job->status != JOB_ST_RUNNING) in Job_AbortAll()
2677 KILLPG(job->pid, SIGINT); in Job_AbortAll()
2678 KILLPG(job->pid, SIGKILL); in Job_AbortAll()
2685 while (waitpid((pid_t)-1, &foo, WNOHANG) > 0) in Job_AbortAll()
2699 if (job->status == JOB_ST_RUNNING && in JobRestartJobs()
2700 (make_suspended || job->suspended)) { in JobRestartJobs()
2702 job->pid); in JobRestartJobs()
2703 if (job->suspended) { in JobRestartJobs()
2705 job->node->name); in JobRestartJobs()
2708 job->suspended = false; in JobRestartJobs()
2709 if (KILLPG(job->pid, SIGCONT) != 0 && DEBUG(JOB)) { in JobRestartJobs()
2711 job->pid); in JobRestartJobs()
2714 if (job->status == JOB_ST_FINISHED) { in JobRestartJobs()
2719 JobFinish(job, job->exit_status); in JobRestartJobs()
2728 if (job->inPollfd != NULL) in watchfd()
2731 fds[fdsLen].fd = job->inPipe; in watchfd()
2734 job->inPollfd = &fds[fdsLen]; in watchfd()
2739 fds[fdsLen].events = fds[fdsLen].fd == -1 ? 0 : POLLIN; in watchfd()
2750 if (job->inPollfd == NULL) in clearfd()
2752 i = (size_t)(job->inPollfd - fds); in clearfd()
2753 fdsLen--; in clearfd()
2762 Punt("odd-numbered fd with meta"); in clearfd()
2763 fdsLen--; in clearfd()
2770 jobByFdIndex[i]->inPollfd = &fds[i]; in clearfd()
2778 job->inPollfd = NULL; in clearfd()
2784 if (job->inPollfd == NULL) in readyfd()
2786 return (job->inPollfd->revents & POLLIN) != 0; in readyfd()
2810 while (write(tokenWaitJob.outPipe, &tok, 1) == -1 && errno == EAGAIN) in JobTokenAdd()
2851 Global_Append(MAKEFLAGS, "-J"); in Job_ServerStart()
2858 * XXX should clip maxJobs against PIPE_BUF -- if max_tokens is in Job_ServerStart()
2870 jobTokensRunning--; in Job_TokenReturn()
2911 /* make being aborted - remove any other job tokens */ in Job_TokenWithdraw()
2916 while (write(tokenWaitJob.outPipe, &tok, 1) == -1 && in Job_TokenWithdraw()
2927 while (write(tokenWaitJob.outPipe, &tok, 1) == -1 && in Job_TokenWithdraw()
2954 if (gn->made == ERROR) { in Job_RunTarget()
2973 maxfd = -1; in emul_poll()