www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/06/27/11:49:42

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <d37422b50806270849v1f679f44m2f025ee4a1776c8a@mail.gmail.com>
Date: Fri, 27 Jun 2008 18:49:11 +0300
From: "Borislav Ivanov" <borislav DOT g DOT ivanov AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Get the cygwin PID of a Win PID
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019