aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat/linux-namespaces.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/nat/linux-namespaces.c')
-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;