mirror of
https://review.haiku-os.org/buildtools
synced 2026-02-04 07:53:14 +01:00
libiberty: Use posix_spawn in pex-unix when available.
Hi, This patch implements pex_unix_exec_child using posix_spawn when available. This should especially benefit recent macOS (where vfork just calls fork), but should have equivalent or faster performance on all platforms. In addition, the implementation is substantially simpler than the vfork+exec code path. Tested on x86_64-linux. v2: Fix error handling (previously the function would be run twice in case of error), and don't use a macro that changes control flow. v3: Match file style for error-handling blocks, don't close in/out/errdes on error, and check close() for errors. libiberty/ * configure.ac (AC_CHECK_HEADERS): Add spawn.h. (checkfuncs): Add posix_spawn, posix_spawnp. (AC_CHECK_FUNCS): Add posix_spawn, posix_spawnp. * aclocal.m4, configure, config.in: Rebuild. * pex-unix.c [HAVE_POSIX_SPAWN] (pex_unix_exec_child): New function.
This commit is contained in:
committed by
Augustin Cavalier
parent
360fe2fd07
commit
7ab022f6e6
@@ -277,7 +277,7 @@ AC_SUBST_FILE(host_makefile_frag)
|
||||
# It's OK to check for header files. Although the compiler may not be
|
||||
# able to link anything, it had better be able to at least compile
|
||||
# something.
|
||||
AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h malloc.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h stdint.h stdio_ext.h process.h sys/prctl.h)
|
||||
AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h malloc.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h stdint.h stdio_ext.h process.h sys/prctl.h spawn.h)
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_HEADER_TIME
|
||||
|
||||
@@ -400,7 +400,8 @@ funcs="$funcs setproctitle"
|
||||
vars="sys_errlist sys_nerr sys_siglist"
|
||||
|
||||
checkfuncs="__fsetlocking canonicalize_file_name dup3 getrlimit getrusage \
|
||||
getsysinfo gettimeofday on_exit pipe2 psignal pstat_getdynamic pstat_getstatic \
|
||||
getsysinfo gettimeofday on_exit pipe2 posix_spawn posix_spawnp psignal \
|
||||
pstat_getdynamic pstat_getstatic \
|
||||
realpath setrlimit spawnve spawnvpe strerror strsignal sysconf sysctl \
|
||||
sysmp table times wait3 wait4"
|
||||
|
||||
@@ -423,7 +424,8 @@ if test "x" = "y"; then
|
||||
index insque \
|
||||
memchr memcmp memcpy memmem memmove memset mkstemps \
|
||||
on_exit \
|
||||
pipe2 psignal pstat_getdynamic pstat_getstatic putenv \
|
||||
pipe2 posix_spawn posix_spawnp psignal \
|
||||
pstat_getdynamic pstat_getstatic putenv \
|
||||
random realpath rename rindex \
|
||||
sbrk setenv setproctitle setrlimit sigsetmask snprintf spawnve spawnvpe \
|
||||
stpcpy stpncpy strcasecmp strchr strdup \
|
||||
|
||||
Reference in New Issue
Block a user