delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/02/08/10:54:37

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
Message-ID: <4208E0AC.5030206@x-ray.at>
Date: Tue, 08 Feb 2005 16:54:20 +0100
From: Reini Urban <rurban AT x-ray DOT at>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; de-AT; rv:1.7) Gecko/20040616
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
CC: libwin32 AT perl DOT org
Subject: Re: perl winpid?
References: <42065552 DOT 4050504 AT x-ray DOT at> <Pine DOT GSO DOT 4 DOT 61 DOT 0502061812190 DOT 10939 AT slinky DOT cs DOT nyu DOT edu> <42076A6C DOT 90404 AT x-ray DOT at> <20050208063131 DOT GA3096 AT efn DOT org> <42089E17 DOT 8070000 AT familiehaase DOT de> <4208D121 DOT 3010502 AT x-ray DOT at>
In-Reply-To: <4208D121.3010502@x-ray.at>
X-IsSubscribed: yes

Reini Urban schrieb:
> Gerrit P. Haase schrieb:
>> Yitzchak Scott-Thoennes wrote:
>>> On Mon, Feb 07, 2005 at 02:17:32PM +0100, Reini Urban wrote:
>>>> Igor Pechtchanski schrieb:
>>>>> On Sun, 6 Feb 2005, Reini Urban wrote:
>>>>>
>>>>>> I feel quite stupid now, but found nothing simple.
>>>>>> How to get the winpid from the current process in cygwin's perl?
>>
>>>> We will check out there where this cygwin specific functionality
>>>> will go to.
>>>> Win32::Process::CygwinToWin32ProcessID() is my suggestion.
>>
>>> I'd rather see them in the Proc:: namespace, and I think it would make
>>> sense to put them in perl's cygwin.c itself, if Gerrit is willing to
>>> release yet another perl-5.8.6.  If this sounds OK, I'll come up with
>>> a patch.
>>
>>
>> I have no problem with another release.  And I agree that such important
>> functions should go inside perl.

I've found the need functionality buried in Proc::ProcessTable.
Both pid's are populated for all windows processes.

$ perl -MProc::ProcessTable -e '$t = new Proc::ProcessTable;
map { print $_->fname, "\t", $_->pid, "\t", $_->winpid,"\n"; }
     @{$t->table}'
/usr/bin/cygrunsrv      572     572
/usr/bin/cygrunsrv      840     840
C:\WINNT\Explorer.EXE   1220    1220
f:\cygnus\bin\perl.exe  2284    2284
f:\cygnus\bin\sh.exe    2708    2708
f:\cygnus\bin\less.exe  2920    2920
f:\cygnus\bin\perl.exe  2608    2608

But the cygwin pid's seem to be wrong.
Some cygwin processes are not detected as such, so the pids are listed 
as winpid's.
And fname is printed as windows path for those processes, though it 
should be printed as cygwin path.
I'll complain upstream.

> Then we won't have to pollute the Win32::Process namespace with this 
> cygwin-only functionality. And we don't have to wait for the still 
> unmaintained libwin32 upstream.
> 
> README.cygwin, cygwin/cygwin.c:
> =item cygwin32_winpid_to_pid($pid)
> 
> Returns the windows process ID for the given cygwin pid. cygwin-only.
> 
> =item cygwin32_pid_to_winpid($pid)
> 
> Returns the cygwin process ID for the given windows pid. cygwin-only.
> 
> 
> Or as seperate Proc::Cygwin package, which could be maintained at CPAN 
> and go to vendor_perl within gerrit's perl package?
> 
>   Proc::Cygwin::Win32ProcessID($pid)
>   Proc::Cygwin::CygwinProcessID($winpid)

-- 
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/

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