From: Mark Mitchell <mark@codesourcery.com>
To: gdb-patches@sources.redhat.com
Subject: PATCH: Guard uses of fork
Date: Thu, 10 Mar 2005 04:00:00 -0000 [thread overview]
Message-ID: <200503100400.j2A4055p021369@sirius.codesourcery.com> (raw)
This patch uses the HAVE_WORKING_FORK and HAVE_WORKING_VFORK macros
appropriately to guard calls to these functions. (These macros are
already being defined by autoconf; we just need to use them.) I'm
checking HAVE_WORKING_FORK, even in the case of the call to vfork in
cli-cmds.c, because autoconf will "#define vfork fork" if there's no
vfork, but there is fork. I left the CANT_FORK define in place
because that's defined by defs.h in the case __MSDOS__, and Dan says
that configure isn't run in that case. I think it could safely be
removed (as surely, on __MSDOS__, nothing will define
HAVE_WORKING_[V]FORK, but I don't have a way of testing that. I'm
happy to make that change as well, if people would like.
OK to apply?
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
2005-03-09 Mark Mitchell <mark@codesourcery.com>
* utils.c (internal_vproblem): Guard call to fork with HAVE_FORK.
* cli/cli-cmds.c (shell_escape): Guard call to vfork with
HAVE_WORKING_VFORK and HAVE_WORKING_FORK.
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.157
diff -c -5 -p -r1.157 utils.c
*** utils.c 24 Feb 2005 13:51:35 -0000 1.157
--- utils.c 10 Mar 2005 02:08:35 -0000
*************** further debugging may prove unreliable."
*** 787,798 ****
--- 787,800 ----
}
else
{
if (dump_core_p)
{
+ #ifdef HAVE_WORKING_FORK
if (fork () == 0)
abort (); /* NOTE: GDB has only three calls to abort(). */
+ #endif
}
}
dejavu = 0;
}
Index: cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.57
diff -c -5 -p -r1.57 cli-cmds.c
*** cli/cli-cmds.c 24 Feb 2005 13:51:36 -0000 1.57
--- cli/cli-cmds.c 10 Mar 2005 02:08:35 -0000
*************** echo_command (char *text, int from_tty)
*** 482,492 ****
}
static void
shell_escape (char *arg, int from_tty)
{
! #ifdef CANT_FORK
/* If ARG is NULL, they want an inferior shell, but `system' just
reports if the shell is available when passed a NULL arg. */
int rc = system (arg ? arg : "");
if (!arg)
--- 482,493 ----
}
static void
shell_escape (char *arg, int from_tty)
{
! #if defined(CANT_FORK) || \
! (!defined(HAVE_WORKING_VFORK) && !defined(HAVE_WORKING_FORK))
/* If ARG is NULL, they want an inferior shell, but `system' just
reports if the shell is available when passed a NULL arg. */
int rc = system (arg ? arg : "");
if (!arg)
next reply other threads:[~2005-03-10 4:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-10 4:00 Mark Mitchell [this message]
2005-03-16 15:29 ` Daniel Jacobowitz
2005-03-16 16:37 ` Mark Mitchell
2005-03-16 19:58 ` Eli Zaretskii
2005-03-16 19:50 ` Eli Zaretskii
2005-03-16 19:51 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200503100400.j2A4055p021369@sirius.codesourcery.com \
--to=mark@codesourcery.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox