This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: pid confusion and pstree (Attn: User's Guide maintainer)
On Thu, 4 Aug 2005, Jason Pyeron wrote:
> On Thu, 4 Aug 2005, Igor Pechtchanski wrote:
>
> > On Thu, 4 Aug 2005, Jason Pyeron wrote:
> >
> > > On Thu, 4 Aug 2005, Igor Pechtchanski wrote:
> > >
> > > > On Thu, 4 Aug 2005, Jason Pyeron wrote:
> > > >
> > > > > sorry if this wraps.
> > > > >
> > > > > what is my WINPID for the current bash?
> > > > >
> > > > > [jpyeron@mrlaptop mysql-4.1.13.new]$ ps -W | head -1 && ps -W | grep bash && pstree -Ahup
> > > > > PID PPID PGID WINPID TTY UID STIME COMMAND
> > > > > I 2356 1 2356 2356 con 1003 Jul 31 /usr/bin/bash
> > > > > 260 0 0 260 ? 0 Aug 3 C:\cygwin\bin\bash.exe
> > > > > 484 0 0 484 ? 0 Aug 3 C:\cygwin\bin\bash.exe
> > > > > 3004 0 0 3004 ? 0 Aug 3 C:\cygwin\bin\bash.exe
> > > > > 456 0 0 456 ? 0 Aug 3 C:\cygwin\bin\bash.exe
> > > >
> > > > "ps -W" may not be aware of the Cygwin PID for some processes.
> > > > How about "/bin/ps | head -1 && /bin/ps -a | grep $$" instead?
> >
> > Yes, the Cygwin PID and the WINPID are different in most cases. Doesn't
> > the command I suggested show the right WINPID for the current bash?
>
> if there is a -aW then no, -a yes
That's why I said "-a", not "-aW"... :-)
> hmmm? why are there zeros on the PGID, and why when using -W does PID change
> to WINPID? BUG?
See "man ps" and <http://cygwin.com/cygwin-ug-net/cygwin-ug-net.html#ps>.
> [jpyeron@mrlaptop mysql-4.1.13.new]$ ps | head -1
> PID PPID PGID WINPID TTY UID STIME COMMAND
> [jpyeron@mrlaptop mysql-4.1.13.new]$ ps -a | grep 1592
> 1592 228 1592 456 3 1003 Aug 3 /usr/bin/bash
> S 2872 1592 2872 3124 3 1003 14:58:27 /usr/bin/pico
> 2464 1592 3316 2464 3 1003 16:27:32 /usr/bin/bash
> 3316 1592 3316 2472 3 1003 16:27:32 /usr/bin/ps
There you go, it works.
> [jpyeron@mrlaptop mysql-4.1.13.new]$ ps -W | grep 456
> 456 0 0 456 ? 0 Aug 3 C:\cygwin\bin\bash.exe
> [jpyeron@mrlaptop mysql-4.1.13.new]$ ps -aW | grep 456
> 456 0 0 456 ? 0 Aug 3 C:\cygwin\bin\bash.exe
> [jpyeron@mrlaptop mysql-4.1.13.new]$
-W means "all Windows processes". IIRC, the "-a" is ignored when -W is
specified.
HTH,
Igor
P.S. Note to the UG maintainer: Joshua, there's a typo in the description
of "ps" on the above referenced page: "synonomous" should be "synonymous".
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha@cs.nyu.edu
ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.com
|,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D.
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA
--
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/