[lxc-devel] Two process on a same namespcae with clone()

Maheswara Reddy C - ERS, HCL Tech maheswarareddyc at hcl.com
Thu Feb 17 06:48:04 UTC 2011


Fine,fork() always create new process, but here both the processes are different stacks.
If I use foek(), it will run the same instance of ABC_stack ,rather XYZ_stack.
Shall we call the clone() with out  CLONE_NEW* flags, so that it will run in the same name space.
See the below scenario, multiple namespaces each namespace has to run two different processes.


 Ns1=Clone(CLONE_NEWNS)  ----> process1 (ABC_Stack)
.                     ---------->Process2 (XYZ_stack)

 Ns2=Clone(CLONE_NEWNS)  ----> process1 (ABC_Stack)
.                     ---------->Process2 (XYZ_stack)



-----Original Message-----
From: Rob Landley [mailto:rlandley at parallels.com]
Sent: Wednesday, February 16, 2011 7:10 PM
To: lxc-devel at lists.sourceforge.net; Maheswara Reddy C - ERS, HCL Tech
Subject: Re: [lxc-devel] Two process on a same namespcae with clone()

On 02/16/2011 01:25 AM, Maheswara Reddy C - ERS, HCL Tech wrote:
> Hi,
> Could someone help me out,
> I want to run the two process on same name space, shall it possible
> using the clone()

You call clone with the CLONE_NEW* flags to create a new namespace.  And
then you just fork() normally (without those flags) to create additional
processes in that same namespace.

It's a bit like chroot: you do something extra to get in it, and then
children inherit that environment by default.


P.S. Fix your hilarious legalese .sig.


The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.


More information about the lxc-devel mailing list