delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/03/05/17:43:23

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 56AA238582A7
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1709678602;
bh=+9ek70w6uaWkEVXjEYx0sOY0t1BhRM/QJ5tw9x9hCec=;
h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=hAiicqSYx04FBcwpWklGK9jGX4LrlSWthW7xj2KuRwXiBJBvXR1m6tR/EHZWB6aaJ
X0vWb1Eou+F+DhTdf9s4ttcWeTnstbCcGSoOnZU8XgAMYZYxdV0dvaoKqZVylnMNNq
gfDreGhvTsBsFkRxbWU/TjBJJPbVj2s9kcCKAL1o=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D3E903858C52
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D3E903858C52
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709678578; cv=none;
b=qslhdIUZeqSqWTsyUCxtGaAm5/cjKNX5RfcEG67iZNglENNBgq79dr/bkr6c0gWLSA2MqsEZv0xXD9PLHE1Q17Sojktz8Bo/C+lth/uUutwxLlWzkQUqExkh/WNVjW7wZPTYYYKhQhn5HngTSPENHF0VbUOQkhvu0nR0+r2+MnI=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1709678578; c=relaxed/simple;
bh=Q8GJzSOiWtcdSVWR47BmhMfShzqgToGFiQkRbTIfiHE=;
h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;
b=uDnGaEGClHkIXGfCWt46mKZ1rEUAZCuMakXsIWiMiy6hscAkohNoc4GrgTKIuUGstcAAJmp/gfyqMdGaWL2txUgElbaer/VYmg08EiXKLO252L0kqBwm35kNU3E5NXlimP1aVMJ55Er74n5UbifZjLT9GYx4FLOElaxOjSdE1M8=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1709678574; x=1710283374;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=uM386teoZuag8/gvfisprc1Xnoj8skN8S4iqNSB7eQ0=;
b=AHiRU7whoXdhBcMl8a8qCpUU8mhyXIljyu5+cE2G0J+ljKi0/PSeQ7vlL/M6cGsaUG
HlAYdQKqzKKtbkz5KPtx2X0TR1X4G2/ott//pa0ZECT2VH4RcuOalBtlHAxNhFijiCLU
zG0PAw8h3DL3JMb/kxlAMq1/nNMSalMnQYNpvlAn7AaZUexaZ6WuyRtA+vEaZg+07WOp
sIB9e8QTDdwJxRsWBtv+i52jmkmXA6sAdR9ZiQq7KVUvLuOiPKPPkx2UlZeWYFzD1ZXv
HRqDxKGq0bCVTJ4qwhMIj2q0Vh0ak5zLmWmsReNylcgi+8LJtKpbV9vojcJ8GoBwGQQ+
ajdQ==
X-Gm-Message-State: AOJu0YxPTlxa/ZY8qLC39KnCnF8C9A5FkHA5zMGCB7zuFHAeMA8a0KMV
YuKaXgca+EGaU/VHa05kGcTQHI/rGEEKEr97wysgZuyWqwkHR4UaGUZz8fQLo6XK4VHypZww4g/
uz7G8bGRtoX/uOXcI2t3epV2n7qLd1u/5
X-Google-Smtp-Source: AGHT+IGTpzguBkgmU0hCAdpy7uzaoTu1mbBmZCe3o+gvwI7jLOQ/yyFEKE87Yez0hvArqsd1GTeKnOaGrEbmUUo1KK0=
X-Received: by 2002:a05:6512:e94:b0:511:3262:464a with SMTP id
bi20-20020a0565120e9400b005113262464amr1407194lfb.30.1709678573828; Tue, 05
Mar 2024 14:42:53 -0800 (PST)
MIME-Version: 1.0
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>
<da003a14-a7ea-46d8-8ded-0f4e49290704 AT maxrnd DOT com>
In-Reply-To: <da003a14-a7ea-46d8-8ded-0f4e49290704@maxrnd.com>
Date: Tue, 5 Mar 2024 23:42:00 +0100
Message-ID: <CAAvCNcC6232r+r-a4fme_POrWis_e9yEgMXrLk00E1ptRbS7UA@mail.gmail.com>
Subject: Re: Native posix_spawn() in Cygwin?
To: cygwin AT cygwin DOT com
X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,
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-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: Dan Shelton via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Dan Shelton <dan DOT f DOT shelton AT gmail DOT com>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On Mon, 4 Mar 2024 at 07:45, Mark Geisert via Cygwin <cygwin AT cygwin DOT com> wrote:
>
> 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.

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.

posix_spawn() was added to POSIX so a Win32 implementation can use Win32 spawn()

Dan
-- 
Dan Shelton - Cluster Specialist Win/Lin/Bsd

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