man 2 fork man 2 exec Calling fork() turns one process into two. They are both running the same program initially. In the two copies of start1, the return value from fork() differs.
when start1 calls retval = fork(); and gets a return value NOT zero, then that copy of start1 is the parent, and the return value is the PID of the child. In the other copy of start1 created by the fork() the retval = fork(); returns 0. It is the child process, and can/should then call exec(child1) to turn itself into a process running a different executable. fork() should have been called clonemyself() or dupself(). exec() should have been called changeprogram(). >>-----Original Message----- >>From: Zoltan Szabo [mailto:zotya@;myself.com] >>Sent: Friday, November 15, 2002 7:08 AM >>To: [EMAIL PROTECTED] >>Subject: Re: Out of office loop (Out of Office) >> >> >>Hi >> >>I have a little problem. >>If I have two C programs: >>start1 >>child1 >> >>"child1" is started from "start1", how can i get in the >>starter program the PID of the child program? >>-- >>__________________________________________________________ >>Sign-up for your own FREE Personalized E-mail at Mail.com >>http://www.mail.com/?sr=signup >> >>Single & ready to mingle? lavalife.com: Where singles click. >>Free to Search! >>http://www.lavalife.com/wp.epl?a=2716 >> >> >> >>-- >>redhat-list mailing list >>unsubscribe mailto:redhat-list-request@;redhat.com?subject=unsubscribe >>https://listman.redhat.com/mailman/listinfo/redhat-list >> ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept for the presence of computer viruses. www.hubbell.com - Hubbell Incorporated ********************************************************************** -- redhat-list mailing list unsubscribe mailto:redhat-list-request@;redhat.com?subject=unsubscribe https://listman.redhat.com/mailman/listinfo/redhat-list