On 02/22/2011 12:47 PM, Maheswara Reddy C - ERS, HCL Tech wrote: > Hi, > Shall I program this way to create 10 namespaces, with each namespace run 2 > different processes or any better way. > > #include<sched.h> > #include<stdio.h> > #include<unistd.h> > > int main(int argc, char *argv[]) > { > > for(i=0;i<10;i++) > { > pid_t pid1[10],pid2[10]; > > int flag1= CLONE_NEWNS|CLONE_NETNET, flag2=0; > > int(*fun1[10]( ); // initialize statically > int(*fun2[10]( ); > > > Pid1[i] = clone(fun1[i],0,flag1,0); // process 1
Process Pid1[i] will have its own network namespace. > Pid2[i] = clone(fun2[i],0,flag2,0); // process 2 > Process Pid2[i] will inherit the initial network namespace... I guess that isn't what you want. If you want Pid2[i] to be in the same network namespace as Pid1[i], then Pid2[i] should be a child of Pid1[i]. Or as Daniel suggests in another mail, consider using unshare(). > } > > } > > > ::DISCLAIMER:: > ----------------------------------------------------------------------------------------------------------------------- > > 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. > > ----------------------------------------------------------------------------------------------------------------------- > > ------------------------------------------------------------------------------ > Index, Search& Analyze Logs and other IT data in Real-Time with Splunk > Collect, index and harness all the fast moving IT data generated by your > applications, servers and devices whether physical, virtual or in the cloud. > Deliver compliance at lower cost and gain new business insights. > Free Software Download: http://p.sf.net/sfu/splunk-dev2dev > _______________________________________________ > Lxc-devel mailing list > Lxc-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/lxc-devel -- Gregory Kurz gk...@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. ------------------------------------------------------------------------------ Index, Search & Analyze Logs and other IT data in Real-Time with Splunk Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. Free Software Download: http://p.sf.net/sfu/splunk-dev2dev _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel