| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: job.c,v 1.16 2015/05/19 22:01:19 joerg Exp $ */ | | 1 | /* $NetBSD: job.c,v 1.17 2018/09/10 10:16:58 schmonz Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. | | 4 | * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to Berkeley by | | 7 | * This code is derived from software contributed to Berkeley by |
8 | * Adam de Boor. | | 8 | * Adam de Boor. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -60,34 +60,34 @@ | | | @@ -60,34 +60,34 @@ |
60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | | 60 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
61 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 61 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 62 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 63 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 64 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
65 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 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 | | 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 | | 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 | | 68 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
69 | * SUCH DAMAGE. | | 69 | * SUCH DAMAGE. |
70 | */ | | 70 | */ |
71 | | | 71 | |
72 | #ifndef MAKE_NATIVE | | 72 | #ifndef MAKE_NATIVE |
73 | static char rcsid[] = "$NetBSD: job.c,v 1.16 2015/05/19 22:01:19 joerg Exp $"; | | 73 | static char rcsid[] = "$NetBSD: job.c,v 1.17 2018/09/10 10:16:58 schmonz Exp $"; |
74 | #else | | 74 | #else |
75 | #include <sys/cdefs.h> | | 75 | #include <sys/cdefs.h> |
76 | #ifndef lint | | 76 | #ifndef lint |
77 | #if 0 | | 77 | #if 0 |
78 | static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; | | 78 | static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; |
79 | #else | | 79 | #else |
80 | __RCSID("$NetBSD: job.c,v 1.16 2015/05/19 22:01:19 joerg Exp $"); | | 80 | __RCSID("$NetBSD: job.c,v 1.17 2018/09/10 10:16:58 schmonz Exp $"); |
81 | #endif | | 81 | #endif |
82 | #endif /* not lint */ | | 82 | #endif /* not lint */ |
83 | #endif | | 83 | #endif |
84 | | | 84 | |
85 | /*- | | 85 | /*- |
86 | * job.c -- | | 86 | * job.c -- |
87 | * handle the creation etc. of our child processes. | | 87 | * handle the creation etc. of our child processes. |
88 | * | | 88 | * |
89 | * Interface: | | 89 | * Interface: |
90 | * Job_Make Start the creation of the given target. | | 90 | * Job_Make Start the creation of the given target. |
91 | * | | 91 | * |
92 | * Job_CatchChildren Check for and handle the termination of any | | 92 | * Job_CatchChildren Check for and handle the termination of any |
93 | * children. This must be called reasonably | | 93 | * children. This must be called reasonably |
| @@ -364,27 +364,29 @@ static void JobClose(Job *); | | | @@ -364,27 +364,29 @@ static void JobClose(Job *); |
364 | static void JobExec(Job *, char **); | | 364 | static void JobExec(Job *, char **); |
365 | static void JobMakeArgv(Job *, char **); | | 365 | static void JobMakeArgv(Job *, char **); |
366 | static int JobStart(GNode *, int); | | 366 | static int JobStart(GNode *, int); |
367 | static char *JobOutput(Job *, char *, char *, int); | | 367 | static char *JobOutput(Job *, char *, char *, int); |
368 | static void JobDoOutput(Job *, Boolean); | | 368 | static void JobDoOutput(Job *, Boolean); |
369 | static Shell *JobMatchShell(const char *); | | 369 | static Shell *JobMatchShell(const char *); |
370 | static void JobInterrupt(int, int) MAKE_ATTR_DEAD; | | 370 | static void JobInterrupt(int, int) MAKE_ATTR_DEAD; |
371 | static void JobRestartJobs(void); | | 371 | static void JobRestartJobs(void); |
372 | static void JobTokenAdd(void); | | 372 | static void JobTokenAdd(void); |
373 | static void JobSigLock(sigset_t *); | | 373 | static void JobSigLock(sigset_t *); |
374 | static void JobSigUnlock(sigset_t *); | | 374 | static void JobSigUnlock(sigset_t *); |
375 | static void JobSigReset(void); | | 375 | static void JobSigReset(void); |
376 | | | 376 | |
| | | 377 | #if defined(__NetBSD__) |
377 | const char *malloc_options="A"; | | 378 | const char *malloc_options="A"; |
| | | 379 | #endif |
378 | | | 380 | |
379 | static void | | 381 | static void |
380 | job_table_dump(const char *where) | | 382 | job_table_dump(const char *where) |
381 | { | | 383 | { |
382 | Job *job; | | 384 | Job *job; |
383 | | | 385 | |
384 | fprintf(debug_file, "job table @ %s\n", where); | | 386 | fprintf(debug_file, "job table @ %s\n", where); |
385 | for (job = job_table; job < job_table_end; job++) { | | 387 | for (job = job_table; job < job_table_end; job++) { |
386 | fprintf(debug_file, "job %d, status %d, flags %d, pid %d\n", | | 388 | fprintf(debug_file, "job %d, status %d, flags %d, pid %d\n", |
387 | (int)(job - job_table), job->job_state, job->flags, job->pid); | | 389 | (int)(job - job_table), job->job_state, job->flags, job->pid); |
388 | } | | 390 | } |
389 | } | | 391 | } |
390 | | | 392 | |