LWN.net Logo

Namespaces in operation, part 3: PID namespaces

Namespaces in operation, part 3: PID namespaces

Posted Jan 17, 2013 12:26 UTC (Thu) by ebiederm (subscriber, #35028)
In reply to: Namespaces in operation, part 3: PID namespaces by bjencks
Parent article: Namespaces in operation, part 3: PID namespaces

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.


(Log in to post comments)

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