summaryrefslogtreecommitdiffstats
path: root/bin/sh/jobs.h
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2012-02-04 23:12:14 +0000
committerjilles <jilles@FreeBSD.org>2012-02-04 23:12:14 +0000
commitc9a60ad55a7cdcf983430853a4bdb15d31340f0b (patch)
treecdf2aa0b0a8655054be3d8275658129bb9b75c99 /bin/sh/jobs.h
parenta3ada8a47cbcc2eecf9773251384c95d920c9cab (diff)
downloadFreeBSD-src-c9a60ad55a7cdcf983430853a4bdb15d31340f0b.zip
FreeBSD-src-c9a60ad55a7cdcf983430853a4bdb15d31340f0b.tar.gz
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.
Diffstat (limited to 'bin/sh/jobs.h')
-rw-r--r--bin/sh/jobs.h1
1 files changed, 1 insertions, 0 deletions
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);
OpenPOWER on IntegriCloud