Re: [PATCH 6/9 v2] Implement mount namespace support for native Linux targets

Pedro Alves
2015-05-21T14:59:47Z

On 04/30/2015 01:05 PM, Gary Benson wrote:
> This commit allows GDB to access executables and shared libraries
> on native Linux targets where GDB and the inferior have different
> mount namespaces.

> +/* Implementation of to_fileio_open. */
> +
> +static int
> +linux_nat_fileio_open (struct target_ops *self,
> + struct inferior *inf, const char *filename,
> + int flags, int mode, int *target_errno)
> +{
> + int nat_flags;
> + int fd;
> +
> + if (fileio_to_host_openflags (flags, &nat_flags) == -1)
> + {
> + *target_errno = FILEIO_EINVAL;
> + return -1;
> + }
> +
> + /* We do not need to convert MODE, since the fileio protocol
> + uses the standard values. */

Hmm, I'm not seeing how the fileio constants have to necessarily
match the host's. So I don't understand this comment. What
are these standard values?

> + fd = linux_mntns_open_cloexec (linux_nat_fileio_pid_of (inf),
> + filename, nat_flags, mode);
> + if (fd == -1)
> + *target_errno = host_to_fileio_error (errno);
> +
> + return fd;
> +}
> +

Otherwise this looks good to me. I'll leave the "set debug" flag's
name up to you.

Thanks,
Pedro Alves