Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 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> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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/