This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 4/7] Remove linux_proc_pid_get_ns
- From: Doug Evans <dje at google dot com>
- To: Gary Benson <gbenson at redhat dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Thu, 16 Apr 2015 21:35:57 -0700
- Subject: Re: [PATCH 4/7] Remove linux_proc_pid_get_ns
- Authentication-results: sourceware.org; auth=none
- References: <1429186791-6867-1-git-send-email-gbenson at redhat dot com> <1429186791-6867-5-git-send-email-gbenson at redhat dot com>
On Thu, Apr 16, 2015 at 5:19 AM, Gary Benson <gbenson@redhat.com> wrote:
> This commit removes linux_proc_pid_get_ns, and updates its only
> use to use linux_ns_same instead.
>
> gdb/ChangeLog:
>
> * linux-thread-db.c (nat/linux-namespaces.h): New include.
> (check_pid_namespace_match): Use linux_ns_same rather than
> linux_proc_pid_get_ns to spot PID namespace mismatches.
> * nat/linux-procfs.h (linux_proc_pid_get_ns): Remove.
> * nat/linux-procfs.c (linux_proc_pid_get_ns): Likewise.
LGTM.
one nit below
> diff --git a/gdb/nat/linux-procfs.c b/gdb/nat/linux-procfs.c
> index 44364c5..24bcb01 100644
> --- a/gdb/nat/linux-procfs.c
> +++ b/gdb/nat/linux-procfs.c
> @@ -185,25 +185,6 @@ linux_proc_pid_is_zombie (pid_t pid)
> return linux_proc_pid_is_zombie_maybe_warn (pid, 1);
> }
>
> -/* See linux-procfs.h declaration. */
> -
> -char *
> -linux_proc_pid_get_ns (pid_t pid, const char *ns)
> -{
> - char buf[100];
> - char nsval[64];
> - int ret;
> - xsnprintf (buf, sizeof (buf), "/proc/%d/ns/%s", (int) pid, ns);
> - ret = readlink (buf, nsval, sizeof (nsval));
> - if (0 < ret && ret < sizeof (nsval))
> - {
> - nsval[ret] = '\0';
> - return xstrdup (nsval);
> - }
> -
> - return NULL;
> -}
I see we're using pid_t here.
I think we talked before about a type for pids.
Since this is all linux specific code maybe use pid_t more in this patch set?