delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/02/07/08:18:05

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: <42076A6C.90404@x-ray.at>
Date: Mon, 07 Feb 2005 14:17:32 +0100
From: Reini Urban <rurban AT x-ray DOT at>
Reply-To: libwin32 AT perl DOT org
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>
In-Reply-To: <Pine.GSO.4.61.0502061812190.10939@slinky.cs.nyu.edu>
X-IsSubscribed: yes

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.

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

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