diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2023-04-19 17:59:01 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2023-05-03 23:11:35 -0400 |
commit | fd142a53ebab66e6d2057a84485a1812499e9410 (patch) | |
tree | 3ab2901f14309dc042fb9a269b066d3f0bb35bf4 /src/CMakeLists.txt | |
parent | 5ca09e56a79a365d20f480e8900c12d442ecec4a (diff) | |
download | lighttpd-git-fd142a53ebab66e6d2057a84485a1812499e9410.tar.gz |
[core] use posix_spawn() where available
use posix_spawn() where available
use posix_spawn_file_actions_addfchdir_np() where available
Using posix_spawn() reduces initial execution overhead of CGI programs;
posix_spawn() is often faster than application code wrapping and calling
traditional fork(),execve().
(history: fdevent.c posix_spawn code based on fdio.c:fdio_ipc_spawn()
from 2015 on one of my unpublished branches. The inability to chdir()
delayed inclusion in lighttpd, as the CGI specification says:
"The current working directory for the script SHOULD be set
to the directory containing the script."
e.g. chdir() to target program directory before CGI execution)
posix_spawn_file_actions_addfchdir_np() is a new(er) extension supported
in glibc 2.29+, musl libc, FreeBSD ≥ 13.1, macOS ≥ 10.15 according to
https://cygwin.com/pipermail/cygwin/2023-April/253505.html
https://cygwin.com/pipermail/cygwin/2023-April/253526.html
https://sourceware.org/bugzilla/show_bug.cgi?id=17405
POSIX Issue 8 plans to include posix_spawn_file_actions_addfchdir():
https://www.austingroupbugs.net/view.php?id=1208
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r-- | src/CMakeLists.txt | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d469d75c..d8b1da3e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -209,6 +209,12 @@ check_include_files(sys/select.h HAVE_SYS_SELECT_H) check_function_exists(select HAVE_SELECT) endif() +check_include_files(spawn.h HAVE_SPAWN_H) +if(HAVE_SPAWN_H) +check_function_exists(posix_spawn HAVE_POSIX_SPAWN) +check_function_exists(posix_spawn_file_actions_addfchdir_np HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR_NP) +endif() + set(CMAKE_EXTRA_INCLUDE_FILES time.h) check_function_exists(timegm HAVE_TIMEGM) set(CMAKE_EXTRA_INCLUDE_FILES) |