From cbd92ce62e92bd17871c9668c2c2bebac3e2ac2e Mon Sep 17 00:00:00 2001 From: Matt Macy Date: Wed, 9 May 2018 18:47:24 +0000 Subject: 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 --- sys/kern/kern_exec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sys/kern/kern_exec.c') 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); -- cgit v1.2.3