delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/04/02/17:04:57

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=BAYES_00,J_CHICKENPOX_43,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <49D53676.8040208@pocock.com.au>
Date: Thu, 02 Apr 2009 23:04:38 +0100
From: Daniel Pocock <daniel AT pocock DOT com DOT au>
User-Agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: execve issues, and execve with cygrunsrv
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> <20090402160617 DOT GC12738 AT calimero DOT vinschen DOT de>
In-Reply-To: <20090402160617.GC12738@calimero.vinschen.de>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com


Corinna Vinschen wrote:
> 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:
>
>   
cygrunsrv definitely stays running when I start gmond.  It stops 
immediately after the execve call - it thinks the process has stopped, 
but in fact a new gmond is running with a new Windows PID.  I am using 
the -x option to cygrunsrv and the -f (foreground) and -p (pidfile) 
options to gmond.  Which PID does cygrunsrv look for?

>     #include <stdio.h>
>     #include <unistd.h>
>     #include <sys/types.h>
>     #include <sys/wait.h>
>     #include <windows.h>
>
>     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
>
>   

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019