Cleanup autoconfigury of vfork().

This commit is contained in:
Andrew Cagney 2001-01-31 02:08:23 +00:00
parent 4fcf66da88
commit 74c1b268c6
7 changed files with 486 additions and 203 deletions

View File

@ -1,3 +1,13 @@
Tue Jan 30 17:27:11 2001 Andrew Cagney <cagney@redhat.com>
* configure.in (AC_CHECK_FUNCS): Replace vfork test with
AC_FUNC_VFORK macro.
* config.in, configure: Re-generate.
* gdb_vfork.h: New file.
* ser-pipe.c (pipe_open): Update. Include "gdb_vfork.h".
* fork-child.c (fork_inferior): Ditto.
Tue Jan 30 17:09:07 2001 Andrew Cagney <cagney@redhat.com> Tue Jan 30 17:09:07 2001 Andrew Cagney <cagney@redhat.com>
* defs.h (strsave): Delete declaration. * defs.h (strsave): Delete declaration.

View File

@ -29,12 +29,18 @@
/* Define if you have a working `mmap' system call. */ /* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP #undef HAVE_MMAP
/* Define if you have <vfork.h>. */
#undef HAVE_VFORK_H
/* Define as __inline if that's what the C compiler calls it. */ /* Define as __inline if that's what the C compiler calls it. */
#undef inline #undef inline
/* Define to `long' if <sys/types.h> doesn't define. */ /* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t #undef off_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef pid_t
/* Define if you need to in order for stat and other things to work. */ /* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE #undef _POSIX_SOURCE
@ -59,6 +65,9 @@
/* Define if you have the ANSI C header files. */ /* Define if you have the ANSI C header files. */
#undef STDC_HEADERS #undef STDC_HEADERS
/* Define vfork as fork if vfork does not work. */
#undef vfork
/* Define if compiling on Solaris 7. */ /* Define if compiling on Solaris 7. */
#undef _MSE_INT_H #undef _MSE_INT_H
@ -225,9 +234,6 @@
/* Define if you have the strchr function. */ /* Define if you have the strchr function. */
#undef HAVE_STRCHR #undef HAVE_STRCHR
/* Define if you have the vfork function. */
#undef HAVE_VFORK
/* Define if you have the <argz.h> header file. */ /* Define if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H #undef HAVE_ARGZ_H

625
gdb/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -130,7 +130,8 @@ AC_HEADER_STAT
AC_C_CONST AC_C_CONST
AC_CHECK_FUNCS(setpgid sbrk sigaction isascii bzero bcopy btowc poll sigprocmask vfork) AC_CHECK_FUNCS(setpgid sbrk sigaction isascii bzero bcopy btowc poll sigprocmask)
AC_FUNC_VFORK
AC_FUNC_ALLOCA AC_FUNC_ALLOCA
# See if machine/reg.h supports the %fs and %gs i386 segment registers. # See if machine/reg.h supports the %fs and %gs i386 segment registers.

View File

@ -25,6 +25,7 @@
#include "inferior.h" #include "inferior.h"
#include "target.h" #include "target.h"
#include "gdb_wait.h" #include "gdb_wait.h"
#include "gdb_vfork.h"
#include "gdbcore.h" #include "gdbcore.h"
#include "terminal.h" #include "terminal.h"
#include "gdbthread.h" #include "gdbthread.h"
@ -244,14 +245,10 @@ fork_inferior (char *exec_file, char *allargs, char **env,
if (pre_trace_fun != NULL) if (pre_trace_fun != NULL)
(*pre_trace_fun) (); (*pre_trace_fun) ();
#ifdef HAVE_VFORK
if (debug_fork) if (debug_fork)
pid = fork (); pid = fork ();
else else
pid = vfork (); pid = vfork ();
#else
pid = fork ();
#endif
if (pid < 0) if (pid < 0)
perror_with_name ("vfork"); perror_with_name ("vfork");

28
gdb/gdb_vfork.h Normal file
View File

@ -0,0 +1,28 @@
/* GDB-friendly replacement for <vfork.h>.
Copyright 2001 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef GDB_VFORK_H
#define GDB_VFORK_H
#if HAVE_VFORK_H
#include <vfork.h>
#endif
#endif /* GDB_VFORK_H */

View File

@ -24,6 +24,8 @@
#include "serial.h" #include "serial.h"
#include "ser-unix.h" #include "ser-unix.h"
#include "gdb_vfork.h"
#include <sys/types.h> #include <sys/types.h>
#include "gdb_wait.h" #include "gdb_wait.h"
#include <sys/socket.h> #include <sys/socket.h>
@ -64,11 +66,7 @@ pipe_open (serial_t scb, const char *name)
if (socketpair (AF_UNIX, SOCK_STREAM, 0, pdes) < 0) if (socketpair (AF_UNIX, SOCK_STREAM, 0, pdes) < 0)
return -1; return -1;
#ifdef HAVE_VFORK
pid = vfork (); pid = vfork ();
#else
pid = fork ();
#endif
/* Error. */ /* Error. */
if (pid == -1) if (pid == -1)