This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: perl winpid?
Reini Urban schrieb:
Gerrit P. Haase schrieb:
Yitzchak Scott-Thoennes wrote:
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?
We will check out there where this cygwin specific functionality
will go to.
Win32::Process::CygwinToWin32ProcessID() is my suggestion.
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.
I have no problem with another release. And I agree that such important
functions should go inside perl.
I've found the need functionality buried in Proc::ProcessTable.
Both pid's are populated for all windows processes.
$ perl -MProc::ProcessTable -e '$t = new Proc::ProcessTable;
map { print $_->fname, "\t", $_->pid, "\t", $_->winpid,"\n"; }
@{$t->table}'
/usr/bin/cygrunsrv 572 572
/usr/bin/cygrunsrv 840 840
C:\WINNT\Explorer.EXE 1220 1220
f:\cygnus\bin\perl.exe 2284 2284
f:\cygnus\bin\sh.exe 2708 2708
f:\cygnus\bin\less.exe 2920 2920
f:\cygnus\bin\perl.exe 2608 2608
But the cygwin pid's seem to be wrong.
Some cygwin processes are not detected as such, so the pids are listed
as winpid's.
And fname is printed as windows path for those processes, though it
should be printed as cygwin path.
I'll complain upstream.
Then we won't have to pollute the Win32::Process namespace with this
cygwin-only functionality. And we don't have to wait for the still
unmaintained libwin32 upstream.
README.cygwin, cygwin/cygwin.c:
=item cygwin32_winpid_to_pid($pid)
Returns the windows process ID for the given cygwin pid. cygwin-only.
=item cygwin32_pid_to_winpid($pid)
Returns the cygwin process ID for the given windows pid. cygwin-only.
Or as seperate Proc::Cygwin package, which could be maintained at CPAN
and go to vendor_perl within gerrit's perl package?
Proc::Cygwin::Win32ProcessID($pid)
Proc::Cygwin::CygwinProcessID($winpid)
--
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/