aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
authorMatt Macy <mmacy@FreeBSD.org>2018-05-09 18:47:24 +0000
committerMatt Macy <mmacy@FreeBSD.org>2018-05-09 18:47:24 +0000
commitcbd92ce62e92bd17871c9668c2c2bebac3e2ac2e (patch)
tree40c405d5c0a6545e7dfd7beb64dc7e5076f7b644 /sys/kern/kern_exec.c
parent0272270a8d6fe4e6edb92de3e1711442e5d15766 (diff)
downloadsrc-cbd92ce62e92bd17871c9668c2c2bebac3e2ac2e.tar.gz
src-cbd92ce62e92bd17871c9668c2c2bebac3e2ac2e.zip
Eliminate the overhead of gratuitous repeated reinitialization of cap_rights
- Add macros to allow preinitialization of cap_rights_t. - Convert most commonly used code paths to use preinitialized cap_rights_t. A 3.6% speedup in fstat was measured with this change. Reported by: mjg Reviewed by: oshogbo Approved by: sbruno MFC after: 1 month
Notes
Notes: svn path=/head/; revision=333425
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 8bd9298a7e0c..9fba7b3426ef 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -374,7 +374,6 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p)
struct ucred *tracecred = NULL;
#endif
struct vnode *oldtextvp = NULL, *newtextvp;
- cap_rights_t rights;
int credential_changing;
int textset;
#ifdef MAC
@@ -455,8 +454,7 @@ interpret:
/*
* Descriptors opened only with O_EXEC or O_RDONLY are allowed.
*/
- error = fgetvp_exec(td, args->fd,
- cap_rights_init(&rights, CAP_FEXECVE), &newtextvp);
+ error = fgetvp_exec(td, args->fd, &cap_fexecve_rights, &newtextvp);
if (error)
goto exec_fail;
vn_lock(newtextvp, LK_EXCLUSIVE | LK_RETRY);