delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/04/24/03:27:39

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=BAYES_00,FORGED_YAHOO_RCVD,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <23211293.post@talk.nabble.com>
Date: Fri, 24 Apr 2009 00:27:22 -0700 (PDT)
From: nachum <nkanovsky AT yahoo DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: pstree on windows xp - find process spawned from windows process
In-Reply-To: <49F125A2.20400@cygwin.com>
MIME-Version: 1.0
References: <23197461 DOT post AT talk DOT nabble DOT com> <49F0B2B9 DOT 7000804 AT cygwin DOT com> <23205009 DOT post AT talk DOT nabble DOT com> <49F0E6B3 DOT 7030607 AT cygwin DOT com> <op DOT usu3drb81e62zd AT merlin DOT emma DOT line DOT org> <49F125A2 DOT 20400 AT cygwin DOT com>
X-IsSubscribed: yes
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

>>>>>> Hi, I'm new to cygwin, and I am beginning to like it. I am having
>>>>>> trouble
>>>>>> though with child processes that have only Windows PIDs and not
>>>>>> cygwin
>>>>>> PIDs.
>>>>>>
>>>>>> When I run Xilinx bitgen from cygwin 2 processes are run both with
>>>>>> the
>>>>>> name
>>>>>> bitgen.exe. Below I am running bitgen through make.
>>>>>>
>>>>>>       PID    PPID    PGID     WINPID  TTY  UID    STIME COMMAND
>>>>>> S    3936    2836    3936       2380    0 12696 19:54:49
>>>>>> /usr/bin/make
>>>>>> S     808    3936    3936       2852    0 12696 19:54:49
>>>>>> /cygdrive/c/Xilinx/10.1/ISE/bin/nt/bitgen
>>>>>>      2852       0       0       2852    ?    0 19:54:49
>>>>>> c:\Xilinx\10.1\ISE\bin\nt\bitgen.exe
>>>>>>       504       0       0        504    ?    0 19:54:49
>>>>>> c:\Xilinx\10.1\ISE\bin\nt\unwrapped\bitgen.exe
>>
>>> Since I'm not sure what Xilinx is doing, I can't really say.  Someone
>>> else
>>> here *might* be able to tell you, if they have run into the same thing
>>> either with Xilinx or some other native Windows app.  But since this
>>> probably has more to do with Xilinx's particular implementation and less
>>> to do with Cygwin proper, this would be off-topic for this list.  That's
>>> one of the reasons why I was suggesting talking to the Xilinx folks.  
>>> That
>>> and the fact that they should know exactly what they're doing, why, and
>>> how you might track it.
>>
>> Not entirely - the problem being that pstree always uses Cygwin PIDs
>> which are not necessarily the same as WINPIDs - it would be quite useful
>> if pstree had an option to display Windows PIDs.
>>
>> (In fact, I had to rewrite the PIDs in my pstree output of the git-svn
>> report on this list some hours earlier to the winpids to match the
>> sysinternals handle output...)
> 
> And that's benefit of open source. :-)  Perhaps you'd want to prepare
> a patch that you can offer to the upstream 'psmisc' maintainers to see if
> they want to incorporate your solution to your "itch".  If not and if all
> you need is something to tell you what the Windows PID is for a particular
> Cygwin PID, you do have 'ps' as well, as you've noted above.  It's also
> worthwhile to note that Cygwin PIDs differ from Windows PIDs only when
> there
> is a need to 'fork'.  Since Windows doesn't do this and 'bitgen' is
> clearly
> a Windows app, the "two" PIDs will match in this case and will be the
> Windows PID, if that helps you.

Regarding forking - you can see from my first post that bitgen is spawning a
new process / PID and there is no way that I've found within cygwin to
identify which program is the parent of the new fork. PID 504 is the new
forked bitgen, and it has 0s for the PPID and PGID entries. The original
bitgen process appears twice under ps -W and they are clearly the same
process as can be seen from the WINPID in both processes. The reason I want
to know programmatically who the parent of the new bitgen process is so that
I don't end up killing a second parallel compilation.

I think part of the problem is that ps only lists one copy of bitgen, and
the only way to see the second bitgen is with ps -W. Somewhere cygwin is
losing track of bitgen's spawned process and therefore it's not showing up
with just ps.
-- 
View this message in context: http://www.nabble.com/pstree-on-windows-xp---find-process-spawned-from-windows-process-tp23197461p23211293.html
Sent from the Cygwin list mailing list archive at Nabble.com.


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