[lxc-devel] How to change to lxc internal PID to system wide PID

Greg Kurz gkurz at fr.ibm.com
Mon Dec 12 10:08:58 UTC 2011


On Mon, 2011-12-12 at 11:01 +0800, yinxb at neusoft.com wrote:
> Hi all
> 
>   These days I encouter a problem.
>   When I use the lxc to running my app,the getpid() system call 
> returns 2.But in my platform,
>   I need the system wide PID instead for some purpose,such as 
> integrade with native app(not running in lxc).
>   (I want to integrade the lxc app in my platform to do isolation,and 
> use the dbus for IPC)
>   So how to solve this conflict?Can anyone give me a hint? 
> 
>   Thanks for your time.
> 
> Cheers
> Xiaobiao

Hi Xiaobiao,

This is a recurring need from the lxc community... For the moment, the
only kernel service that provides PID conversions is 'ancillary messages
on AF_UNIX sockets'. Look for SCM_CREDENTIALS in unix(7). All you need
is connected unix socket between your container and the host system.

Cheers.

-- 
Gregory Kurz                                     gkurz at fr.ibm.com
Software Engineer @ IBM/Meiosys                  http://www.ibm.com
Tel +33 (0)534 638 479                           Fax +33 (0)561 400 420

"Anarchy is about taking complete responsibility for yourself."
        Alan Moore.





More information about the lxc-devel mailing list