aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2016-01-18 09:45:10 +0000
committerGary Benson <gbenson@redhat.com>2016-01-18 11:39:42 +0000
commiteb0edac83f82516bbbd5a0412bbdf7fd27c687f2 (patch)
treee1e7a87000a8f625cf64fa551df6ed2305394313 /gdb/nat
parent760f6ee894c5f473777c7ff5ebe5a04b25651ce4 (diff)
downloadgdb-eb0edac83f82516bbbd5a0412bbdf7fd27c687f2.zip
gdb-eb0edac83f82516bbbd5a0412bbdf7fd27c687f2.tar.gz
gdb-eb0edac83f82516bbbd5a0412bbdf7fd27c687f2.tar.bz2
Fix gdbserver build failure on targets without fork
This commit fixes nat/linux-namespaces.c to build correctly on targets without fork. gdb/ChangeLog: * nat/linux-namespaces.c (do_fork): New function. (linux_mntns_get_helper): Use the above. gdb/gdbserver/ChangeLog: * configure.ac (AC_FUNC_FORK): New check. * config.in: Regenerate. * configure: Likewise.
Diffstat (limited to 'gdb/nat')
-rw-r--r--gdb/nat/linux-namespaces.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gdb/nat/linux-namespaces.c b/gdb/nat/linux-namespaces.c
index fb1467c..e9626ab 100644
--- a/gdb/nat/linux-namespaces.c
+++ b/gdb/nat/linux-namespaces.c
@@ -32,6 +32,19 @@
/* See nat/linux-namespaces.h. */
int debug_linux_namespaces;
+/* Handle systems without fork. */
+
+static inline pid_t
+do_fork (void)
+{
+#ifdef HAVE_FORK
+ return fork ();
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
/* Handle systems without setns. */
static inline int
@@ -644,7 +657,7 @@ linux_mntns_get_helper (void)
if (gdb_socketpair_cloexec (AF_UNIX, SOCK_STREAM, 0, sv) < 0)
return NULL;
- h.pid = fork ();
+ h.pid = do_fork ();
if (h.pid < 0)
{
int saved_errno = errno;