delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/02/08/01:31:57

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
Date: Mon, 7 Feb 2005 22:31:31 -0800
From: Yitzchak Scott-Thoennes <sthoenna AT efn DOT org>
To: Reini Urban <rurban AT x-ray DOT at>
Cc: cygwin AT cygwin DOT com, libwin32 AT perl DOT org, gp AT familiehaase DOT de
Subject: Re: perl winpid?
Message-ID: <20050208063131.GA3096@efn.org>
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>
Mime-Version: 1.0
In-Reply-To: <42076A6C.90404@x-ray.at>
User-Agent: Mutt/1.4.1i
Organization: bs"d
X-IsSubscribed: yes

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 libwin32 AT perl DOT org list,
> the perl-win32-porters AT listserv DOT ActiveState DOT com 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019