Subject: Re: perl winpid?
From: Yitzchak Scott-Thoennes <[email-masked]>
To: Reini Urban <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked]
Date: Mon, 7 Feb 2005 22:31:31 -0800

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?
> >>
> >>$$ is the cygwin pid which is different from the windows pid
> >>GetCurrentProcessId().
> >
> >winpid = cygwin_internal(CW_CYGWIN_PID_TO_WINPID, pid) ?
> 
> Sure, but in any perl API?
> 
> There's apparently a new [email-masked] list,
> the [email-masked] list is almost 
> unmaintained for some years now.

The two lists have somewhat different purposes; see the descriptions
at http://lists.perl.org.

> We will check out there where this cygwin specific functionality
> will go to.
> Win32::Process::CygwinToWin32ProcessID() is my suggestion.
> 
> .pm:
> =item Win32::Process::CygwinToWin32ProcessID($pid)
> 
> Returns the windows process ID for the given cygwin pid.
> On non-cygwin platforms it will return the $pid argument without 
> translation.
> 
> =item Win32::Process::Win32ToCygwinProcessID($pid)
> 
> Returns the cygwin process ID for the given windows pid.
> On non-cygwin platforms it will return the $pid argument without 
> translation.
> 
> .xs:
> DWORD
> CygwinToWin32ProcessID(pid)
>     DWORD pid
> CODE:
> #ifdef __CYGWIN__
>     RETVAL = cygwin_internal(CW_CYGWIN_PID_TO_WINPID, pid);
> #else
>     RETVAL = pid;
> #endif
> OUTPUT:
>     RETVAL
> 
> DWORD
> Win32ToCygwinProcessID(pid)
>     DWORD pid
> CODE:
> #ifdef __CYGWIN__
>     RETVAL = (DWORD)cygwin32_winpid_to_pid(pid);
> #else
>     RETVAL = pid;
> #endif
> OUTPUT:
>     RETVAL

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.

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