X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4BC043858287 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1709683729; bh=1If6gemVLTspT9rT+2C7vMqYx7wuTeICiLLN1AI2wRE=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=ee2Ct8lxyBcO7OfeSGopu2TJ5KvWUnOg0FWjCCHpe74iJI8S4GFwxNDaFjg2o5GGS X7amjnonkU9MVK+wsMsQXaHqw1XpC9VyiKvDQ2X0PT3ZHMQ8mp6FmXPY39avNrAlmv +r2MH8tNkPGMypi8Viv6HAPQcgXW/aWlndNDNmBs= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3A6463858422 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3A6463858422 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709683706; cv=none; b=uWs4lrFI1pnm9U1UvArsMAGU6Xb85iGFvEkdCDRl6O09zlPsoYymt48AnjJ6t4omt1HAvcdHjLehySO7o7dJ2Pm3U5kzAEPNk+SjrM8QlN2bHy+mDj5SOLbYjjE05fm0KmA1WzoDC/na9vRLsqUT7eTwljcQGA8ZzQoLEOTwIEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709683706; c=relaxed/simple; bh=4KN1osYgjIqNPmmFh+2zzzTmtbqMgvDsDNc0toPf774=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=w9in0zklQwpVliqK7X9lw3CtkZWIbXvrHHHz37UfI4/GbXDoZv3sY/Mg0yKqF8U7I0vixkCsBAK1a8nTsdXrPKQcTzjzCxiwYdVeiJ0FjKQUbD6xJ8ZTaKbHqNGlVa03KhFrRa3O4ew7W2ip3JJ9BsdihKpUA8VwR0b5GrYxETk= ARC-Authentication-Results: i=1; server2.sourceware.org Message-ID: <4ab591dc-6586-4879-94b1-a3c087af1d4f@maxrnd.com> Date: Tue, 5 Mar 2024 16:08:27 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Native posix_spawn() in Cygwin? To: cygwin AT cygwin DOT com References: <00ca6f45-aef6-4d0c-9440-8a00b2de487a AT SystematicSW DOT ab DOT ca> Content-Language: en-US In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mark Geisert via Cygwin Reply-To: Mark Geisert Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" On 3/5/2024 2:42 PM, Dan Shelton via Cygwin wrote: > On Mon, 4 Mar 2024 at 07:45, Mark Geisert via Cygwin wrote: >> >> On 3/3/2024 7:27 PM, Dan Shelton via Cygwin wrote: [...] >>> strace does not help, as I need the Win32 calls BELOW posix_spawn(), >>> to see the implementation details. >> >> Check the source code, then. It's at: >> https://cygwin.com/cgit/newlib-cygwin/tree/winsup/cygwin/fork.cc >> >> Look at line 587; there's the static function dofork(). Look at the >> thirty or so lines above that; there's both fork() and >> __posix_spawn_fork() calling dofork(). So both those user-level >> functions call into the exact same internals. (BTW __posix_spawn_fork() >> is called from posix_spawn(); the latter is in newlib and not Cygwin.) >> >> You can even see the reason it's done this way by reading the comment. > > Yes, but it is as I feared, Cygwin posix_spawn() does not use Win32 > spawn() at all, and instead uses a rather inefficient vfork() > solution. Cygwin's vfork() is just a wrapper around fork(), so yes. But anyway... > posix_spawn() was added to POSIX so a Win32 implementation can use Win32 spawn() ...now I see what you're getting at: If posix_spawn() is intended to launch truly unrelated processes, with minimal or no coordination with the launching process, why can't it just use Windows' CreateProcess? I assume here that's what Win32 spawn() does. That's an interesting research question for somebody. If somebody steps up for that, great, otherwise as usual PTC. Regards, ..mark -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple