This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch] Actually check for vfork()
- To: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- Subject: [patch] Actually check for vfork()
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Sun, 03 Dec 2000 02:30:41 +1100
FYI,
No one thought to actually check that vfork() was available :-/. With
that in mind, the C code testing for VFORK:
#if defined (USG) && !defined (HAVE_VFORK)
use fork()
#else
use vfork()
#endif
was even more bizare :-)
enjoy,
Andrew
Sun Dec 3 02:28:26 2000 Andrew Cagney <cagney@b1.cygnus.com>
* ser-pipe.c (pipe_open): Only use vfork when available.
* fork-child.c (fork_inferior): Fix #ifdef HAVE_VFORK test.
(clone_and_follow_inferior): Ditto.
* configure.in (AC_CHECK_FUNCS): Check for vfork.
* configure, config.in: Regenerate.
Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/configure.in,v
retrieving revision 1.46
diff -p -r1.46 configure.in
*** configure.in 2000/12/01 18:01:37 1.46
--- configure.in 2000/12/02 15:33:58
*************** AC_HEADER_STAT
*** 129,135 ****
AC_C_CONST
! AC_CHECK_FUNCS(setpgid sbrk sigaction isascii bzero bcopy btowc poll sigprocmask)
AC_FUNC_ALLOCA
# See if machine/reg.h supports the %fs and %gs i386 segment registers.
--- 129,135 ----
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.
Index: fork-child.c
===================================================================
RCS file: /cvs/src/src/gdb/fork-child.c,v
retrieving revision 1.6
diff -p -r1.6 fork-child.c
*** fork-child.c 2000/09/01 23:39:11 1.6
--- fork-child.c 2000/12/02 15:33:58
*************** fork_inferior (char *exec_file, char *al
*** 244,256 ****
if (pre_trace_fun != NULL)
(*pre_trace_fun) ();
! #if defined(USG) && !defined(HAVE_VFORK)
! pid = fork ();
! #else
if (debug_fork)
pid = fork ();
else
pid = vfork ();
#endif
if (pid < 0)
--- 244,256 ----
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)
*************** clone_and_follow_inferior (int child_pid
*** 416,428 ****
error ("error getting pipe for handoff semaphore");
/* Clone the debugger. */
! #if defined(USG) && !defined(HAVE_VFORK)
! debugger_pid = fork ();
! #else
if (debug_fork)
debugger_pid = fork ();
else
debugger_pid = vfork ();
#endif
if (debugger_pid < 0)
--- 416,428 ----
error ("error getting pipe for handoff semaphore");
/* Clone the debugger. */
! #ifdef HAVE_VFORK
if (debug_fork)
debugger_pid = fork ();
else
debugger_pid = vfork ();
+ #else
+ debugger_pid = fork ();
#endif
if (debugger_pid < 0)
Index: ser-pipe.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-pipe.c,v
retrieving revision 1.2
diff -p -r1.2 ser-pipe.c
*** ser-pipe.c 2000/02/09 08:52:47 1.2
--- ser-pipe.c 2000/12/02 15:34:01
*************** pipe_open (serial_t scb, const char *nam
*** 64,70 ****
--- 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)