summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2003-04-17 22:02:47 +0000
committerjhb <jhb@FreeBSD.org>2003-04-17 22:02:47 +0000
commite7a906488ef751bb58925d8d3f618d76a3d9d4b9 (patch)
treef13cb05290ea9be7297d9025be3b73221fb5e153 /sys/compat
parentac139f59144a448a02f3a05a97130f2435817fb8 (diff)
downloadFreeBSD-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/compat')
-rw-r--r--sys/compat/linux/linux_misc.c24
-rw-r--r--sys/compat/svr4/svr4_signal.c12
2 files changed, 20 insertions, 16 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;
OpenPOWER on IntegriCloud