btrev43125 adds 1 changeset to branch 'master'
old head: 20a46bd5f9af3618ab03662921b8d30e00916c13
new head: 923a34a14be103a54adbaba438e080e086edd526
overview:
http://cgit.haiku-os.org/buildtools/log/?qt=range&q=923a34a14be1+%5E20a46bd5f9af
----------------------------------------------------------------------------
923a34a14be1: jam: use posix_spawnp() instead of fork() on linux.
the gain is about 10% on a 8-job kernel full build.
[ Jérôme Duval <jerome.duval@xxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: btrev43125
Commit: 923a34a14be103a54adbaba438e080e086edd526
URL: http://cgit.haiku-os.org/buildtools/commit/?id=923a34a14be1
Author: Jérôme Duval <jerome.duval@xxxxxxxxx>
Date: Sat Jan 6 15:48:36 2018 UTC
----------------------------------------------------------------------------
1 file changed, 18 insertions(+)
jam/execunix.c | 18 ++++++++++++++++++
----------------------------------------------------------------------------
diff --git a/jam/execunix.c b/jam/execunix.c
index 7e93603b9..eba2aba27 100644
--- a/jam/execunix.c
+++ b/jam/execunix.c
@@ -50,8 +50,18 @@
# include <process.h>
# endif
+# ifdef __linux__
+# define USE_POSIX_SPAWN
+# endif
+
# ifdef unix
# include <unistd.h>
+
+# ifdef USE_POSIX_SPAWN
+extern char **environ;
+# include <spawn.h>
+# endif
+
# endif
# ifdef OS_NT
@@ -226,6 +236,13 @@ execcmd(
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 @@ execcmd(
perror( "vfork" );
exit( EXITBAD );
}
+# endif
# endif
/* Save the operation for execwait() to find. */