X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Thu, 2 Apr 2009 18:06:17 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: execve issues, and execve with cygrunsrv Message-ID: <20090402160617.GC12738@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <49D0B0CD DOT 6050009 AT pocock DOT com DOT au> <20090331112427 DOT GC12738 AT calimero DOT vinschen DOT de> <49D4D802 DOT 8040005 AT pocock DOT com DOT au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <49D4D802.8040005@pocock.com.au> User-Agent: Mutt/1.5.19 (2009-02-20) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 On Apr 2 16:21, Daniel Pocock wrote: > Corinna Vinschen wrote: >> Did you try? >> > I have now had a chance to try it under cygrunsrv from Cygwin 1.5.25 and 1.7 > > Under 1.5.25, it doesn't work because of the sockets issue > > Under 1.7, a new issue is revealed: execve doesn't maintain the same > process ID, so cygrunsrv thinks the service has actually stopped, and > the cygrunsrv process exits. This is obviously quite bad. Huh? The *Windows* PID is not the same after an exec, but the Cygwin PID is maintained after an exec. Try this: #include #include #include #include #include int main(int argc, char **argv) { int status; if (argc > 1) { printf ("Execed Child: Cygwin: %d Windows: %lu\n", getpid (), GetCurrentProcessId ()); return 0; } printf ("Parent: Cygwin: %d Windows: %lu\n", getpid (), GetCurrentProcessId ()); switch (fork ()) { case 0: printf ("Forked Child: Cygwin: %d Windows: %lu\n", getpid (), GetCurrentProcessId ()); execl ("./x", "x", "child", NULL); break; default: break; } wait (&status); return 0; } Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/