public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serge@hallyn.com>
To: "chenhanxiao@cn.fujitsu.com" <chenhanxiao@cn.fujitsu.com>
Cc: Richard Weinberger <richard@nod.at>,
	"containers@lists.linux-foundation.org" 
	<containers@lists.linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Pavel Emelyanov <xemul@parallels.com>,
	"linux-api@vger.kernel.org" <linux-api@vger.kernel.org>,
	Serge Hallyn <serge.hallyn@ubuntu.com>,
	Oleg Nesterov <oleg@redhat.com>,
	David Howells <dhowells@redhat.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH v2] ns: introduce getnspid syscall
Date: Mon, 23 Jun 2014 15:32:30 +0200	[thread overview]
Message-ID: <20140623133230.GA31817@mail.hallyn.com> (raw)
In-Reply-To: <5871495633F38949900D2BF2DC04883E54ECC5@G08CNEXMBPEKD02.g08.fujitsu.local>

Quoting chenhanxiao@cn.fujitsu.com (chenhanxiao@cn.fujitsu.com):
> Hi
> 
> > -----Original Message-----
> > From: Richard Weinberger [mailto:richard@nod.at]
> > Sent: Friday, June 20, 2014 7:02 PM
> > To: Chen, Hanxiao/陈 晗霄; containers@lists.linux-foundation.org;
> > linux-kernel@vger.kernel.org
> > Cc: Eric W. Biederman; Serge Hallyn; Daniel P. Berrange; Oleg Nesterov; Al Viro;
> > David Howells; Pavel Emelyanov; Vasiliy Kulikov; Gotou, Yasunori/五島 康文;
> > linux-api@vger.kernel.org
> > Subject: Re: [PATCH v2] ns: introduce getnspid syscall
> > 
> > Am 20.06.2014 12:18, schrieb Chen Hanxiao:
> > > We need a direct method of getting the pid inside containers.
> > > If some issues occurred inside container guest, host user
> > > could not know which process is in trouble just by guest pid:
> > > the users of container guest only knew the pid inside containers.
> > > This will bring obstacle for trouble shooting.
> > >
> > > int getnspid(pid_t pid, int fd1, int fd2);
> > >
> > > pid: the pid number need to be translated.
> > >
> > > fd: a file descriptor referring to one of
> > >     the namespace entries in a /proc/[pid]/ns/pid.
> > >     fd1 for destination ns(ns1), where the pid came from.
> > >     fd2 for reference ns(ns2), while fd2 = -2 means for current ns.
> > >
> > > return value:
> > >     >0 : translated pid in ns1(fd1) seen from ns2(fd2).
> > >     <=0: on failure.
> > >
> > 
> > I don't think that adding a new system call for this is a good solution.
> > We need a more generic way. I bet people are interested in more than just PID
> > numbers.
> 
> Could you please give some hints on how to expand this interface?
> 
> > 
> > I agree with Eric that a procfs solution is more appropriate.
> > 
> 
> Procfs is a good solution, but syscall is not bad though.

I might be inclined to agree, except that in this case you are still
needing mounted procfs anyway to get the proc/$pid/ns/pid fds.

I'm sorry, I've not been watching this thread, so this probably has been
considered and decided against, but I'm going to ask anyway.  Keeping
in mind both checkpoint-restart and and introspection for use in a
setns'd commend, why not make it

pid_t getnspid(pid_t query_pid, pid_t observer_pid)

which returns the process id of query_pid as seen from observer_pid's
pidns?


> Procfs works for me, but that seems could not fit
> Pavel's requirement.
> His opinion is that a syscall is a more generic interface
> than proc files, and  also very helpful.
> And syscall could tell whether a pid lives in a specific pid namespace,
> much convenient than procfs.
> 
> Thanks,
> - Chen

> _______________________________________________
> Containers mailing list
> Containers@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/containers


  reply	other threads:[~2014-06-23 13:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-20 10:18 [PATCH v2] ns: introduce getnspid syscall Chen Hanxiao
2014-06-20 11:02 ` Richard Weinberger
2014-06-23 10:15   ` chenhanxiao
2014-06-23 13:32     ` Serge E. Hallyn [this message]
2014-06-25 10:00       ` chenhanxiao
2014-06-25 14:38         ` Serge Hallyn
2014-06-26 10:19           ` chenhanxiao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140623133230.GA31817@mail.hallyn.com \
    --to=serge@hallyn.com \
    --cc=chenhanxiao@cn.fujitsu.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=richard@nod.at \
    --cc=serge.hallyn@ubuntu.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xemul@parallels.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox