summaryrefslogtreecommitdiff
path: root/src/shell_manager.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2018-11-27 21:49:57 +1100
committerMaxime Coste <mawww@kakoune.org>2018-11-27 21:49:57 +1100
commit5250593129b14feae02fdf449d5bf68b8c12ab70 (patch)
treec113db508863665aadf94b466abf8bb76679c898 /src/shell_manager.cc
parentc6d6060502a2c039d6ebd4b20aa91fa32bb07165 (diff)
ShellManager: Use vfork instead of fork
When large buffers have been opened, copying Kakoune's memory page descriptors can get pretty slow, making fork more expensive than necessary. vfork avoids that problem. While not strictly conforming, it seems the few calls we do before execve (open, close, dup2 and set_signal_handler) would not cause any problems on platforms we care about.
Diffstat (limited to 'src/shell_manager.cc')
-rw-r--r--src/shell_manager.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/shell_manager.cc b/src/shell_manager.cc
index 3683c85f..be8a8b2f 100644
--- a/src/shell_manager.cc
+++ b/src/shell_manager.cc
@@ -107,7 +107,7 @@ pid_t spawn_shell(const char* shell, StringView cmdline,
execparams.push_back(param.c_str());
execparams.push_back(nullptr);
- if (pid_t pid = fork())
+ if (pid_t pid = vfork())
return pid;
setup_child();