/* Linux namespaces(7) support.
- Copyright (C) 2015 Free Software Foundation, Inc.
+ Copyright (C) 2015-2017 Free Software Foundation, Inc.
This file is part of GDB.
/* 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
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;
if (fd < 0)
goto error;
- old_chain = make_cleanup_close (fd);
+ make_cleanup_close (fd);
if (fstat (fd, &sb) != 0)
goto error;