diff options
author | Brendan Shanks <bshanks@codeweavers.com> | 2023-11-09 21:01:07 -0700 |
---|---|---|
committer | Jeff Law <jlaw@ventanamicro.com> | 2023-11-09 21:01:58 -0700 |
commit | 879cf9ff45d94065d89e24b71c6b27c7076ac518 (patch) | |
tree | e1665520ddbc438d86aa2da8874fa8a61f21629e /libiberty/config.in | |
parent | 5a410860640f0fbd0a744dd89130d7d709a0ef07 (diff) | |
download | gcc-879cf9ff45d94065d89e24b71c6b27c7076ac518.zip gcc-879cf9ff45d94065d89e24b71c6b27c7076ac518.tar.gz gcc-879cf9ff45d94065d89e24b71c6b27c7076ac518.tar.bz2 |
[PATCH v3] 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.
Diffstat (limited to 'libiberty/config.in')
-rw-r--r-- | libiberty/config.in | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libiberty/config.in b/libiberty/config.in index f7052b5..050f6cd 100644 --- a/libiberty/config.in +++ b/libiberty/config.in @@ -198,6 +198,12 @@ /* Define to 1 if you have the `pipe2' function. */ #undef HAVE_PIPE2 +/* Define to 1 if you have the `posix_spawn' function. */ +#undef HAVE_POSIX_SPAWN + +/* Define to 1 if you have the `posix_spawnp' function. */ +#undef HAVE_POSIX_SPAWNP + /* Define to 1 if you have the <process.h> header file. */ #undef HAVE_PROCESS_H @@ -249,6 +255,9 @@ /* Define to 1 if you have the `spawnvpe' function. */ #undef HAVE_SPAWNVPE +/* Define to 1 if you have the <spawn.h> header file. */ +#undef HAVE_SPAWN_H + /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H |