Remove use of vfork().

GCC was giving us warnings, most OS's now just run fork() when you call
vfork(), and looking at the standard definition of vfork() we are a long way
from using it safely anyway: you're not allowed to even call a function before
you exec().
This commit is contained in:
Paul Smith 2013-05-06 00:22:27 -04:00
parent 7c77486d1f
commit 94735f0ad7
7 changed files with 6 additions and 42 deletions

View file

@ -109,9 +109,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Define if utime(file, NULL) sets file's timestamp to the present. */
/* #undef HAVE_UTIME_NULL */
/* Define if you have <vfork.h>. */
/* #undef HAVE_VFORK_H */
/* Define if you have the wait3 system call. */
/* #undef HAVE_WAIT3 */
@ -176,9 +173,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
instead of <sys/cpustats.h>. */
/* #undef UMAX4_3 */
/* Define vfork as fork if vfork does not work. */
/* #undef vfork */
/* Name of this package (needed by automake) */
#define PACKAGE "%PACKAGE%"

View file

@ -138,9 +138,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if utime(file, NULL) sets file's timestamp to the present. */
/* #undef HAVE_UTIME_NULL */
/* Define to 1 if you have <vfork.h>. */
/* #undef HAVE_VFORK_H */
/* Define to 1 if you have the wait3 system call. */
/* #undef HAVE_WAIT3 */
@ -210,9 +207,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
instead of <sys/cpustats.h>. */
/* #undef UMAX4_3 */
/* Define vfork as fork if vfork does not work. */
/* #undef vfork */
/* Name of this package (needed by automake) */
#define PACKAGE "%PACKAGE%"

View file

@ -123,9 +123,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the 'fileno' function. */
#define HAVE_FILENO 1
/* Define to 1 if you have the 'fork' function. */
/* #undef HAVE_FORK */
/* Define to 1 if you have the 'getcwd' function. */
#define HAVE_GETCWD 1
@ -339,24 +336,12 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#define HAVE_UNISTD_H 1
#endif
/* Define to 1 if you have the 'vfork' function. */
/* #undef HAVE_VFORK */
/* Define to 1 if you have the <vfork.h> header file. */
/* #undef HAVE_VFORK_H */
/* Define to 1 if you have the 'wait3' function. */
/* #undef HAVE_WAIT3 */
/* Define to 1 if you have the 'waitpid' function. */
/* #undef HAVE_WAITPID */
/* Define to 1 if 'fork' works. */
/* #undef HAVE_WORKING_FORK */
/* Define to 1 if 'vfork' works. */
/* #undef HAVE_WORKING_VFORK */
/* Build host information. */
#define MAKE_HOST "Windows32"
@ -498,9 +483,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#define uintmax_t unsigned long
#endif
/* Define as 'fork' if 'vfork' does not work. */
/*#define vfork fork*/
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
/* #undef HAVE_SYS_WAIT_H */

View file

@ -153,7 +153,6 @@ AC_CHECK_FUNCS([strcasecmp strncasecmp strcmpi strncmpi stricmp strnicmp])
AC_FUNC_STRCOLL
AC_FUNC_ALLOCA
AC_FUNC_FORK([])
AC_FUNC_CLOSEDIR_VOID
# See if the user wants to add (or not) GNU Guile support

9
job.c
View file

@ -1380,9 +1380,8 @@ start_job_command (struct child *child)
#endif
int print_cmd;
int sync_cmd;
int flags;
char *p;
/* Must be volatile to silence bogus GCC warning about longjmp/vfork. */
volatile int flags;
#ifdef VMS
char *argv;
#else
@ -1677,7 +1676,7 @@ start_job_command (struct child *child)
#ifdef VMS
if (!child_execute_job (argv, child)) {
/* Fork failed! */
perror_with_name ("vfork", "");
perror_with_name ("fork", "");
goto error;
}
@ -1718,7 +1717,7 @@ start_job_command (struct child *child)
#else /* !__EMX__ */
child->pid = vfork ();
child->pid = fork ();
environ = parent_environ; /* Restore value child may have clobbered. */
if (child->pid == 0)
{
@ -1764,7 +1763,7 @@ start_job_command (struct child *child)
{
/* Fork failed! */
unblock_sigs ();
perror_with_name ("vfork", "");
perror_with_name ("fork", "");
goto error;
}
# endif /* !__EMX__ */

View file

@ -492,10 +492,6 @@ typedef int (*load_func_t)(const gmk_floc *flocp);
int load_file (const gmk_floc *flocp, const char **filename, int noerror,
void **dlp);
#ifdef HAVE_VFORK_H
# include <vfork.h>
#endif
/* We omit these declarations on non-POSIX systems which define _POSIX_VERSION,
because such systems often declare them in header files anyway. */

View file

@ -221,11 +221,11 @@ start_remote_job (char **argv, char **envp, int stdin_fd,
fflush (stdout);
fflush (stderr);
pid = vfork ();
pid = fork ();
if (pid < 0)
{
/* The fork failed! */
perror_with_name ("vfork", "");
perror_with_name ("fork", "");
return 1;
}
else if (pid == 0)