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: procps returns parent's cmdline for a child process in cygwin 1.7.1


The following foo.sh script reproduces what I am seeing, using
notepad.exe instead of java.exe

#!/bin/bash

notepad &

procps -eF

If the above is in a file named foo.sh,  the output of procps -eF will be

Jon       5072  4756  0  1390  7548   0 14:08 tty0     00:00:00
/usr/bin/bash ./foo.sh
Jon       6012  5072  0   407  8576   0 14:08 tty0     00:00:00
/usr/bin/bash ./foo.sh
Jon       5716  5072  0  1185  6012   0 14:08 tty0     00:00:00 procps -eF

Notice the procps command shows up correctly.  So it seems I have an
issue displaying normal windows exe's in procps output.

Jon

On Mon, Jan 4, 2010 at 12:38 PM, Jonathan Schedler <jfschedler@gmail.com> wrote:
> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]