This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] vfork() cleanup version #2


FYI,

I've checked in the attatched.

It changes things to use the autoconf magic AC_FUNC_VFORK.  It was
pointed out to me that this is the correct way to handle vfork().
Among other things, AC_FUNC_VFORK will #define vfork fork when vfork
isn't present.

	Andrew
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.
	
Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/configure.in,v
retrieving revision 1.54
diff -p -r1.54 configure.in
*** configure.in	2001/01/19 10:25:13	1.54
--- configure.in	2001/01/31 01:38:24
*************** AC_HEADER_STAT
*** 130,136 ****
  
  AC_C_CONST
  
! AC_CHECK_FUNCS(setpgid sbrk sigaction isascii bzero bcopy btowc poll sigprocmask vfork)
  AC_FUNC_ALLOCA
  
  # See if machine/reg.h supports the %fs and %gs i386 segment registers.
--- 130,137 ----
  
  AC_C_CONST
  
! AC_CHECK_FUNCS(setpgid sbrk sigaction isascii bzero bcopy btowc poll sigprocmask)
! AC_FUNC_VFORK
  AC_FUNC_ALLOCA
  
  # See if machine/reg.h supports the %fs and %gs i386 segment registers.
Index: fork-child.c
===================================================================
RCS file: /cvs/src/src/gdb/fork-child.c,v
retrieving revision 1.7
diff -p -r1.7 fork-child.c
*** fork-child.c	2000/12/02 15:40:56	1.7
--- fork-child.c	2001/01/31 01:38:24
***************
*** 25,30 ****
--- 25,31 ----
  #include "inferior.h"
  #include "target.h"
  #include "gdb_wait.h"
+ #include "gdb_vfork.h"
  #include "gdbcore.h"
  #include "terminal.h"
  #include "gdbthread.h"
*************** fork_inferior (char *exec_file, char *al
*** 244,257 ****
    if (pre_trace_fun != NULL)
      (*pre_trace_fun) ();
  
- #ifdef HAVE_VFORK
    if (debug_fork)
      pid = fork ();
    else
      pid = vfork ();
- #else
-   pid = fork ();
- #endif
  
    if (pid < 0)
      perror_with_name ("vfork");
--- 245,254 ----
Index: ser-pipe.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-pipe.c,v
retrieving revision 1.4
diff -p -r1.4 ser-pipe.c
*** ser-pipe.c	2000/12/15 01:01:49	1.4
--- ser-pipe.c	2001/01/31 01:38:24
***************
*** 24,29 ****
--- 24,31 ----
  #include "serial.h"
  #include "ser-unix.h"
  
+ #include "gdb_vfork.h"
+ 
  #include <sys/types.h>
  #include "gdb_wait.h"
  #include <sys/socket.h>
*************** pipe_open (serial_t scb, const char *nam
*** 64,74 ****
    if (socketpair (AF_UNIX, SOCK_STREAM, 0, pdes) < 0)
      return -1;
  
- #ifdef HAVE_VFORK
    pid = vfork ();
- #else
-   pid = fork ();
- #endif
    
    /* Error. */
    if (pid == -1)
--- 66,72 ----

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]