DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 51HHdH2Q3038937
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 51HHdH2Q3038937
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=OBrr4Q6X
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A3AB93858401
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1739813956;
	bh=gbDifJkyjua86VJp5uAP8JkIaCkh0uei9CF9gb1bG7o=;
	h=Date:To:cc:Subject:In-Reply-To:References:List-Id:
	 List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
	 From:Reply-To:From;
	b=OBrr4Q6XNV/LHcmSZxmHzgDrBeF9xMk7sp32+kXEmACv+4exdlqtbJzcr5WCLuf4w
	 bdJzlj+7l3t43FdD+YLsCTHkRIEov51VPcXZqkoUCn3NoPDszI02gX/4JkhZ7K69Ga
	 qGc6/3vqZ9gUqaTXaFspCzo/bI7Gj+o4MkIs4/E4=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ADF553858C54
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org ADF553858C54
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1739813920; cv=none;
 b=n/uZTZvUYAYJ4ZPmPU51oaLI+drZfDRfH4fWp8npaKCS6VLIhJxX5vICoOmkCSQXh2+OQnoqpL4Bl6TpfN5IurUpn90FoGRdjOJ6woqpOliIwJNI6Ag8eM+llCFuPYRgiYq5yKcMFv1GJ1PG4zmrO87AQPbMpoooA/8nA2ukMBs=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1739813920; c=relaxed/simple;
 bh=AUQvUhF9qudrfmDysJ37wqSqV58tZm2Cl9gaJrGVmN4=;
 h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;
 b=gpvGH7mNPjwHqNyTJMGZlARcXHADnIm/VwoOVBDZKEbZYqt51IER8tfIyVFgnK4u+Qd5JxYVsCMonCPkPULj9a7oMVpBNK6jIfVOnXxX4pBkuZYqxwd83SQyAsLHC8NiJgcS4nS3anhJiSUd0ScNzxuFaI948nDmA+AGNG7ZGJc=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ADF553858C54
Date: Mon, 17 Feb 2025 09:38:40 -0800 (PST)
X-X-Sender: jeremyd@resin.csoft.net
To: cygwin@cygwin.com
cc: cygwin-patches@cygwin.com
Subject: Re: WinAPI spawn() not used by Cygwin posix_spawn()? Re: [PATCH]
 Cygwin: Add spawn family of functions to docs
In-Reply-To: <Z7MKkIbgMh0C5snl@calimero.vinschen.de>
Message-ID: <7ae72b46-ca96-092e-9cd6-aaa7f61b8a0e@jdrake.com>
References: <20250216214657.2303-1-mark@maxrnd.com>
 <CAPJSo4VH0MufLhpgPiD1GV1gFsbTLdtOKrP82eaA_Yv_DHPXEQ@mail.gmail.com>
 <Z7MKkIbgMh0C5snl@calimero.vinschen.de>
MIME-Version: 1.0
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
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: Jeremy Drake via Cygwin <cygwin@cygwin.com>
Reply-To: Jeremy Drake <cygwin@jdrake.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces~archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie.com@cygwin.com>

On Mon, 17 Feb 2025, Corinna Vinschen wrote:

> The requirements of posix_spawn and their helper functions are so
> that we can't easily fulfill them without doing the fork/exec
> twist.
>
> See https://man7.org/linux/man-pages/man3/posix_spawn.3.html.
> Windows CreateProcess() is not quite the same as Linux clone().
>
> However, if you think you can come up with a version only running the
> spawnve function and thus speed up Cygwin, feel free to send patches.

(based on my recollections rather than actually reading the docs again...)
Specifically, maybe the case where the attributes which are supposed to do
things effectively between fork and exec are not set could be fast-pathed
to use spawn/CreateProcess, and the more complex cases fall back to
fork/exec.  If the created process is also a Cygwin process, perhaps the
actions that are supposed to happen between fork and exec could happen in
the startup code (much like fork emulation).

Just brainstorming.

BTW, I vaguely remember an issue with GNU make in MSYS2, where we found
that making it *not* use posix_spawn made it faster.
https://github.com/msys2/MSYS2-packages/blob/a0902f1e21781022c5ceca44c64190998a62e048/make/PKGBUILD#L31-L32


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