[Devel] [PATCH 2/6] Rename pid_nr function

sukadev at us.ibm.com sukadev at us.ibm.com
Fri Jul 13 09:11:09 PDT 2007


Pavel Emelianov [xemul at openvz.org] wrote:
| Serge E. Hallyn wrote:
| > Quoting Pavel Emelianov (xemul at openvz.org):
| >> sukadev at us.ibm.com wrote:
| >>> Pavel Emelianov [xemul at openvz.org] wrote:
| >>> | sukadev at us.ibm.com wrote:
| >>> | > Subject: [PATCH 2/6] Rename pid_nr function 
| >>> | > 
| >>> | > From: Sukadev Bhattiprolu <sukadev at us.ibm.com>
| >>> | > 
| >>> | > Rename pid_nr() function to pid_to_nr() which is more descriptive
| >>> | > and will hopefully cause less confusion with new structure/functions
| >>> | > being added to support multiple pid namespaces.
| >>> | 
| >>> | Don't we need at least two convertors:
| >>> | pid_to_nr_as_it_seen_by_current()
| >>> | and
| >>> | pid_to_nr_as_it_seen_by_some_other_task()
| >>>
| >>> Can you give me an example of where you would use this latter
| >>> (pid_to_nr_as_it_seen_by_some_other_task()) interface ?
| >> Easy. Consider you're observing /proc/<pid>/status file for a task
| >> that lives in two namespaces - init and some created. When making 
| >> "cat" on this from init namespace you must get the task's pid as it
| >> is seen from init namespace, but when making "cat" from the created
| >> namespace you must see the pid as it is seen by this namespace. And 
| >> so on and so forth.

My patches use pid_nr_in_ns(pid, ns) in that case - where we get 'ns' from
the specific mount of /proc accesed. So the init_pid_ns process would execute
in init_pid_ns and the other would be in child ns.

So, in your case wouldn't it be enough to have pid_vnr() and
pid_nr_in_ns() ?

| > 
| > But 'current' in that case is the process reading the file, so you do in
| > fact want to use pid_to_nr_as_it_seen_by_current().
| 
| Well. I see. There's a misleading in names. Better would be called them
| pid_nr_as_it_is_seen_by_the_owning_task_when_he_reads_it() %)
| and
| pid_nr_as_it_is_seen_by_arbitrary_task()
| 
| the first one is pid_vnr() the second is pid_nr_ns().

yep.

| 
| > -serge
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list