diff options
author | malc <moosotc@gmail.com> | 2016-08-26 18:25:41 (GMT) |
---|---|---|
committer | malc <moosotc@gmail.com> | 2016-08-26 18:28:44 (GMT) |
commit | 5153cedfd7720547489b6b2e5d5e4485def621c9 (patch) | |
tree | 0dc12fd75339dd17179a0598c1d93da2667fcaeb | |
parent | 94fc14314501a78b1742e910f7c920188b2753da (diff) | |
download | Ninja-5153cedfd7720547489b6b2e5d5e4485def621c9.zip Ninja-5153cedfd7720547489b6b2e5d5e4485def621c9.tar.gz Ninja-5153cedfd7720547489b6b2e5d5e4485def621c9.tar.bz2 |
Use POSIX_SPAWN_USEVFORK if available
Existing comments were alluding to it's usage and it makes building
ninja itself go a litle bit faster (i.e. taking less wall clock time).
FWIW FreeBSD even uses vfork by default c.f.
https://www.freebsd.org/cgi/man.cgi?query=posix_spawn
-rw-r--r-- | src/subprocess-posix.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/subprocess-posix.cc b/src/subprocess-posix.cc index 5ffe85b..f1f94e5 100644 --- a/src/subprocess-posix.cc +++ b/src/subprocess-posix.cc @@ -73,8 +73,6 @@ bool Subprocess::Start(SubprocessSet* set, const string& command) { // default action in the new process image, so no explicit // POSIX_SPAWN_SETSIGDEF parameter is needed. - // TODO: Consider using POSIX_SPAWN_USEVFORK on Linux with glibc? - if (!use_console_) { // Put the child in its own process group, so ctrl-c won't reach it. flags |= POSIX_SPAWN_SETPGROUP; @@ -93,6 +91,9 @@ bool Subprocess::Start(SubprocessSet* set, const string& command) { // In the console case, output_pipe is still inherited by the child and // closed when the subprocess finishes, which then notifies ninja. } +#ifdef POSIX_SPAWN_USEVFORK + flags |= POSIX_SPAWN_USEVFORK; +#endif if (posix_spawnattr_setflags(&attr, flags) != 0) Fatal("posix_spawnattr_setflags: %s", strerror(errno)); |