PR/45042: Thomas Cort: Minix support: handle missing setpgid and setrlimitdiff -r1.11 -r1.12 pkgsrc/devel/bmake/files/configure.in
(christos)
@@ -1,16 +1,16 @@ | @@ -1,16 +1,16 @@ | |||
1 | dnl | 1 | dnl | |
2 | dnl RCSid: | 2 | dnl RCSid: | |
3 | dnl $Id: configure.in,v 1.11 2011/06/18 22:39:46 bsiegert Exp $ | 3 | dnl $Id: configure.in,v 1.12 2013/02/26 00:50:14 christos Exp $ | |
4 | dnl | 4 | dnl | |
5 | dnl Process this file with autoconf to produce a configure script | 5 | dnl Process this file with autoconf to produce a configure script | |
6 | dnl | 6 | dnl | |
7 | AC_INIT([bmake], [2010505], [sjg@NetBSD.org]) | 7 | AC_INIT([bmake], [2010505], [sjg@NetBSD.org]) | |
8 | AC_CONFIG_HEADER(config.h) | 8 | AC_CONFIG_HEADER(config.h) | |
9 | 9 | |||
10 | dnl | 10 | dnl | |
11 | AC_ARG_WITH(defshell, | 11 | AC_ARG_WITH(defshell, | |
12 | [ --with-defshell=SHELL use SHELL by default - must be sh compatible, use sh or ksh to pick the internal definitions], | 12 | [ --with-defshell=SHELL use SHELL by default - must be sh compatible, use sh or ksh to pick the internal definitions], | |
13 | [case "${withval}" in | 13 | [case "${withval}" in | |
14 | yes) AC_MSG_ERROR(bad value ${withval} given for bmake DEFSHELL) ;; | 14 | yes) AC_MSG_ERROR(bad value ${withval} given for bmake DEFSHELL) ;; | |
15 | no) ;; | 15 | no) ;; | |
16 | *) case "$with_defshell" in | 16 | *) case "$with_defshell" in | |
@@ -133,26 +133,28 @@ AC_FUNC_WAIT3 | @@ -133,26 +133,28 @@ AC_FUNC_WAIT3 | |||
133 | dnl Keep this list sorted | 133 | dnl Keep this list sorted | |
134 | AC_CHECK_FUNCS( \ | 134 | AC_CHECK_FUNCS( \ | |
135 | err \ | 135 | err \ | |
136 | errx \ | 136 | errx \ | |
137 | getcwd \ | 137 | getcwd \ | |
138 | getenv \ | 138 | getenv \ | |
139 | getopt \ | 139 | getopt \ | |
140 | getwd \ | 140 | getwd \ | |
141 | killpg \ | 141 | killpg \ | |
142 | mmap \ | 142 | mmap \ | |
143 | putenv \ | 143 | putenv \ | |
144 | select \ | 144 | select \ | |
145 | setenv \ | 145 | setenv \ | |
146 | setpgid \ | |||
147 | setrlimit \ | |||
146 | sigaction \ | 148 | sigaction \ | |
147 | sigvec \ | 149 | sigvec \ | |
148 | snprintf \ | 150 | snprintf \ | |
149 | strerror \ | 151 | strerror \ | |
150 | strftime \ | 152 | strftime \ | |
151 | strsep \ | 153 | strsep \ | |
152 | strtod \ | 154 | strtod \ | |
153 | strtol \ | 155 | strtol \ | |
154 | unsetenv \ | 156 | unsetenv \ | |
155 | vsnprintf \ | 157 | vsnprintf \ | |
156 | wait3 \ | 158 | wait3 \ | |
157 | wait4 \ | 159 | wait4 \ | |
158 | waitpid \ | 160 | waitpid \ |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: main.c,v 1.11 2011/06/18 22:39:46 bsiegert Exp $ */ | 1 | /* $NetBSD: main.c,v 1.12 2013/02/26 00:50:14 christos Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1988, 1989, 1990, 1993 | 4 | * Copyright (c) 1988, 1989, 1990, 1993 | |
5 | * The Regents of the University of California. All rights reserved. | 5 | * The Regents of the University of California. 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. | |
@@ -59,39 +59,39 @@ | @@ -59,39 +59,39 @@ | |||
59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 59 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 60 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 61 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 62 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
68 | * SUCH DAMAGE. | 68 | * SUCH DAMAGE. | |
69 | */ | 69 | */ | |
70 | 70 | |||
71 | #ifndef MAKE_NATIVE | 71 | #ifndef MAKE_NATIVE | |
72 | static char rcsid[] = "$NetBSD: main.c,v 1.11 2011/06/18 22:39:46 bsiegert Exp $"; | 72 | static char rcsid[] = "$NetBSD: main.c,v 1.12 2013/02/26 00:50:14 christos Exp $"; | |
73 | #else | 73 | #else | |
74 | #include <sys/cdefs.h> | 74 | #include <sys/cdefs.h> | |
75 | #ifndef lint | 75 | #ifndef lint | |
76 | __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\ | 76 | __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\ | |
77 | The Regents of the University of California. All rights reserved."); | 77 | The Regents of the University of California. All rights reserved."); | |
78 | #endif /* not lint */ | 78 | #endif /* not lint */ | |
79 | 79 | |||
80 | #ifndef lint | 80 | #ifndef lint | |
81 | #if 0 | 81 | #if 0 | |
82 | static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; | 82 | static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; | |
83 | #else | 83 | #else | |
84 | __RCSID("$NetBSD: main.c,v 1.11 2011/06/18 22:39:46 bsiegert Exp $"); | 84 | __RCSID("$NetBSD: main.c,v 1.12 2013/02/26 00:50:14 christos Exp $"); | |
85 | #endif | 85 | #endif | |
86 | #endif /* not lint */ | 86 | #endif /* not lint */ | |
87 | #endif | 87 | #endif | |
88 | 88 | |||
89 | /*- | 89 | /*- | |
90 | * main.c -- | 90 | * main.c -- | |
91 | * The main file for this entire program. Exit routines etc | 91 | * The main file for this entire program. Exit routines etc | |
92 | * reside here. | 92 | * reside here. | |
93 | * | 93 | * | |
94 | * Utility functions defined in this file: | 94 | * Utility functions defined in this file: | |
95 | * Main_ParseArgLine Takes a line of arguments, breaks them and | 95 | * Main_ParseArgLine Takes a line of arguments, breaks them and | |
96 | * treats them as if they were given when first | 96 | * treats them as if they were given when first | |
97 | * invoked. Used by the parse module to implement | 97 | * invoked. Used by the parse module to implement | |
@@ -822,27 +822,27 @@ main(int argc, char **argv) | @@ -822,27 +822,27 @@ main(int argc, char **argv) | |||
822 | (void)bmake_signal(SIGINFO, siginfo); | 822 | (void)bmake_signal(SIGINFO, siginfo); | |
823 | #endif | 823 | #endif | |
824 | /* | 824 | /* | |
825 | * Set the seed to produce a different random sequence | 825 | * Set the seed to produce a different random sequence | |
826 | * on each program execution. | 826 | * on each program execution. | |
827 | */ | 827 | */ | |
828 | gettimeofday(&rightnow, NULL); | 828 | gettimeofday(&rightnow, NULL); | |
829 | srandom(rightnow.tv_sec + rightnow.tv_usec); | 829 | srandom(rightnow.tv_sec + rightnow.tv_usec); | |
830 | 830 | |||
831 | if ((progname = strrchr(argv[0], '/')) != NULL) | 831 | if ((progname = strrchr(argv[0], '/')) != NULL) | |
832 | progname++; | 832 | progname++; | |
833 | else | 833 | else | |
834 | progname = argv[0]; | 834 | progname = argv[0]; | |
835 | #ifdef RLIMIT_NOFILE | 835 | #if defined(MAKE_NATIVE) || (defined(HAVE_SETRLIMIT) && defined(RLIMIT_NOFILE)) | |
836 | /* | 836 | /* | |
837 | * get rid of resource limit on file descriptors | 837 | * get rid of resource limit on file descriptors | |
838 | */ | 838 | */ | |
839 | { | 839 | { | |
840 | struct rlimit rl; | 840 | struct rlimit rl; | |
841 | if (getrlimit(RLIMIT_NOFILE, &rl) != -1 && | 841 | if (getrlimit(RLIMIT_NOFILE, &rl) != -1 && | |
842 | rl.rlim_cur != rl.rlim_max) { | 842 | rl.rlim_cur != rl.rlim_max) { | |
843 | rl.rlim_cur = rl.rlim_max; | 843 | rl.rlim_cur = rl.rlim_max; | |
844 | (void)setrlimit(RLIMIT_NOFILE, &rl); | 844 | (void)setrlimit(RLIMIT_NOFILE, &rl); | |
845 | } | 845 | } | |
846 | } | 846 | } | |
847 | #endif | 847 | #endif | |
848 | 848 |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: job.c,v 1.12 2011/06/18 22:39:46 bsiegert Exp $ */ | 1 | /* $NetBSD: job.c,v 1.13 2013/02/26 00:50:14 christos 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.12 2011/06/18 22:39:46 bsiegert Exp $"; | 73 | static char rcsid[] = "$NetBSD: job.c,v 1.13 2013/02/26 00:50:14 christos 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.12 2011/06/18 22:39:46 bsiegert Exp $"); | 80 | __RCSID("$NetBSD: job.c,v 1.13 2013/02/26 00:50:14 christos 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 | |
@@ -1386,32 +1386,34 @@ JobExec(Job *job, char **argv) | @@ -1386,32 +1386,34 @@ JobExec(Job *job, char **argv) | |||
1386 | * its standard output. | 1386 | * its standard output. | |
1387 | */ | 1387 | */ | |
1388 | (void)fcntl(1, F_SETFD, 0); | 1388 | (void)fcntl(1, F_SETFD, 0); | |
1389 | if (dup2(1, 2) == -1) { | 1389 | if (dup2(1, 2) == -1) { | |
1390 | execError("dup2", "1, 2"); | 1390 | execError("dup2", "1, 2"); | |
1391 | _exit(1); | 1391 | _exit(1); | |
1392 | } | 1392 | } | |
1393 | 1393 | |||
1394 | /* | 1394 | /* | |
1395 | * We want to switch the child into a different process family so | 1395 | * We want to switch the child into a different process family so | |
1396 | * we can kill it and all its descendants in one fell swoop, | 1396 | * we can kill it and all its descendants in one fell swoop, | |
1397 | * by killing its process family, but not commit suicide. | 1397 | * by killing its process family, but not commit suicide. | |
1398 | */ | 1398 | */ | |
1399 | #if defined(MAKE_NATIVE) || defined(HAVE_SETPGID) | |||
1399 | #if defined(SYSV) | 1400 | #if defined(SYSV) | |
1400 | /* XXX: dsl - I'm sure this should be setpgrp()... */ | 1401 | /* XXX: dsl - I'm sure this should be setpgrp()... */ | |
1401 | (void)setsid(); | 1402 | (void)setsid(); | |
1402 | #else | 1403 | #else | |
1403 | (void)setpgid(0, getpid()); | 1404 | (void)setpgid(0, getpid()); | |
1404 | #endif | 1405 | #endif | |
1406 | #endif | |||
1405 | 1407 | |||
1406 | Var_ExportVars(); | 1408 | Var_ExportVars(); | |
1407 | 1409 | |||
1408 | (void)execv(shellPath, argv); | 1410 | (void)execv(shellPath, argv); | |
1409 | execError("exec", shellPath); | 1411 | execError("exec", shellPath); | |
1410 | _exit(1); | 1412 | _exit(1); | |
1411 | } | 1413 | } | |
1412 | 1414 | |||
1413 | /* Parent, continuing after the child exec */ | 1415 | /* Parent, continuing after the child exec */ | |
1414 | job->pid = cpid; | 1416 | job->pid = cpid; | |
1415 | 1417 | |||
1416 | Trace_Log(JOBSTART, job); | 1418 | Trace_Log(JOBSTART, job); | |
1417 | 1419 |