[CRIU] How can I get "real pid" in pid namespace?

Qiang Huang h.huangqiang at huawei.com
Sun Jun 30 18:55:40 EDT 2013


On 2013/7/1 9:27, Chanho Park wrote:
> Hi,
> 
> If we start pid_namespace with CLONE_NEWPID, the process will have virtual
> pid.
> Even it can be started from 1. The process can get the pid using getpid().
> If it is in the pid namespace, it only returns virtual pid.
> 
> However, many legacy application exports its pid
> and send it to other processes to identify the process.
> Other processes can identify the process from real pid not vpid.

Other processes can identify the process from vpid and pidns, so you
should exports its pid namespace besides its pid.

> 
> I know the behavior is not suitable for the purpose of container.
> I think if the virtual pid is exported to out of namespace,
> it should be converted to the real pid.
> 
> How can the process get "real pid" in the pid namespace?

It can't, the process in the pid namespace can't know they are
in a sub pidns or not, the mechanism decide this.

> 
> Best Regards,
> Chanho Park
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
> 
> 




More information about the CRIU mailing list