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: Get the cygwin PID of a Win PID


>>> bash-3.2$ ps -W | grep mysql
>>>       992    4572     992       5900  con  500 14:35:13
>>> /drives/d/mysql/bin/mysqld-nt
>>>      5900       0       0       5900    ?    0 14:35:14
>>> d:\mysql\bin\mysqld-nt.exe
>
>ps -W does not have a perfect algorithm for knowing when to mask the
>windows process but it seems like you should be able to just ignore the
>line which has a '?' in it.

Well I just noticed that the other line in ps (with different win pid
and cygwin pid) displays the actual cygwin pid (992) that when passed
to my program gave the expected result from 1.3. This means that
kill(992, 0) returns -1 for not running process and != -1 for running
process. Since mysql saves the win pid (5900) in its pid file and ps
somehow finds out the corresponding cygwin pid (992) (the line with no
'?') I thought that there's some method to retrieve it and keep my
program's past behaviour with minimal change.

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