From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21197 invoked by alias); 27 Jun 2008 15:49:36 -0000 Received: (qmail 21187 invoked by uid 22791); 27 Jun 2008 15:49:35 -0000 X-Spam-Check-By: sourceware.org Received: from fk-out-0910.google.com (HELO fk-out-0910.google.com) (209.85.128.184) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 27 Jun 2008 15:49:14 +0000 Received: by fk-out-0910.google.com with SMTP id 18so472832fks.2 for ; Fri, 27 Jun 2008 08:49:11 -0700 (PDT) Received: by 10.78.154.1 with SMTP id b1mr481188hue.97.1214581751161; Fri, 27 Jun 2008 08:49:11 -0700 (PDT) Received: by 10.78.135.5 with HTTP; Fri, 27 Jun 2008 08:49:11 -0700 (PDT) Message-ID: Date: Sat, 28 Jun 2008 01:04:00 -0000 From: "Borislav Ivanov" To: cygwin@cygwin.com Subject: Re: Get the cygwin PID of a Win PID MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2008-06/txt/msg00604.txt.bz2 >>> 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/