delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/04/20/10:42:08

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CACB8385772E
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1682001688;
bh=AvPYLaySxVSoSQlKseHu4Uhit7WwJyvwHyeos5CMaE0=;
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=cUVOqbgdsgb5Tju8fBcVM/v+1RfmWmRv6lNpH3TnUVEeZKG1z1a0SQRiY/FK/juBy
nl4OlMOT3Ca+dYyuyT3PaL2J+N6S3uot002y2ZsiyzcRjMLtjnpnJL5hrIybJRqYyD
+69DnublqxcZE0vUeny+Y4wTMi8yTT2VTXSptymk=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1E4463858D37
Date: Thu, 20 Apr 2023 16:40:52 +0200
To: Bruno Haible <bruno AT clisp DOT org>
Subject: Re: posix_spawn facility
Message-ID: <ZEFO9ELNzIliSGPv@calimero.vinschen.de>
Mail-Followup-To: Bruno Haible <bruno AT clisp DOT org>, cygwin AT cygwin DOT com
References: <1752276 DOT 7aRn1RRit1 AT nimes> <ZEDmai2kO+dfxWut AT xps13>
<ZED5SOzW5QAkfxje AT calimero DOT vinschen DOT de> <1853259 DOT CQOukoFCf9 AT nimes>
<ZEFKW/rbAS8x4QbV AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <ZEFKW/rbAS8x4QbV@calimero.vinschen.de>
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
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: Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>, cygwin AT cygwin 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 Apr 20 16:21, Corinna Vinschen via Cygwin wrote:
> On Apr 20 12:18, Bruno Haible via Cygwin wrote:
> >      The "inheritable handles" is a data structure that allows for the
> >      arbitrary reshuffling of file descriptors required by posix_spawn
> >      (the addopen, adddup2, addclose actions), i.e. which does the book-
> >      keeping which HANDLE must in the end be open in the parent and which
> >      must in the end be open in the child, and at which position.
> 
> Hmm.  Your code uses lpReserved2 for that, but the functionality is
> one implemented in MSVCRT.  For obvious reasons, Cygwin executables
> are not linked against msvcrt.dll and we're using lpReserved2 for our
> own purposes.

Oh, btw., did you know that there's a newer mechanism for defining
specific inheritable handles to CreateProcess, which is implemented
in kernel32.dll, so it does not depend on MSVCRT?

There's a STARTUPINFOEX structure which allows to specify the 
additional handles.  See

https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-startupinfoexa

and the PROC_THREAD_ATTRIBUTE_HANDLE_LIST argument described in

https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-updateprocthreadattribute


Corinna

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