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: Strange fork/exec bug, two processes instead of one are created


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Papasha on 10/23/2006 2:57 AM:
> 
> I use it to launch a program compiled using MSVC++ 2005:
> 
> It starts, everything is ok, but in windows TaskMan I see something like
> this:
> spawner.exe
> spawner.exe
> testproj.exe

To be expected.  The only way that cygwin processes can get accurate
tracking of the exit code of non-cygwin processes is to invoke a stub
process that waits for the exit of the Windows process.  So one of those
two spawner.exe is the cygwin stub that is waiting for the other to exit
to keep cygwin state consistent.

> 
> I have 2 copies of spawner.exe running, It seemed to me so, but after I ran
> "ps -W" under cygwin I got:
> 
>     PID     PPID    PGID     WINPID  TTY  UID    STIME COMMAND
>     2576    2928    2576       3260  con 1003 12:06:07 .../spawner
>     2424    2576    2576       3472  con 1003 12:06:07 .../testproj
> 
>     3472       0       0       3472    ?    0 12:06:07
> C:\cygwin\...\testproj.exe (where did it come from ???)
> 
> It looks like second spawner.exe is not actually a spawner.exe, but another
> testproj.exe. Note that first testproj and second testproj have the same
> WINPID, but different PIDs and the PID of second testproj = WINPID of first
> testproj.

Also to be expected - a process can change its name after creation.  But
the stub process is a cygwin process, in fact, it is an image of the
process that forked; it just changes its name to the non-cygwin process
that it is tracking.

> 
> And ran:
> ./spawner.exe testproj_cyg.exe
> 
> And everything was ok, I had one copy of spawner.exe and one copy of
> testproj_cyg.exe

To be expected - cygwin processes can communicate with each other without
having to resort to stub processes.

- --
Life is short - so eat dessert first!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFPLS884KuGfSFAYARAo/0AKDH370MD6r4eItsW3DTUAb2ribzxwCfVdKM
xMmeA17n36Q6jN+7wnkgtkg=
=omxs
-----END PGP SIGNATURE-----

--
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/


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