From c9a60ad55a7cdcf983430853a4bdb15d31340f0b Mon Sep 17 00:00:00 2001 From: jilles Date: Sat, 4 Feb 2012 23:12:14 +0000 Subject: sh: Use vfork in a few common cases. This uses vfork() for simple commands and command substitutions containing a single simple command, invoking an external program under certain conditions (no redirections or variable assignments, non-interactive shell, no job control). These restrictions limit the amount of code executed in a vforked child. There is a large speedup (for example 35%) in microbenchmarks. The difference in buildkernel is smaller (for example 0.5%) but still statistically significant. See http://lists.freebsd.org/pipermail/freebsd-hackers/2012-January/037581.html for some numbers. The use of vfork() can be disabled by setting a variable named SH_DISABLE_VFORK. --- bin/sh/jobs.h | 1 + 1 file changed, 1 insertion(+) (limited to 'bin/sh/jobs.h') diff --git a/bin/sh/jobs.h b/bin/sh/jobs.h index 5e9d70d..e741b2c 100644 --- a/bin/sh/jobs.h +++ b/bin/sh/jobs.h @@ -91,6 +91,7 @@ void setjobctl(int); void showjobs(int, int); struct job *makejob(union node *, int); pid_t forkshell(struct job *, union node *, int); +pid_t vforkexecshell(struct job *, char **, char **, const char *, int, int []); int waitforjob(struct job *, int *); int stoppedjobs(void); int backgndpidset(void); -- cgit v1.1