delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/03/04/01:45:35

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8F98D3858409
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1709534734;
bh=ehk8/xCMXPBDT/83kOIKPjETl0SJfpCiKoTybOP+qzU=;
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=ZFU/hVwZ3SXqmVt4pv1HF9ye75Y7od6CZEY61Nc/mDDsG5Xy2wrx7mMv84dT9Guct
IhM/eMDsbImKBI/ArxR/sW+bsNUSURvy7wUc+jOtaGL7WXzL0Xz4UWxBbKjPR/ZCNd
YNzOYTlCLXpbirrdd6fD+MQsm5UfUk4OquTkF8bc=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9C5FE3858D28
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9C5FE3858D28
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709534714; cv=none;
b=bQxgyufC1VsEFzxMhcBbTcBgjUiIu7ABdW2FQwSE/axlgfVa0BgDcoWmKUhKEuMVIeyhT7fqC84K8QUI7ZXq44gQI1FRonUscQ9If/pE5Le8VmWvkbbFfXi4FTEeZFKSeLWyNOBOUTTbswkF5U5hMW0cfK32kb6V3g7HjA6tHD4=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1709534714; c=relaxed/simple;
bh=FrhRPL99Tjaso0+eTm09CD27zKjjDTjnhY0L90hwJs4=;
h=Message-ID:Date:MIME-Version:Subject:To:From;
b=nADRmgnLP6Krm83lFfBN8lpB8Lx2zVYKQ/Q/p2n1TOYNkBirx414blhHHXc07C4IreI7II/h86aNwnl7WLD+/sFNDiaD2NJVsgZB3KtQSF+pS9Zq1xHG8q0qdtnTpQqHYfW/b8X5uG2jCDsr+2E5WyLFaUxdUPFYnAT1jnGiS0A=
ARC-Authentication-Results: i=1; server2.sourceware.org
Message-ID: <da003a14-a7ea-46d8-8ded-0f4e49290704@maxrnd.com>
Date: Sun, 3 Mar 2024 22:45:14 -0800
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: Native posix_spawn() in Cygwin?
To: cygwin AT cygwin DOT com
References: <CAAvCNcCSaRBKYwd8-bU_rRh+m9LajyAVSHi3vH_3iaxwg1GE-Q AT mail DOT gmail DOT com>
<00ca6f45-aef6-4d0c-9440-8a00b2de487a AT SystematicSW DOT ab DOT ca>
<CAAvCNcDeYwhpq4Q9ftRgq3oErZNiS=x7DaLr-Lt6gAzG-npGfA AT mail DOT gmail DOT com>
<Zd2ChRq46MUMv0rU AT xps13>
<CAAvCNcBTRkJuD52dZsPePAG_yK_cBc=Ps4QPeG1BBXdZp5OYdg AT mail DOT gmail DOT com>
In-Reply-To: <CAAvCNcBTRkJuD52dZsPePAG_yK_cBc=Ps4QPeG1BBXdZp5OYdg@mail.gmail.com>
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
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Mark Geisert via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Mark Geisert <mark AT maxrnd DOT com>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On 3/3/2024 7:27 PM, Dan Shelton via Cygwin wrote:
> On Tue, 27 Feb 2024 at 07:34, <gs-cygwin DOT com AT gluelogic DOT com> wrote:
>>
>> On Tue, Feb 27, 2024 at 06:54:42AM +0100, Dan Shelton via Cygwin wrote:
>>> On Tue, 27 Feb 2024 at 06:47, Brian Inglis via Cygwin <cygwin AT cygwin DOT com> wrote:
>>>>
>>>> On 2024-02-26 20:23, Dan Shelton via Cygwin wrote:
>>>>> Does Cygwin implement a native, i.e. without form(),exec(), implementation of posix_spawn()?
>>>>
>>>> Check the API compatibility docs online:
>>>>
>>>>          https://cygwin.com/cygwin-api/compatibility.html#std-susv4
>>>>
>>>> or optional locally installed package cygwin-doc:
>>>>
>>>>          /usr/share/doc/cygwin-doc/html/cygwin-api/compatibility.html#std-susv4
>>>
>>> That document does not answer my question.
>>>
>>> I know posix_spawn() is there. But the question is: Does it use just
>>> Cygwin fork(),exec(), or the native Win32 spawn() api?
>>>
>>> Dan
>>> --
>>> Dan Shelton - Cluster Specialist Win/Lin/Bsd
>>
>> If you were going to make a small effort to answer the question
>> yourself, you could use strace, you could step through a debugger, or
>> you could check the source code.  Have you tried any of these?  What did
>> you find?  If you are unable to take any of those steps, why does
>> posix_spawn() matter to you?
> 
> 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.

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019