Subject: RE: problems in Perl process management
From: Sonam Chauhan <[email-masked]>
To: "[email-masked]'" <[email-masked]>
Date: Wed, 18 May 2005 15:31:36 +1000

Thanks for raising 'ps -W' behavior Chris. It is interesting.

> >From what I gather, the root problem is that for some processes (as
> >demonstrated by my testcase script), the CW_GETPINFO_FULL query returns:
> >1. Invalid PPIDs
> 
> Only PPIDs for cygwin processes are returned.  Everything else should be
> 0.

This isn't happening in my testcase - a Perl script that forks, then
executes `/bin/sleep` with a Perl backtick. Proc::ProcessTable (i.e.
CW_GETPINFO_FULL) returns invalid PPID (0) and PID (the WINPID) for the
child sleep process, but it does returns correct PID and PPID data for the
fork-ed Perl parent processes.

The PID/PPID of the backticked sleep process shows up correctly in 'ps'.

Would this be an issue within CW_GETPINFO_FULL? 

> >2. WINPID instead of Cygwin PID.
> 

> A cygwin pid can actually be spread across two processes.  You see this
> with
> "ps -W" if you do something like:
> 
>   bash -c "exec sleep 20"
> 
> in one window and:
> 
>   ps -W
> 
> in another window.

I tried this but don't see what you mean. Here, in one window, I do:
=======================
$  bash -c "exec sleep 20"
=======================

In the second window, 'ps -W' only reports the PID & PPID for a single sleep
process:
===================================
$ ps  -W | grep sleep
     1012       0       0       1012    ?    0 14:57:51
C:\cygwin\bin\sleep.exe
===================================

However, instead of sleep, if I run a windows program like calc.exe in the
background, ps -W reports two processes: Was this what you meant about the
cygwin pid being spread across two processes?

===================================
$ calc &
[1] 2380

$ ps -W | grep calc
     2380    3780    2380       3604    0  400 15:18:21
/cygdrive/c/WINDOWS/system32/calc
     3604       0       0       3604    ?    0 15:18:22
c:\WINDOWS\system32\calc.exe
===================================

Regards,
Sonam Chauhan
-- 
Electronic Commerce, Corporate Express Australia Ltd.
Phone: +61-2-9335-0725, Email: [email-masked]

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

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