delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-2.0 required=5.0 tests=BAYES_00,SARE_MSGID_LONG40,SPF_PASS |
X-Spam-Check-By: | sourceware.org |
MIME-Version: | 1.0 |
Date: | Mon, 4 Jan 2010 12:38:07 -0800 |
Message-ID: | <5b0039af1001041238y25c0eaa2g1fbe135fdfe62a60@mail.gmail.com> |
Subject: | procps returns parent's cmdline for a child process in cygwin 1.7.1 |
From: | Jonathan Schedler <jfschedler AT gmail DOT com> |
To: | cygwin AT cygwin DOT com |
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 |
I have updated to cygwin 1.7.1 from 1.5.x this morning. I have discovered that some of my scripts have started to fail. I am on Vista SP2. uname -a is returns: CYGWIN_NT-6.0-WOW64 Office-PC 1.7.1(0.218/5/3) 2009-12-07 11:48 i686 Cygwin My script starts a process in the background and then kills it later by searching the output of procps for the pid of the background process. After I upgraded to cygwin 1.7.1 this morning, I noticed that procps was returning two pids instead of one. I then examined the /proc filesystem and found the following results below. It shows that process 2940 is a child process of 6004 and that process 2940's cmdline is identical to its parent process command line. This is unexpected. The command line for 2940 (in my case) should actually be a typical java command containing a -cp arg and a java class name. Note that /proc/2940/exename does indeed contain a reference to my java.exe. Also note that the /proc/2940/exe symlink points to the java.exe as well. # cat /proc/6004/cmdline /usr/bin/bash /cygdrive/c/dev/voldemort-0.60/bin/voldemort-server.sh ../ce-contacts-model/target/classes/store/ # cat /proc/6004/exename /usr/bin/bash # cat /proc/2940/ppid 6004 # cat /proc/2940/cmdline /usr/bin/bash /cygdrive/c/dev/voldemort-0.60/bin/voldemort-server.sh ../ce-contacts-model/target/classes/store/ # cat /proc/2940/exename /cygdrive/c/sun/SDK/jdk/bin/java # ls -l /proc/2940/exe lrwxrwxrwx 1 Jon None 0 2006-11-30 16:00 /proc/2940/exe -> /cygdrive/c/sun/SDK/jdk/bin/java* It appears that procps is behaving correctly and is reading the incorrect contents of /proc/{pid}/cmdline for a child process (i.e. it containing its parents command line rather than its own). Furthermore, it doesn't appear there is a CYGWIN env var setting that affects what is stored in /proc/{pid}/cmdline. So, I think I am stuck. Jon -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |