Lines Matching +full:activity +full:- +full:signal +full:- +full:sources
102 * Job_Wait Wait for all currently-running jobs to finish.
124 #include <signal.h>
176 "set-up",
211 int exit_status; /* from wait4() in signal handler */
217 /* Ignore non-zero exits */
268 * The command-line flags "echo" and "exit" also control the behavior. The
278 * .SHELL target. For user-defined shells, this is the full path of
316 /* Run the command even in -n or -N mode. */
335 /* we've sent 'set -x' */
342 * pass jobs queue to sub-makes.
379 * name or the full path of a sh-compatible shell, which will be used as
404 * An sh-compatible shell with a non-standard name.
407 * non-portable features that might not be supplied by all
408 * sh-compatible shells.
449 /* XXX: -q is not really echoFlag, it's more like noEchoInSysFlag. */
463 "set -v", /* .echoOn */
493 "csh -c \"%s || exit 0\"\n", /* .runIgnTmpl */
531 static Job tokenPoolJob; /* token wait pseudo-job */
533 static Job childExitJob; /* child exit pseudo-job */
538 npseudojobs = 2 /* number of pseudo-jobs */
559 (void)fprintf(stdout, "%s %s ---\n", targPrefix, gn->name); in SwitchOutputTo()
576 job->ignerr ? 'i' : '-', in Job_FlagsToString()
577 !job->echo ? 's' : '-', in Job_FlagsToString()
578 job->special ? 'S' : '-'); in Job_FlagsToString()
585 return &job->bm; in Job_BuildMon()
592 return job->node; in Job_Node()
598 return job->pid; in Job_Pid()
611 (int)(job - job_table), JobStatus_Name[job->status], in DumpJobs()
612 flags, job->pid); in DumpJobs()
625 if (gn->type & OP_JOIN) in JobDeleteTarget()
627 if (gn->type & OP_PHONY) in JobDeleteTarget()
658 if (flags == -1) in SetNonblocking()
661 if (fcntl(fd, F_SETFL, flags) == -1) in SetNonblocking()
671 if (pipe(pipe_fds) == -1) in JobCreatePipe()
675 /* Avoid using low-numbered fds */ in JobCreatePipe()
677 if (fd != -1) { in JobCreatePipe()
683 job->inPipe = pipe_fds[0]; in JobCreatePipe()
684 job->outPipe = pipe_fds[1]; in JobCreatePipe()
686 if (fcntl(job->inPipe, F_SETFD, FD_CLOEXEC) == -1) in JobCreatePipe()
688 if (fcntl(job->outPipe, F_SETFD, FD_CLOEXEC) == -1) in JobCreatePipe()
692 * We mark the input side of the pipe non-blocking; we poll(2) the in JobCreatePipe()
697 SetNonblocking(job->inPipe); in JobCreatePipe()
700 /* Pass the signal to each running job. */
706 DEBUG1(JOB, "JobCondPassSig: signal %d\n", signo); in JobCondPassSig()
709 if (job->status != JOB_ST_RUNNING) in JobCondPassSig()
711 DEBUG2(JOB, "JobCondPassSig passing signal %d to pid %d\n", in JobCondPassSig()
712 signo, job->pid); in JobCondPassSig()
713 KILLPG(job->pid, signo); in JobCondPassSig()
739 * Pass a signal on to all jobs, then resend to ourselves.
740 * We die by the same signal.
750 * Pass a signal on to all jobs, then resend to ourselves.
751 * We die by the same signal.
769 /* Pass the signal onto every job */ in JobPassSig_suspend()
773 * Send ourselves the signal now we've given the message to everyone in JobPassSig_suspend()
775 * the signal. This ensures that all our jobs get continued when we in JobPassSig_suspend()
776 * wake up before we take any other signal. in JobPassSig_suspend()
787 DEBUG1(JOB, "JobPassSig_suspend passing signal %d to self\n", signo); in JobPassSig_suspend()
801 * events will have happened by then - and that the waitpid() will in JobPassSig_suspend()
809 /* Restore handler and signal mask */ in JobPassSig_suspend()
821 if (job->status == status && job->pid == pid) in JobFindPid()
829 /* Parse leading '@', '-' and '+', which control the exact execution mode. */
834 out_cmdFlags->echo = true; in ParseCommandFlags()
835 out_cmdFlags->ignerr = false; in ParseCommandFlags()
836 out_cmdFlags->always = false; in ParseCommandFlags()
840 out_cmdFlags->echo = DEBUG(LOUD); in ParseCommandFlags()
841 else if (*p == '-') in ParseCommandFlags()
842 out_cmdFlags->ignerr = true; in ParseCommandFlags()
844 out_cmdFlags->always = true; in ParseCommandFlags()
854 /* Escape a string for a double-quoted string literal in sh, csh and ksh. */
878 (void)fprintf(wr->f, fmt, arg); in ShellWriter_WriteFmt()
879 if (wr->f == stdout) in ShellWriter_WriteFmt()
880 (void)fflush(wr->f); in ShellWriter_WriteFmt()
892 if (shell->hasEchoCtl) in ShellWriter_EchoOff()
893 ShellWriter_WriteLine(wr, shell->echoOff); in ShellWriter_EchoOff()
899 ShellWriter_WriteFmt(wr, shell->echoTmpl, escCmd); in ShellWriter_EchoCmd()
905 if (shell->hasEchoCtl) in ShellWriter_EchoOn()
906 ShellWriter_WriteLine(wr, shell->echoOn); in ShellWriter_EchoOn()
912 if (!wr->xtraced) { in ShellWriter_TraceOn()
913 ShellWriter_WriteLine(wr, "set -x"); in ShellWriter_TraceOn()
914 wr->xtraced = true; in ShellWriter_TraceOn()
923 ShellWriter_WriteLine(wr, shell->errOff); in ShellWriter_ErrOff()
933 ShellWriter_WriteLine(wr, shell->errOn); in ShellWriter_ErrOn()
939 * The shell has no built-in error control, so emulate error control by
948 job->ignerr = true; in JobWriteSpecialsEchoCtl()
950 if (job->echo && inout_cmdFlags->echo) { in JobWriteSpecialsEchoCtl()
958 inout_cmdFlags->echo = false; in JobWriteSpecialsEchoCtl()
960 *inout_cmdTemplate = shell->runIgnTmpl; in JobWriteSpecialsEchoCtl()
967 inout_cmdFlags->ignerr = false; in JobWriteSpecialsEchoCtl()
975 inout_cmdFlags->ignerr = false; in JobWriteSpecials()
976 else if (shell->hasErrCtl) in JobWriteSpecials()
977 ShellWriter_ErrOff(wr, job->echo && inout_cmdFlags->echo); in JobWriteSpecials()
978 else if (shell->runIgnTmpl != NULL && shell->runIgnTmpl[0] != '\0') { in JobWriteSpecials()
982 inout_cmdFlags->ignerr = false; in JobWriteSpecials()
988 * If the command starts with '@' and neither the -s nor the -n flag was
989 * given to make, stick a shell-specific echoOff command in the script.
991 * If the command starts with '-' and the shell has no error control (none
1012 run = GNode_ShouldExecute(job->node); in JobWriteCommand()
1014 xcmd = Var_SubstInTarget(ucmd, job->node); in JobWriteCommand()
1022 /* The '+' command flag overrides the -n or -N options. */ in JobWriteCommand()
1026 * but this one needs to be - use compat mode just for it. in JobWriteCommand()
1028 (void)Compat_RunCommand(ucmd, job->node, ln); in JobWriteCommand()
1038 escCmd = shell->hasErrCtl ? NULL : EscapeShellDblQuot(xcmd); in JobWriteCommand()
1041 if (job->echo && run && shell->hasEchoCtl) in JobWriteCommand()
1043 else if (shell->hasErrCtl) in JobWriteCommand()
1057 if (!shell->hasErrCtl && shell->runChkTmpl != NULL && in JobWriteCommand()
1058 shell->runChkTmpl[0] != '\0') { in JobWriteCommand()
1059 if (job->echo && cmdFlags.echo) { in JobWriteCommand()
1068 cmdTemplate = escCmd[0] == shell->commentChar || in JobWriteCommand()
1070 ? shell->runIgnTmpl in JobWriteCommand()
1071 : shell->runChkTmpl; in JobWriteCommand()
1084 ShellWriter_ErrOn(wr, cmdFlags.echo && job->echo); in JobWriteCommand()
1105 wr.f = job->cmdFILE; in JobWriteCommands()
1108 for (ln = job->node->commands.first; ln != NULL; ln = ln->next) { in JobWriteCommands()
1109 const char *cmd = ln->datum; in JobWriteCommands()
1112 job->node->type |= OP_SAVE_CMDS; in JobWriteCommands()
1113 job->tailCmds = ln->next; in JobWriteCommands()
1117 JobWriteCommand(job, &wr, ln, ln->datum); in JobWriteCommands()
1133 for (ln = job->tailCmds; ln != NULL; ln = ln->next) { in JobSaveCommands()
1134 const char *cmd = ln->datum; in JobSaveCommands()
1139 * expand the other variables as well; see deptgt-end.mk. in JobSaveCommands()
1141 expanded_cmd = Var_SubstInTarget(cmd, job->node); in JobSaveCommands()
1143 Lst_Append(&Targ_GetEndNode()->commands, expanded_cmd); in JobSaveCommands()
1154 (void)close(job->outPipe); in JobClosePipes()
1155 job->outPipe = -1; in JobClosePipes()
1158 (void)close(job->inPipe); in JobClosePipes()
1159 job->inPipe = -1; in JobClosePipes()
1171 debug_printf("*** Failed target: %s\n", job->node->name); in DebugFailedJob()
1174 for (ln = job->node->commands.first; ln != NULL; ln = ln->next) { in DebugFailedJob()
1175 const char *cmd = ln->datum; in DebugFailedJob()
1179 char *xcmd = Var_Subst(cmd, job->node, VARE_EVAL); in DebugFailedJob()
1189 SwitchOutputTo(job->node); in JobFinishDoneExitedError()
1192 meta_job_error(job, job->node, in JobFinishDoneExitedError()
1193 job->ignerr, WEXITSTATUS(*inout_status)); in JobFinishDoneExitedError()
1196 if (!shouldDieQuietly(job->node, -1)) { in JobFinishDoneExitedError()
1199 job->node->name, WEXITSTATUS(*inout_status), in JobFinishDoneExitedError()
1200 job->ignerr ? " (ignored)" : ""); in JobFinishDoneExitedError()
1203 if (job->ignerr) in JobFinishDoneExitedError()
1207 JobDeleteTarget(job->node); in JobFinishDoneExitedError()
1208 PrintOnError(job->node, "\n"); in JobFinishDoneExitedError()
1216 job->node->name, job->pid); in JobFinishDoneExited()
1221 SwitchOutputTo(job->node); in JobFinishDoneExited()
1223 job->node->name, job->pid); in JobFinishDoneExited()
1230 SwitchOutputTo(job->node); in JobFinishDoneSignaled()
1232 (void)printf("*** [%s] Signal %d\n", job->node->name, WTERMSIG(status)); in JobFinishDoneSignaled()
1234 JobDeleteTarget(job->node); in JobFinishDoneSignaled()
1258 job->node->name, job->pid, status); in JobFinish()
1261 ((WEXITSTATUS(status) != 0 && !job->ignerr))) || in JobFinish()
1266 if (job->cmdFILE != NULL && job->cmdFILE != stdout) { in JobFinish()
1267 if (fclose(job->cmdFILE) != 0) in JobFinish()
1269 job->node->name, strerror(errno)); in JobFinish()
1270 job->cmdFILE = NULL; in JobFinish()
1276 * Deal with ignored errors in -B mode. We need to print a in JobFinish()
1303 if (!job->special) { in JobFinish()
1312 job->node->made = MADE; in JobFinish()
1313 if (!job->special) in JobFinish()
1315 Make_Update(job->node); in JobFinish()
1316 job->status = JOB_ST_FREE; in JobFinish()
1319 job->status = JOB_ST_FREE; in JobFinish()
1331 if (shouldDieQuietly(NULL, -1)) in JobFinish()
1365 while (write(fd, &c, 1) == -1 && errno == EAGAIN) in TouchRegular()
1372 * Touch the given target. Called by Job_Make when the -t flag was given.
1380 if (gn->type & in Job_Touch()
1391 (void)fprintf(stdout, "touch %s\n", gn->name); in Job_Touch()
1398 if (gn->type & OP_ARCHV) in Job_Touch()
1400 else if (gn->type & OP_LIB) in Job_Touch()
1424 if (!Lst_IsEmpty(&gn->commands)) in Job_CheckCommands()
1426 if ((gn->type & OP_LIB) && !Lst_IsEmpty(&gn->children)) in Job_CheckCommands()
1433 if (defaultNode != NULL && !Lst_IsEmpty(&defaultNode->commands) && in Job_CheckCommands()
1434 !(gn->type & OP_SPECIAL)) { in Job_CheckCommands()
1441 * gn also inherits any attributes or sources attached to in Job_CheckCommands()
1450 if (gn->mtime != 0 || (gn->type & OP_SPECIAL)) in Job_CheckCommands()
1456 * nothing more we can do for this branch. If the -k flag wasn't in Job_CheckCommands()
1461 if (gn->flags.fromDepend) { in Job_CheckCommands()
1462 if (!Job_RunTarget(".STALE", gn->fname)) in Job_CheckCommands()
1465 progname, gn->fname, gn->lineno, makeDependfile, in Job_CheckCommands()
1466 gn->name); in Job_CheckCommands()
1470 if (gn->type & OP_OPTIONAL) { in Job_CheckCommands()
1472 progname, gn->name, "ignored"); in Job_CheckCommands()
1479 progname, gn->name, "continuing"); in Job_CheckCommands()
1484 abortProc("don't know how to make %s. Stop", gn->name); in Job_CheckCommands()
1502 debug_printf("Running %s\n", job->node->name); in JobExec()
1516 if (job->echo) in JobExec()
1517 SwitchOutputTo(job->node); in JobExec()
1522 /* Pre-emptively mark job running, pid still zero though */ in JobExec()
1523 job->status = JOB_ST_RUNNING; in JobExec()
1525 Var_ReexportVars(job->node); in JobExec()
1526 Var_ExportStackTrace(job->node->name, NULL); in JobExec()
1529 if (cpid == -1) in JobExec()
1541 * Reset all signal handlers; this is necessary because we in JobExec()
1549 if (dup2(fileno(job->cmdFILE), STDIN_FILENO) == -1) in JobExec()
1550 execDie("dup2", "job->cmdFILE"); in JobExec()
1551 if (fcntl(STDIN_FILENO, F_SETFD, 0) == -1) in JobExec()
1552 execDie("clear close-on-exec", "stdin"); in JobExec()
1553 if (lseek(STDIN_FILENO, 0, SEEK_SET) == -1) in JobExec()
1557 (job->node->type & (OP_MAKE | OP_SUBMAKE))) { in JobExec()
1559 if (fcntl(tokenPoolJob.inPipe, F_SETFD, 0) == -1) in JobExec()
1560 execDie("clear close-on-exec", in JobExec()
1562 if (fcntl(tokenPoolJob.outPipe, F_SETFD, 0) == -1) in JobExec()
1563 execDie("clear close-on-exec", in JobExec()
1567 if (dup2(job->outPipe, STDOUT_FILENO) == -1) in JobExec()
1568 execDie("dup2", "job->outPipe"); in JobExec()
1576 if (fcntl(STDOUT_FILENO, F_SETFD, 0) == -1) in JobExec()
1577 execDie("clear close-on-exec", "stdout"); in JobExec()
1578 if (dup2(STDOUT_FILENO, STDERR_FILENO) == -1) in JobExec()
1591 /* XXX: dsl - I'm sure this should be setpgrp()... */ in JobExec()
1603 job->pid = cpid; in JobExec()
1612 job->outBufLen = 0; in JobExec()
1616 if (job->cmdFILE != NULL && job->cmdFILE != stdout) { in JobExec()
1617 if (fclose(job->cmdFILE) != 0) in JobExec()
1619 job->node->name, strerror(errno)); in JobExec()
1620 job->cmdFILE = NULL; in JobExec()
1626 job->node->name, job->pid); in JobExec()
1641 if ((shell->errFlag != NULL && shell->errFlag[0] != '-') || in BuildArgv()
1642 (shell->echoFlag != NULL && shell->echoFlag[0] != '-')) { in BuildArgv()
1647 * Grrrr. Note the ten-character limitation on the combined in BuildArgv()
1653 (void)snprintf(args, sizeof args, "-%s%s", in BuildArgv()
1654 !job->ignerr && shell->errFlag != NULL in BuildArgv()
1655 ? shell->errFlag : "", in BuildArgv()
1656 job->echo && shell->echoFlag != NULL in BuildArgv()
1657 ? shell->echoFlag : ""); in BuildArgv()
1663 if (!job->ignerr && shell->errFlag != NULL) { in BuildArgv()
1664 argv[argc] = UNCONST(shell->errFlag); in BuildArgv()
1667 if (job->echo && shell->echoFlag != NULL) { in BuildArgv()
1668 argv[argc] = UNCONST(shell->echoFlag); in BuildArgv()
1683 job->cmdFILE = fdopen(fd, "w+"); in JobWriteShellCommands()
1684 if (job->cmdFILE == NULL) in JobWriteShellCommands()
1692 if (gn->type & OP_SILENT) /* might have changed */ in JobWriteShellCommands()
1693 job->echo = false; in JobWriteShellCommands()
1709 if (job->status == JOB_ST_FREE) in Job_Make()
1716 job->node = gn; in Job_Make()
1717 job->tailCmds = NULL; in Job_Make()
1718 job->status = JOB_ST_SET_UP; in Job_Make()
1720 job->special = (gn->type & OP_SPECIAL) != OP_NONE; in Job_Make()
1721 job->ignerr = opts.ignoreErrors || gn->type & OP_IGNORE; in Job_Make()
1722 job->echo = !(opts.silent || gn->type & OP_SILENT); in Job_Make()
1730 job->inPollfd = NULL; in Job_Make()
1732 if (Lst_IsEmpty(&gn->commands)) { in Job_Make()
1733 job->cmdFILE = stdout; in Job_Make()
1740 } else if (((gn->type & OP_MAKE) && !opts.noRecursiveExecute) || in Job_Make()
1753 (void)fflush(job->cmdFILE); in Job_Make()
1756 job->cmdFILE = stdout; in Job_Make()
1760 (void)fflush(job->cmdFILE); in Job_Make()
1762 Job_Touch(gn, job->echo); in Job_Make()
1767 if (!job->special) in Job_Make()
1770 if (job->cmdFILE != NULL && job->cmdFILE != stdout) { in Job_Make()
1771 (void)fclose(job->cmdFILE); in Job_Make()
1772 job->cmdFILE = NULL; in Job_Make()
1777 job->node->made = MADE; in Job_Make()
1778 Make_Update(job->node); in Job_Make()
1780 job->status = JOB_ST_FREE; in Job_Make()
1800 const char *p = job->outBuf, *ep, *endp; in PrintFilteredOutput()
1802 if (shell->noPrint == NULL || shell->noPrint[0] == '\0') in PrintFilteredOutput()
1806 while ((ep = strstr(p, shell->noPrint)) != NULL && ep < endp) { in PrintFilteredOutput()
1809 SwitchOutputTo(job->node); in PrintFilteredOutput()
1810 (void)fwrite(p, 1, (size_t)(ep - p), stdout); in PrintFilteredOutput()
1813 p = ep + shell->noPrintLen; in PrintFilteredOutput()
1840 nr = (size_t)read(job->inPipe, job->outBuf + job->outBufLen, in CollectOutput()
1841 JOB_BUFSIZE - job->outBufLen); in CollectOutput()
1842 if (nr == (size_t)-1) { in CollectOutput()
1853 if (nr == 0 && job->outBufLen > 0) { in CollectOutput()
1854 job->outBuf[job->outBufLen] = '\n'; in CollectOutput()
1858 max = job->outBufLen + nr; in CollectOutput()
1859 job->outBuf[max] = '\0'; in CollectOutput()
1861 for (i = job->outBufLen; i < max; i++) in CollectOutput()
1862 if (job->outBuf[i] == '\0') in CollectOutput()
1863 job->outBuf[i] = ' '; in CollectOutput()
1865 for (i = max; i > job->outBufLen; i--) in CollectOutput()
1866 if (job->outBuf[i - 1] == '\n') in CollectOutput()
1869 if (i == job->outBufLen) { in CollectOutput()
1870 job->outBufLen = max; in CollectOutput()
1879 SwitchOutputTo(job->node); in CollectOutput()
1884 (void)fwrite(p, 1, (size_t)(job->outBuf + i - p), stdout); in CollectOutput()
1887 memmove(job->outBuf, job->outBuf + i, max - i); in CollectOutput()
1888 job->outBufLen = max - i; in CollectOutput()
1918 while ((pid = waitpid((pid_t)-1, &status, WNOHANG | WUNTRACED)) > 0) { in Job_CatchChildren()
1948 job->node->name, job->pid); in JobReapChild()
1953 job->node->name); in JobReapChild()
1957 job->node->name); in JobReapChild()
1960 (void)printf("*** [%s] Stopped -- signal %d\n", in JobReapChild()
1961 job->node->name, WSTOPSIG(status)); in JobReapChild()
1963 job->suspended = true; in JobReapChild()
1969 job->status = JOB_ST_FINISHED; in JobReapChild()
1970 job->exit_status = WAIT_STATUS(status); in JobReapChild()
1972 job->node->exit_status = WEXITSTATUS(status); in JobReapChild()
1980 DEBUG1(JOB, "Continuing pid %d\n", job->pid); in Job_Continue()
1981 if (job->suspended) { in Job_Continue()
1982 (void)printf("*** [%s] Continued\n", job->node->name); in Job_Continue()
1984 job->suspended = false; in Job_Continue()
1986 if (KILLPG(job->pid, SIGCONT) != 0) in Job_Continue()
1987 DEBUG1(JOB, "Failed to send SIGCONT to pid %d\n", job->pid); in Job_Continue()
1996 if (job->status == JOB_ST_RUNNING && in ContinueJobs()
1997 (make_suspended || job->suspended)) in ContinueJobs()
1999 else if (job->status == JOB_ST_FINISHED) in ContinueJobs()
2000 JobFinish(job, job->exit_status); in ContinueJobs()
2017 nready = poll(fds + skip, fdsLen - skip, -1); in Job_CatchOutput()
2023 if (nready > 0 && childExitJob.inPollfd->revents & POLLIN) { in Job_CatchOutput()
2031 nready--; in Job_CatchOutput()
2042 if (job->status == JOB_ST_RUNNING) in Job_CatchOutput()
2046 * With meta mode, we may have activity on the job's filemon in Job_CatchOutput()
2048 * than job->inPollfd. in Job_CatchOutput()
2050 if (useMeta && job->inPollfd != &fds[i]) { in Job_CatchOutput()
2055 if (--nready == 0) in Job_CatchOutput()
2063 shellName = shell->name; in InitShellNameAndPath()
2087 if (shell->errFlag == NULL) in Shell_Init()
2088 shell->errFlag = ""; in Shell_Init()
2089 if (shell->echoFlag == NULL) in Shell_Init()
2090 shell->echoFlag = ""; in Shell_Init()
2091 if (shell->hasErrCtl && shell->errFlag[0] != '\0') { in Shell_Init()
2093 strcmp(shell->errFlag, &shellErrFlag[1]) != 0) { in Shell_Init()
2098 shellErrFlag = str_concat2("-", shell->errFlag); in Shell_Init()
2109 return shell->newline; in Shell_GetNewline()
2118 Global_Set(".MAKE.JOB.PREFIX", "---"); in Job_SetPrefix()
2155 * There is a non-zero chance that we already have children, in Job_Init()
2156 * e.g. after 'make -f- <<EOF'. in Job_Init()
2165 rval = waitpid((pid_t)-1, &status, WNOHANG); in Job_Init()
2243 if (strcmp(name, sh->name) == 0) in FindShellByName()
2265 * anything (most notably a double-quote and a space) and
2316 for (path = NULL, argv = words; argc != 0; argc--, argv++) { in Job_ParseShell()
2342 * Before 2020-12-10, these two variables had in Job_ParseShell()
2349 * Before 2020-12-10, these two variables had in Job_ParseShell()
2410 if (shell->echoOn != NULL && shell->echoOff != NULL) in Job_ParseShell()
2411 shell->hasEchoCtl = true; in Job_ParseShell()
2413 if (!shell->hasErrCtl) { in Job_ParseShell()
2414 if (shell->echoTmpl == NULL) in Job_ParseShell()
2415 shell->echoTmpl = ""; in Job_ParseShell()
2416 if (shell->runIgnTmpl == NULL) in Job_ParseShell()
2417 shell->runIgnTmpl = "%s\n"; in Job_ParseShell()
2429 * After receiving an interrupt signal, terminate all child processes and if
2444 if (job->status == JOB_ST_RUNNING && job->pid != 0) { in JobInterrupt()
2446 "JobInterrupt passing signal %d to child %d.\n", in JobInterrupt()
2447 signo, job->pid); in JobInterrupt()
2448 KILLPG(job->pid, signo); in JobInterrupt()
2453 if (job->status == JOB_ST_RUNNING && job->pid != 0) { in JobInterrupt()
2455 (void)waitpid(job->pid, &status, 0); in JobInterrupt()
2456 JobDeleteTarget(job->node); in JobInterrupt()
2473 /* Make the .END target, returning the number of job-related errors. */
2478 if (!Lst_IsEmpty(&endNode->commands) || in Job_Finish()
2479 !Lst_IsEmpty(&endNode->children)) { in Job_Finish()
2521 if (job->status != JOB_ST_RUNNING) in Job_AbortAll()
2523 KILLPG(job->pid, SIGINT); in Job_AbortAll()
2524 KILLPG(job->pid, SIGKILL); in Job_AbortAll()
2528 while (waitpid((pid_t)-1, &status, WNOHANG) > 0) in Job_AbortAll()
2535 if (job->inPollfd != NULL) in watchfd()
2538 fds[fdsLen].fd = job->inPipe; in watchfd()
2541 job->inPollfd = &fds[fdsLen]; in watchfd()
2546 fds[fdsLen].events = fds[fdsLen].fd == -1 ? 0 : POLLIN; in watchfd()
2557 if (job->inPollfd == NULL) in clearfd()
2559 i = (size_t)(job->inPollfd - fds); in clearfd()
2560 fdsLen--; in clearfd()
2565 Punt("odd-numbered fd with meta"); in clearfd()
2566 fdsLen--; in clearfd()
2573 jobByFdIndex[i]->inPollfd = &fds[i]; in clearfd()
2581 job->inPollfd = NULL; in clearfd()
2656 Global_Append(MAKEFLAGS, "-J"); in TokenPool_InitServer()
2681 jobTokensRunning--; in TokenPool_Return()
2723 /* make being aborted - remove any other job tokens */ in TokenPool_Take()
2774 maxfd = -1; in emul_poll()