[lxc-devel] 回复 :Re: 回复 :Re: How to change to lxc internal PID to system wide PID

yinxb at neusoft.com yinxb at neusoft.com
Wed Dec 14 00:42:08 UTC 2011


Hi 
   Thanks,It is exactly what I want.

----- 原邮件 -----
从: Cedric Le Goater <legoater at free.fr>
日期: 星期二, 十二月 13日, 2011 下午4:10
主题: Re: [lxc-devel] 回复 :Re:  How to change to lxc internal PID to 
system wide PID

> On 12/13/2011 02:49 AM, yinxb at neusoft.com wrote:
> > Hi Gregory Kurz
> > 
> >    From the google search,SCM_CREDENTIALS contains the PID of 
> the 
> > sender process,in the sender's
> > PID namespace.
> >    So if the lxc App acts as the sender, the PID is 2 which is 
> also 
> > invalid for the host. 
> > (lxc has its own PID namesapce)
> >    Correct me if wrong,thanks.
> 
> the pid in 'struct ucred' will be translated in the pid namespace of
> the receiving side.
> 
> on the host, run the receiving side  : 
> 
> 
	http://man7.org/tlpi/code/online/dist/sockets/scm_cred_recv.c
.html
> 
> 	$ ./scm_cred_recv 
> 	Receiving via stream socket
> 	recvmsg() returned 4
> 	Received data = 12345
> 	Received credentials pid=20333, uid=1017, gid=100
> 	Credentials from SO_PEERCRED: pid=20333, euid=1017, egid=100
> 
> 
> and in an lxc (application) container, run the sending side : 
> 
> 
	http://man7.org/tlpi/code/online/dist/sockets/scm_cred_send.c
.html
> 
> 	$ lxc-execute -n foo -- ./scm_cred_send
> 	Send credentials pid=2, uid=1017, gid=100
> 	sendmsg() returned 4
> 
> Regards,
> 
> C.
> 
---------------------------------------------------------------------------------------------------
Confidentiality Notice: The information contained in this e-mail and any accompanying attachment(s) 
is intended only for the use of the intended recipient and may be confidential and/or privileged of 
Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of this communication is 
not the intended recipient, unauthorized use, forwarding, printing,  storing, disclosure or copying 
is strictly prohibited, and may be unlawful.If you have received this communication in error,please 
immediately notify the sender by return e-mail, and delete the original message and all copies from 
your system. Thank you. 
---------------------------------------------------------------------------------------------------


More information about the lxc-devel mailing list