Remove use of vfork().
authorPaul Smith <psmith@gnu.org>
Mon, 6 May 2013 04:22:27 +0000 (00:22 -0400)
committerPaul Smith <psmith@gnu.org>
Mon, 6 May 2013 04:22:27 +0000 (00:22 -0400)
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().

config.ami.template
config.h-vms.template
config.h.W32.template
configure.ac
job.c
makeint.h
remote-cstms.c

index 78e2e75..4202363 100644 (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%"
 
index dd1aa1e..7c3b1bd 100644 (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%"
 
index 82d83ad..1cd08d4 100644 (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 */
 
index 45b201c..7b70f04 100644 (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
diff --git a/job.c b/job.c
index 966a1bd..daf3efe 100644 (file)
--- a/job.c
+++ b/job.c
@@ -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__ */
index 9dd22ce..14a6c26 100644 (file)
--- a/makeint.h
+++ b/makeint.h
@@ -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.  */
 
index 713b89a..1c4591b 100644 (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)