delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/06/27/11:01:38

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Fri, 27 Jun 2008 11:01:11 -0400
From: Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Get the cygwin PID of a Win PID
Message-ID: <20080627150111.GA29404@ednor.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <d37422b50806270358u2410ac2bl221b420b423d7b27 AT mail DOT gmail DOT com> <20080627113019 DOT GB20180 AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <20080627113019.GB20180@calimero.vinschen.de>
User-Agent: Mutt/1.5.16 (2007-06-09)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On Fri, Jun 27, 2008 at 01:30:19PM +0200, Corinna Vinschen wrote:
>On Jun 27 13:58, Borislav Ivanov wrote:
>> Thank you again,
>> 
>> I looked further and found out that this happens when I start the
>> mysql-nt application from bash.
>> 
>> Here's the result when I start it from cmd - only one process listed
>> with equal cywgin and win PIDs:
>> 
>> D:>mysql\bin\mysqld-nt.exe --defaults-file=conf\mysql.conf
>> 
>> bash-3.2$ ps -W | grep mysql
>>      6044       0       0       6044    ?    0 13:24:25
>> D:\mysql\bin\mysqld-nt.exe
>> 	
>> And then the bash version:
>> 	
>> bash-3.2$ mysql/bin/mysqld-nt.exe --defaults-file=conf/mysql.conf
>> 
>> bash-3.2$ ps -W | grep mysql
>>       992    4572     992       5900  con  500 14:35:13
>> /drives/d/mysql/bin/mysqld-nt
>>      5900       0       0       5900    ?    0 14:35:14
>> d:\mysql\bin\mysqld-nt.exe
>> 
>> The funny thing is that with cygwin 1.3 both commands invoked only one
>> process. This is mysql 5.0.38. My question is: Is there a way to make
>> this work like in 1.3 (producing only one process with the same pid I
>> can use later), or I should look for a workaround?
>
>The process is apparently a native Windows process.  I don't know why it
>shows up twice when started from bash but since it's a native process,
>Cygwin's kill will not work as expected on it.  1.3 is long gone, and
>things have considerably changed since then.  I don't know the exact
>difference, but kill() is supposed to send a POSIX signal, which native
>applications have no idea about.  You should rather use the native
>taskkill command to kill native processes.

I can reproduce this behavior by running notepad.  -W is showing the
stub process, which has the cygwin pid, and, on another line, the actual
windows process.  I can't duplicate this with the windows version of
ping, though, strangely enough.

Killing the stub should cause the windows process to go away.

ps -W does not have a perfect algorithm for knowing when to mask the
windows process but it seems like you should be able to just ignore the
line which has a '?' in it.

I changed the pid handling somewhere along the line in the 1.5 series.
In 1.3, you could get a pid cascade where a cygwin process which execed
a cygwin process which execed a windows process would end up with at
least three processes waiting on each other.  I don't remember the
details now but the result of cleaning that up made "ps -W" a little
less predictable when dealing with windows processes.

cgf

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