delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/04/20/03:16:25

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6B91A385772E
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1681974936;
bh=HXScskKppK5apZEJrhkeN3PnHnxsVz4ou4S7gVlJdNU=;
h=Date:To:Cc:Subject:References:In-Reply-To:List-Id:
List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
From:Reply-To:From;
b=W5wb4n7Y+4epiraQQTPAs+wm+WhYDSh634SUkeJ74z5XBLg5OIfklBVrtFseSZup4
oAOKjrty+L+sEmOUCFoh2CIU6SsTwee6WGVbFe62eBEHs+xBWeFbToo7nKA1hPhoka
93hrakalUuZvEYCRAJM0SIVUdZviTB0b6nfbuOrY=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EBEA03858D37
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-Spam-Language: en
X-Spam-Relay-Country:
X-Spam-DCC: B=MGTINTERNET; R=smtp1.atof.net 1170; Body=1 Fuz1=1 Fuz2=1
X-Spam-RBL:
X-Spam-PYZOR: Reported 0 times.
Date: Thu, 20 Apr 2023 03:14:50 -0400
To: Bruno Haible <bruno AT clisp DOT org>
Cc: cygwin AT cygwin DOT com
Subject: Re: posix_spawn facility
Message-ID: <ZEDmai2kO+dfxWut@xps13>
References: <1752276 DOT 7aRn1RRit1 AT nimes> <ZD0O442kk5d7VKrx AT calimero DOT vinschen DOT de>
<5022555 DOT upeRZZJTqa AT nimes>
MIME-Version: 1.0
In-Reply-To: <5022555.upeRZZJTqa@nimes>
X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS,
SPF_HELO_NONE, SPF_PASS, TXREP,
T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
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: "gs-cygwin.com--- via Cygwin" <cygwin AT cygwin DOT com>
Reply-To: gs-cygwin DOT com AT gluelogic 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>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 33K7G09W020979

On Mon, Apr 17, 2023 at 08:44:51PM +0200, Bruno Haible via Cygwin wrote:
> Btw, there are two more functions in the posix_spawn family meanwhile:
>   * posix_spawn_file_actions_addchdir_np
>     implemented by glibc [1], musl libc, macOS, FreeBSD [2], Solaris ≥ 11.3
>     used by a few packages (Firefox, Chromium, Rust)
>   * posix_spawn_file_actions_addfchdir_np
>     implemented in glibc, musl libc
>     but not used by any package so far [3].
> 
> The next POSIX will contain these functions (without the _np suffix).[4]
> 
> Bruno
> 
> [1] https://sourceware.org/bugzilla/show_bug.cgi?id=17405
> [2] https://man.freebsd.org/cgi/man.cgi?query=posix_spawn_file_actions_adddup2&apropos=0&sektion=3&manpath=FreeBSD+11-current&format=html
> [3] https://codesearch.debian.net/
> [4] https://www.austingroupbugs.net/view.php?id=1208

With regards to [3] above, the next lighttpd release (lighttpd 1.4.70)
will use posix_spawn_file_actions_addfchdir_np(), where available, for
spawning CGI programs.

I have not yet tested under cygwin, but under Linux the overhead of
initial CGI process creation can be greatly reduced by using
posix_spawn() instead of fork(),execve().  The speedup is inversely
proportional to how much work the target script performs (compared to
the overhead of initial process creation).  On x86_64 Linux, running a
minimal C program for CGI can be ~60% faster in lighttpd when using
posix_spawn()!  When running a minimal /bin/sh program for CGI, the
speedup is "only" ~20%!  (Those numbers were obtained from running
h2load and weighttp microbenchmarks with the minimal CGI programs.)

minimal C program for CGI (compiled gcc -O3):
  #include <unistd.h>
  static const char resp[] = "Status: 200\n\n";
  int main(void) { write(STDOUT_FILENO, resp, sizeof(resp)-1); return 0; }

minimal /bin/sh program for CGI:
  #!/bin/sh
  printf 'Status: 200\n\n'

Cheers, Glenn

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