diff options
author | jhb <jhb@FreeBSD.org> | 2003-04-17 22:02:47 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2003-04-17 22:02:47 +0000 |
commit | e7a906488ef751bb58925d8d3f618d76a3d9d4b9 (patch) | |
tree | f13cb05290ea9be7297d9025be3b73221fb5e153 /sys | |
parent | ac139f59144a448a02f3a05a97130f2435817fb8 (diff) | |
download | FreeBSD-src-e7a906488ef751bb58925d8d3f618d76a3d9d4b9.zip FreeBSD-src-e7a906488ef751bb58925d8d3f618d76a3d9d4b9.tar.gz |
Use local struct proc variables to reduce repeated td->td_proc dereferences
and improve readability.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/compat/linux/linux_misc.c | 24 | ||||
-rw-r--r-- | sys/compat/svr4/svr4_signal.c | 12 | ||||
-rw-r--r-- | sys/gnu/i386/fpemul/fpu_entry.c | 9 | ||||
-rw-r--r-- | sys/kern/kern_intr.c | 8 |
4 files changed, 30 insertions, 23 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 4e95020..28ab2b3 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -164,6 +164,7 @@ linux_alarm(struct thread *td, struct linux_alarm_args *args) { struct itimerval it, old_it; struct timeval tv; + struct proc *p; #ifdef DEBUG if (ldebug(alarm)) @@ -177,18 +178,19 @@ linux_alarm(struct thread *td, struct linux_alarm_args *args) it.it_value.tv_usec = 0; it.it_interval.tv_sec = 0; it.it_interval.tv_usec = 0; - PROC_LOCK(td->td_proc); - old_it = td->td_proc->p_realtimer; + p = td->td_proc; + PROC_LOCK(p); + old_it = p->p_realtimer; getmicrouptime(&tv); if (timevalisset(&old_it.it_value)) - callout_stop(&td->td_proc->p_itcallout); + callout_stop(&p->p_itcallout); if (it.it_value.tv_sec != 0) { - callout_reset(&td->td_proc->p_itcallout, tvtohz(&it.it_value), - realitexpire, td->td_proc); + callout_reset(&p->p_itcallout, tvtohz(&it.it_value), + realitexpire, p); timevaladd(&it.it_value, &tv); } - td->td_proc->p_realtimer = it; - PROC_UNLOCK(td->td_proc); + p->p_realtimer = it; + PROC_UNLOCK(p); if (timevalcmp(&old_it.it_value, &tv, >)) { timevalsub(&old_it.it_value, &tv); if (old_it.it_value.tv_usec != 0) @@ -809,6 +811,7 @@ linux_wait4(struct thread *td, struct linux_wait4_args *args) struct rusage *rusage; } */ tmp; int error, tmpstat; + struct proc *p; #ifdef DEBUG if (ldebug(wait4)) @@ -828,9 +831,10 @@ linux_wait4(struct thread *td, struct linux_wait4_args *args) if ((error = wait4(td, &tmp)) != 0) return error; - PROC_LOCK(td->td_proc); - SIGDELSET(td->td_proc->p_siglist, SIGCHLD); - PROC_UNLOCK(td->td_proc); + p = td->td_proc; + PROC_LOCK(p); + SIGDELSET(p->p_siglist, SIGCHLD); + PROC_UNLOCK(p); if (args->status) { if ((error = copyin(args->status, &tmpstat, sizeof(int))) != 0) diff --git a/sys/compat/svr4/svr4_signal.c b/sys/compat/svr4/svr4_signal.c index c45b7cb..e05293c 100644 --- a/sys/compat/svr4/svr4_signal.c +++ b/sys/compat/svr4/svr4_signal.c @@ -554,21 +554,21 @@ svr4_sys_sigpending(td, uap) struct thread *td; struct svr4_sys_sigpending_args *uap; { + struct proc *p; sigset_t bss; - int *retval; svr4_sigset_t sss; - DPRINTF(("@@@ svr4_sys_sigpending(%d)\n", td->td_proc->p_pid)); - retval = td->td_retval; + p = td->td_proc; + DPRINTF(("@@@ svr4_sys_sigpending(%d)\n", p->p_pid)); switch (uap->what) { case 1: /* sigpending */ if (uap->mask == NULL) return 0; - PROC_LOCK(td->td_proc); - bss = td->td_proc->p_siglist; + PROC_LOCK(p); + bss = p->p_siglist; SIGSETOR(bss, td->td_siglist); SIGSETAND(bss, td->td_sigmask); - PROC_UNLOCK(td->td_proc); + PROC_UNLOCK(p); bsd_to_svr4_sigset(&bss, &sss); break; diff --git a/sys/gnu/i386/fpemul/fpu_entry.c b/sys/gnu/i386/fpemul/fpu_entry.c index dde1b77..589ac48 100644 --- a/sys/gnu/i386/fpemul/fpu_entry.c +++ b/sys/gnu/i386/fpemul/fpu_entry.c @@ -198,7 +198,7 @@ char emulating = 0; static int math_emulate(struct trapframe * tframe) { - + struct proc *p; unsigned char FPU_modrm; unsigned short code; #ifdef LOOKAHEAD_LIMIT @@ -232,10 +232,11 @@ math_emulate(struct trapframe * tframe) #endif FPU_lookahead = FPU_LOOKAHEAD; - PROC_LOCK(curthread->td_proc); - if (curproc->p_flag & P_TRACED) + p = curthread->td_proc; + PROC_LOCK(p); + if (p->p_flag & P_TRACED) FPU_lookahead = 0; - PROC_UNLOCK(curthread->td_proc); + PROC_UNLOCK(p); do_another_FPU_instruction: diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index cd193e0..195977d 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -569,15 +569,17 @@ restart: static void start_softintr(void *dummy) { + struct proc *p; if (swi_add(&clk_ithd, "clock", softclock, NULL, SWI_CLOCK, INTR_MPSAFE, &softclock_ih) || swi_add(NULL, "vm", swi_vm, NULL, SWI_VM, 0, &vm_ih)) panic("died while creating standard software ithreads"); - PROC_LOCK(clk_ithd->it_td->td_proc); - clk_ithd->it_td->td_proc->p_flag |= P_NOLOAD; - PROC_UNLOCK(clk_ithd->it_td->td_proc); + p = clk_ithd->it_td->td_proc; + PROC_LOCK(p); + p->p_flag |= P_NOLOAD; + PROC_UNLOCK(p); } SYSINIT(start_softintr, SI_SUB_SOFTINTR, SI_ORDER_FIRST, start_softintr, NULL) |