This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Get the cygwin PID of a Win PID
- From: "Borislav Ivanov" <borislav dot g dot ivanov at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Thu, 26 Jun 2008 16:31:20 +0300
- Subject: Get the cygwin PID of a Win PID
Hello,
I'm currently updating cygwin from 1.3.22 to 1.5.25 and I encountered
a problem with Winpids/Cygwinpids. I have a custom tool that checks if
a process is running by invoking kill(PID, 0). The PID is retrieved
from a PID file which all applications write on startup. On 1.3 I get
this:
d:\>ps -W | grep mysql
1860 0 0 1860 ? 0 15:54:44
c:\mysql\bin\mysqld-nt.exe
and on 1.5 I get:
D:\>ps -W | grep mysql
2744 1 1384 1980 ? 18 15:07:22
/drives/c/mysql/bin/mysqld-nt
1980 0 0 1980 ? 0 15:07:23
c:\mysql\bin\mysqld-nt.exe
On both 1.3 and 1.5 my pid file contains the Winpid. The difference
here is that on 1.3 kill(Winpid, 0) succeeds but on 1.5 fails with
errno=ESRCH, while kill(Cygwinpid, 0) behaves as expected.
I searched through the list, but found only transition from cygwinpid
to winpid (by using winpid = cygwin_internal(CW_CYGWIN_PID_TO_WINPID,
pid)). Is there some analogue to retrieve the corresponding cygwinpid
of a winpid?
Thank you,
Borislav Ivanov
--
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/