This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: perl winpid?


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@perl.org list,
the perl-win32-porters@listserv.ActiveState.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]