delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/07/30/08:00:00

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 38A883857C41
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1596110359;
bh=Tl1RENazXpD3nNHkbgL58UxzY3SWRABcjHWKA8qDkBk=;
h=Date:From:To:Subject:References:In-Reply-To:List-Id:
List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
Reply-To:From;
b=pHQO37FD6jqps4uC2y8tQ/EkuktMV1CIFVECAd0Ylh8xVydTb9HczpIDfGNKsay9g
ORQGv3nOyDBGEQ0e/N1SUlPLkd+xxH/xCIcVXYB/TJ7HHJKcCyvtQbF/AejU5HCZ7b
DYVqRKi52/g7WTFhNXP7nip6Vczu55wI7tqShJl4=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9CF80384402D
Authentication-Results: sourceware.org;
dmarc=none (p=none dis=none) header.from=cygwin.com
Authentication-Results: sourceware.org;
spf=fail smtp.mailfrom=corinna-cygwin AT cygwin DOT com
Date: Thu, 30 Jul 2020 13:59:13 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Synchronization problem with posix_spawn
Message-ID: <20200730115913.GL4206@calimero.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <b1992e8b-d2e8-9c44-8f93-a270d5a879ed AT cornell DOT edu>
<864b3031-9fc8-beb3-ba7c-1ade4c31a288 AT cornell DOT edu>
MIME-Version: 1.0
In-Reply-To: <864b3031-9fc8-beb3-ba7c-1ade4c31a288@cornell.edu>
X-Provags-ID: V03:K1:d81XxkfzTeZd/Y0g5CTESvSLdL9AeOKl5B1FN1I7bh3fE9alPeM
55DTRWVJqx6p7RqHBaFTRbQq3SongVdH1UFspV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yEq37GlCCL5gQQ
GyAIYEGoNwcdEaoTyTZA==
X-Spam-Status: No, score=-99.7 required=5.0 tests=BAYES_00,
GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE,
RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL,
TXREP autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
server2.sourceware.org
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>
Reply-To: cygwin AT cygwin DOT com
Errors-To: cygwin-bounces AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 06UBxl95032603

On Jul 29 19:12, Ken Brown via Cygwin wrote:
> On 7/29/2020 4:17 PM, Ken Brown via Cygwin wrote:
> > posix_spawn(p) returns before the spawned process is fully up and
> > running.  [...]
> I just took a look at the source, and I see that posix_spawn was taken from
> FreeBSD.  Does FreeBSD have the same problem?  Should applications just be
> aware of this issue and insert a sleep after posix_spawn before sending
> signals?

Actually, this is a Cygwin problem.  I just had a look into the
newlib implementation myself, and it turns out that the code,
in particular the do_posix_spawn() function, is BSD specific.  It
relies on the BSD implementation of vfork(2).  Cygwin's vfork(2)
on the other hand, is NOT following the historic idea of the
BSD vfork(2), rather it's equivalent to fork(2).  This is
POSIX compliant, but certainly the reliance of the BSD vfork
behaviour makes do_posix_spawn() as it's implemented right now,
not overly functional for Cygwin.

IOW, we need a Cygwin-specific do_posix_spawn() using fork(2)
in conjunction with some synchronization the BSD function
gets "for free" by using its specific vfork(2).


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
--
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