From 923a34a14be103a54adbaba438e080e086edd526 Mon Sep 17 00:00:00 2001 From: Jérôme Duval Date: Sat, 06 Jan 2018 16:48:36 +0100 Subject: [PATCH] jam: use posix_spawnp() instead of fork() on linux. the gain is about 10% on a 8-job kernel full build. --- jam/execunix.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/jam/execunix.c b/jam/execunix.c index 7e93603..eba2aba 100644 --- a/jam/execunix.c +++ a/jam/execunix.c @@ -50,8 +50,18 @@ # include # endif +# ifdef __linux__ +# define USE_POSIX_SPAWN +# endif + # ifdef unix # include + +# ifdef USE_POSIX_SPAWN +extern char **environ; +# include +# endif + # endif # ifdef OS_NT @@ -226,6 +236,13 @@ exit( EXITBAD ); } # else +# ifdef USE_POSIX_SPAWN + if (posix_spawnp(&pid, argv[0], NULL, NULL, (char * const*)argv, environ) != 0) + { + perror( "posix_spawnp" ); + exit( EXITBAD ); + } +# else # ifdef NO_VFORK if ((pid = fork()) == 0) { @@ -245,6 +262,7 @@ perror( "vfork" ); exit( EXITBAD ); } +# endif # endif /* Save the operation for execwait() to find. */ -- gitore 0.2.1