X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00 X-Spam-Check-By: sourceware.org Message-ID: <4AF00CED.2070005@esiee.fr> Date: Tue, 03 Nov 2009 11:58:53 +0100 From: Laurent Najman User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr-FR; rv:1.8.1.21) Gecko/20090403 SeaMonkey/1.1.16 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Parenthood seems to be lost when the parent is exeeced Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Hi, The parenthood seems to be lost when the parent is execed. Here is a sample code #include #include #include #include #include int main(int argc, char **argv) { int status; if (argc > 1) { printf ("Execed Parent: Cygwin: %d Windows: %lu \n", getpid (), GetCurrentProcessId ()); wait(NULL); printf("Parent has waited its child\n"); return 0; } switch (fork ()) { case 0: // Child sleep(1); printf("Child Cygwin: %d Windows: %lu Parent= %d has ended\n", getpid (), GetCurrentProcessId (), getppid()); break; default: // Parent printf ("Parent : Cygwin: %d Windows: %lu\n", getpid (), GetCurrentProcessId (), getppid()); execl ("./x", "x", "child", NULL); break; } return 0; } Here is the execution of the code Laurent Najman AT PC4354B /cygdrive/d/src/XXX $ gcc -o x x.c Laurent Najman AT PC4354B /cygdrive/d/src/XXX $ ./x Parent : Cygwin: 4308 Windows: 5080 Execed Parent: Cygwin: 4308 Windows: 4728 Parent has waited its child Laurent Najman AT PC4354B /cygdrive/d/src/XXX $ Child Cygwin: 4784 Windows: 4784 Parent= 1 has ended Normally, I would expect the parent to be 4308, and I would expect that parent to wait for its child. Is this cygwin behavior a normal behavior? Thanks in advance, Laurent Najman -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple