Re: [PATCH 2/9 v2] Introduce nat/linux-namespaces.[ch]

Yao Qi
2016-01-08T10:49:25Z

Gary Benson <gbenson@redhat.com> writes:

Hi Gary,

> +/* Return an object representing the mount namespace helper process.
> + If no mount namespace helper process has been started then start
> + one. Return NULL if no mount namespace helper process could be
> + started. */
> +
> +static struct linux_mnsh *
> +linux_mntns_get_helper (void)
> +{
> + static struct linux_mnsh *helper = NULL;
> +
> + if (helper == NULL)
> + {
> + static struct linux_mnsh h;
> + struct linux_ns *ns;
> + pid_t helper_creator = getpid ();
> + int sv[2];
> +
> + ns = linux_ns_get_namespace (LINUX_NS_MNT);
> + if (ns == NULL)
> + return NULL;
> +
> + if (gdb_socketpair_cloexec (AF_UNIX, SOCK_STREAM, 0, sv) < 0)
> + return NULL;
> +
> + h.pid = fork ();
> + if (h.pid < 0)

Function fork isn't available on uclinux target, so it causes a
compilation error like this below. Since my work touches
linux-bfin-low.c, I build GDBserver for bfin-uclinux, and the error is found.

cc1: warnings being treated as errors
gdb/gdbserver/../nat/linux-namespaces.c: In function ‘linux_mntns_get_helper’:
gdb/gdbserver/../nat/linux-namespaces.c:647: error: implicit declaration of function ‘fork’

I don't know much about linux namespace stuff, so I didn't give a fix
here. Could you have a look?

--
Yao (齐尧)