procps returns parent's cmdline for a child process in cygwin 1.7.1
Jonathan Schedler
jfschedler@gmail.com
Mon Jan 4 20:38:00 GMT 2010
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
More information about the Cygwin
mailing list