DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 51HI7xrI3053189
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 51HI7xrI3053189
Authentication-Results: delorie.com;
	dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=L/rpICvj
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CA2C43858427
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1739815677;
	bh=al6tiBlxxZ4P4u+Au5x26XHPuFuhgKARIq4JC4IjaJc=;
	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=L/rpICvj1WrJhmrFH36339voz99TbN8++Sg/HTHBKkO3nhstYFCjwPA42sX/A00Iz
	 7EPtOgEWzkn3ofZqnaE9fxVL3rl+KWQl3LkzEMU3GVqGnlFpVSRs5I6truAgW77oI+
	 1ZCy1Jw0powH5C2KaaXj41ICPHS6pyJ1S2bvPMvA=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8C4B73858C78
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8C4B73858C78
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1739815641; cv=none;
 b=Q2uyzUBdaDuvYCZuQ5i/lMyVDzUh4FAlVFaW46obgzGkpH+M5sS1zn9068MqsKwdHp6/0g3/NAviVfV/OTVisdjfgYc01Fb5EhLbUr4yc13QRazqlAb7EtiYx6R63ddTmFonGpCks1/6rUWGh7rJsj/+FFxfE1WdNMqpHkp28f8=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1739815641; c=relaxed/simple;
 bh=T4S7HygrCkMrwflmiT0vqqBkier8J1a1B7roEUoY1tI=;
 h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;
 b=U1bsQHHUg8t08qSx3RbAOD9LxZdIZK72E+1T1QxydIO/ZBO+SbYIZ8WgfShcpy0FYRblRPdkTSI33wJGK3cgv8RQw3xwbSBgn4JXc4P7vByKRGN5oMT3w8D4Qcx9aleOyqH/CGEBtKW6/WNcdOOQfwemU44Xo66CUz4a1b1QlnA=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8C4B73858C78
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1739815640; x=1740420440;
 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=k35Do8WCZAMLoa/h4EbievV16HfR92e6HRbOPq5LVAg=;
 b=U4/8JX7NYfod+9p0ukCvY744dDXqoShriYYw9BLJXntxJK++l1etzN1kgbuhcP37rS
 MI0OyeaznFSYzB1grLE4bWDyRL77jZjr8goubxkeKxSUuoF0MKbFkcUPk0DYymqI6SaH
 Z6sZnj2CAqjhhc/GORnxO+t4A6TezI46x/BFpPkdlZsmfvthamTRk8GdPacJQXgMwYt+
 fmw/zWd4IPKXXh353Ztz2hHgvNtdQDRGrAQhod4QZw1P8OUJP3TcDOMgAjdcyH0vXjYb
 Kf/DDH3nuzmaW1iU329EDcSgcWrCDR2JYcneelWGQNdjQ7aGPs3Qwtz2luQ/MnG6D3EN
 4ULg==
X-Forwarded-Encrypted: i=1;
 AJvYcCWVBN9eiXyJpOMOTUUhReZ9ctmDS2YGoIrj96Wv7Qaj0Yer5jaEmdSSQiQ6KN7O2GRowL0+797T0xJA1gM1mQ==@cygwin.com
X-Gm-Message-State: AOJu0YxXsRvjVbitM36WMeE5OhUBlSlmltznac+bIAUNZem4jLvMZg6H
 6Vi7fKK2ZxkEpfmifQhrC+qXOWcJHBDvZhjCPqNQDpN+gRzmtwlBI7wGxo2DV4YpPiEOqlv+WuQ
 yiho0OknOtubyd6JOWtAa7fi8GUOgVw==
X-Gm-Gg: ASbGncv24sUlSm5/Wtf9MzAPZXRexeaJVxdiB4Few3ZItfYZ4x5Pzytgc7ibVdwI1fY
 1+FZ9TlITqLN3Oh5C4b9GV7v2j4sm7h8Jz4jf+s3ZkKst619iawlMv0BDrA3x9Ri4379Vw7VU
X-Google-Smtp-Source: AGHT+IHZcST/iKMnz4RmN9Ne9FGTrSSD97Q+AA7/PtOEF4rcWWuPebqLwGcC5356O4fXMe4OrAvCg7/PgCtdyR8+rDc=
X-Received: by 2002:a17:907:7f27:b0:ab6:53fb:9683 with SMTP id
 a640c23a62f3a-abb711c3735mr1038431566b.54.1739815639576; Mon, 17 Feb 2025
 10:07:19 -0800 (PST)
MIME-Version: 1.0
References: <20250216214657.2303-1-mark@maxrnd.com>
 <CAPJSo4VH0MufLhpgPiD1GV1gFsbTLdtOKrP82eaA_Yv_DHPXEQ@mail.gmail.com>
 <Z7MKkIbgMh0C5snl@calimero.vinschen.de>
In-Reply-To: <Z7MKkIbgMh0C5snl@calimero.vinschen.de>
Date: Mon, 17 Feb 2025 19:06:42 +0100
X-Gm-Features: AWEUYZkkLpRHNpFHufcoeKppJWs_H_YYymAWRvb0lleodt_tJj0FCZM8udDHXsw
Message-ID: <CAPJSo4WedM5V8uJD=j-XG6Rxueof2Wph6vUncqwa7XrX_iSkow@mail.gmail.com>
Subject: Re: WinAPI spawn() not used by Cygwin posix_spawn()? Re: [PATCH]
 Cygwin: Add spawn family of functions to docs
To: cygwin@cygwin.com, cygwin-patches@cygwin.com
X-BeenThere: cygwin@cygwin.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@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Lionel Cons via Cygwin <cygwin@cygwin.com>
Reply-To: Lionel Cons <lionelcons1972@gmail.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie.com@cygwin.com>

On Mon, 17 Feb 2025 at 11:08, Corinna Vinschen via Cygwin
<cygwin@cygwin.com> wrote:
>
> On Feb 16 23:33, Lionel Cons via Cygwin wrote:
> > On Sun, 16 Feb 2025 at 22:47, Mark Geisert <mark@maxrnd.com> wrote:
> > >
> > > In the doc tree, change the title of section "Other UNIX system
> > > interfaces..." to "Other system interfaces...".  Add the spawn family of
> > > functions noting their origin as Windows.
> >
> > re spawn() family: Cygwin posix_spawn() seems to rely on the rather
> > inefficient vfork(), while Opengroup intended it to be an API to
> > Windows spawn().
> >
> > Is there a technical limitation why Cygwin posix_spawn() cannot use
> > WinAPI spawn() directly?
>
> The requirements of posix_spawn and their helper functions are so
> that we can't easily fulfill them without doing the fork/exec
> twist.

How did UWIN do that? I did ask around - Glenn Fowler of AT&T Research
demonstrated a prototype of UWIN posix_spawn() before posix_spawn()
was finalised by the Austin Group as Opengroup POSIX standard. So this
IS possible, and because non fork() or page cloning has to be done it
should be significantly faster than the
fork()-and-throw-copied-data-away-at-exec() approach.

> See https://man7.org/linux/man-pages/man3/posix_spawn.3.html.> Windows CreateProcess() is not quite the same as Linux clone().

Here might be the misunderstanding:
posix_spawn() is intended NOT to copy anything except the file
descriptors and requested attributes, no memory pages and no
whatsoever. Everything should be done on the caller's process side,
nothing in the child process.

Lionel

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