Use vfork() instead of fork() before exec()

If running on older Linux systems, or any BSD UNIX, vfork()
is more efficient when we are about to call exec() anyway.

For more info on vfork() vs fork(), see Stack Exchange:
http://stackoverflow.com/questions/4259629/what-is-the-difference-between-fork-and-vfork

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2015-01-06 23:38:47 +01:00
1 parent d40f52357e
commit 074686b520
2 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -458,7 +458,7 @@ int svc_start(svc_t *svc)
sigaddset(&nmask, SIGCHLD);
sigprocmask(SIG_BLOCK, &nmask, &omask);
pid = fork();
pid = vfork();
sigprocmask(SIG_SETMASK, &omask, NULL);
if (pid == 0) {
int i = 0;