X-Spam-Check-By: sourceware.org Message-ID: <453CB5BF.7000803@byu.net> Date: Mon, 23 Oct 2006 06:29:51 -0600 From: Eric Blake User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.666 MIME-Version: 1.0 To: cygwin AT cygwin DOT com, papasha_papovich AT mail DOT ru Subject: Re: Strange fork/exec bug, two processes instead of one are created References: <001701c6f681$3b2ee160$125110ac AT sheffpc> In-Reply-To: <001701c6f681$3b2ee160$125110ac@sheffpc> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com -----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 AT byu DOT 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/