From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from m0.truegem.net (m0.truegem.net [69.55.228.47]) by sourceware.org (Postfix) with ESMTPS id 3A6463858422 for ; Wed, 6 Mar 2024 00:08:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3A6463858422 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=maxrnd.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=maxrnd.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3A6463858422 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=69.55.228.47 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 Received: (from daemon@localhost) by m0.truegem.net (8.12.11/8.12.11) id 4260EEY6000429 for ; Tue, 5 Mar 2024 16:14:14 -0800 (PST) (envelope-from mark@maxrnd.com) Received: from 50-1-245-188.fiber.dynamic.sonic.net(50.1.245.188), claiming to be "[192.168.4.101]" via SMTP by m0.truegem.net, id smtpdAnJVnt; Tue Mar 5 16:14:12 2024 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@cygwin.com References: <00ca6f45-aef6-4d0c-9440-8a00b2de487a@SystematicSW.ab.ca> Content-Language: en-US From: Mark Geisert In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 List-Id: 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