aboutsummaryrefslogtreecommitdiff
path: root/gdb/darwin-nat.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-05-10 17:01:00 +0000
committerTom Tromey <tromey@redhat.com>2013-05-10 17:01:00 +0000
commit21ff46861c35d99dbbafc42d0854128270ef8f30 (patch)
tree695d5c1355aa6d9a74417ee617656c18be640b79 /gdb/darwin-nat.c
parentd3685d60d601f0ae817beb920fc1156f1f0885ee (diff)
downloadgdb-21ff46861c35d99dbbafc42d0854128270ef8f30.zip
gdb-21ff46861c35d99dbbafc42d0854128270ef8f30.tar.gz
gdb-21ff46861c35d99dbbafc42d0854128270ef8f30.tar.bz2
2013-05-10 Joel Brobecker <brobecker@adacore.com>
Tom Tromey <tromey@redhat.com> * common/filestuff.c (mark_fd_no_cloexec, unmark_fd_no_cloexec): New functions. * common/filestuff.c (mark_fd_no_cloexec, unmark_fd_no_cloexec): Declare. * darwin-nat.c (darwin_pre_ptrace): Use mark_fd_no_cloexec. (darwin_ptrace_him): Use unmark_fd_no_cloexec. * inf-ttrace.c (do_cleanup_pfds): Use unmark_fd_no_cloexec. (inf_ttrace_prepare): Use mark_fd_no_cloexec.
Diffstat (limited to 'gdb/darwin-nat.c')
-rw-r--r--gdb/darwin-nat.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index acdbf36..a2da924 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -66,6 +66,7 @@
#include <mach/port.h>
#include "darwin-nat.h"
+#include "common/filestuff.h"
/* Quick overview.
Darwin kernel is Mach + BSD derived kernel. Note that they share the
@@ -1516,6 +1517,9 @@ darwin_pre_ptrace (void)
ptrace_fds[1] = -1;
error (_("unable to create a pipe: %s"), safe_strerror (errno));
}
+
+ mark_fd_no_cloexec (ptrace_fds[0]);
+ mark_fd_no_cloexec (ptrace_fds[1]);
}
static void
@@ -1533,6 +1537,9 @@ darwin_ptrace_him (int pid)
close (ptrace_fds[0]);
close (ptrace_fds[1]);
+ unmark_fd_no_cloexec (ptrace_fds[0]);
+ unmark_fd_no_cloexec (ptrace_fds[1]);
+
darwin_init_thread_list (inf);
startup_inferior (START_INFERIOR_TRAPS_EXPECTED);