|
|
Subscribe / Log in / New account

Namespaces in operation, part 3: PID namespaces

Namespaces in operation, part 3: PID namespaces

Posted Jan 17, 2013 6:27 UTC (Thu) by bjencks (subscriber, #80303)
Parent article: Namespaces in operation, part 3: PID namespaces

Is it possible to correlate PIDs from different namespaces to the same process? That is, can a process in a parent namespace inspect a process based on its PID in the parent namespace to determine its PID in each subordinate namespace down to the inspected process's own namespace?

Also, is there any way to determine the namespace hierarchy? Inode numbers identify them, but don't specify their relationships.


to post comments

Namespaces in operation, part 3: PID namespaces

Posted Jan 17, 2013 12:26 UTC (Thu) by ebiederm (subscriber, #35028) [Link]

It depends on what you are doing. Unix domain sockets translate transmitted pids.
Readlink on /proc/self reports your pid in the pid namespace of the proc mount.

That should cover most day to day cases.

Processes in pid namespaces can not escape so process nesting mirrors pid namespace nesting.

With the pid namespace file descriptors you can find can with care mount proc for each of the pid namespaces.

For a process with children you will need to look at something like start time to distinguish between them. A little tricky but it should be doable. Process with parents outside the pid namespace will report their parent pid as 0, so should be easy to find. Normally there will be only one.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds