'Fix' for Proc::ProcTable

"Jerry D. Hedden" <[email protected]> Wed, 26 May 2004 15:30:53 -0400
Newsgroups gmane.os.cygwin.perl
Message-ID <[email protected]>
The Proc::ProcessTable module is used to provide information on
processes similar to what might be found using the 'ps' command.  I
found that under Cygwin, Proc::ProcessTable is 'broken' with respect
to Cygwin processes, namely, 'pid' is the Windows PID (not the Cygwin
PID) and 'ppid' is usually just set to 0 or 1.

Delving into the module's code, I found that, for Cygwin,
Proc::ProcessTable uses the code for the 'ps' command.  However, 'ps'
has two 'modes' under Cygwin:  Cygwin ('ps') and Windows ('ps -W'). 
The problem is that Proc::ProcessTable is using the 'Windows mode'.

The following patch will fix Proc::ProcessTable so that it 'properly'
reports on Cygwin processes:

### CUT HERE ###

*** os/cygwin.c.orig    Wed May 26 14:56:54 2004
--- os/cygwin.c Wed May 26 14:56:56 2004
***************
*** 181,187 ****
  {
    external_pinfo *p;
    int uid;
!   cygwin_getinfo_types query = CW_GETPINFO_FULL;
    char ch;
    int pid;
    char *pstate;
--- 181,187 ----
  {
    external_pinfo *p;
    int uid;
!   cygwin_getinfo_types query = CW_GETPINFO;
    char ch;
    int pid;
    char *pstate;
***************
*** 253,259 ****
        if (query == CW_GETPINFO_FULL) {
                fields = "iiiiisiis";
        } else {
!               fields = "iiiiisIis";
        }
  
        bless_into_proc(fields, Fields, 
--- 253,259 ----
        if (query == CW_GETPINFO_FULL) {
                fields = "iiiiisiis";
        } else {
!               fields = "iiiiisiis";
        }
  
        bless_into_proc(fields, Fields, 

### CUT HERE ###

The only downside is that this patched version will not report on
Windows processes - just Cygwin processes.

=====
Jerry D. Hedden
<< If you're not having fun, then you're not doing it right! >>



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/ndFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/cygwin-perl/

<*> To unsubscribe from this group, send an email to:
     [email protected]

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/