From ce31015cd1bbf6b90383046bb3e07942ac56e93b Mon Sep 17 00:00:00 2001 From: jhb Date: Fri, 2 Jul 2004 03:45:07 +0000 Subject: - Don't use a variable to point to the user area that we only use once. Just use p2->p_uarea directly instead. - Remove an old and mostly bogus assertion regarding p2->p_sigacts. - Use RANGEOF macro ala fork1() to clean up bzero/bcopy of p_stats. --- sys/vm/vm_glue.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'sys') diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 5ea15ab..dd85fa9 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -618,7 +618,6 @@ vm_forkproc(td, p2, td2, flags) int flags; { struct proc *p1 = td->td_proc; - struct user *up; GIANT_REQUIRED; @@ -652,22 +651,18 @@ vm_forkproc(td, p2, td2, flags) shmfork(p1, p2); } - /* XXXKSE this is unsatisfactory but should be adequate */ - up = p2->p_uarea; - MPASS(p2->p_sigacts != NULL); - /* - * p_stats currently points at fields in the user struct - * but not at &u, instead at p_addr. Copy parts of - * p_stats; zero the rest of p_stats (statistics). + * p_stats currently points at fields in the user struct. + * Copy parts of p_stats; zero the rest of p_stats (statistics). */ - p2->p_stats = &up->u_stats; - bzero(&up->u_stats.pstat_startzero, - (unsigned) ((caddr_t) &up->u_stats.pstat_endzero - - (caddr_t) &up->u_stats.pstat_startzero)); - bcopy(&p1->p_stats->pstat_startcopy, &up->u_stats.pstat_startcopy, - ((caddr_t) &up->u_stats.pstat_endcopy - - (caddr_t) &up->u_stats.pstat_startcopy)); +#define RANGEOF(type, start, end) (offsetof(type, end) - offsetof(type, start)) + + p2->p_stats = &p2->p_uarea->u_stats; + bzero(&p2->p_stats->pstat_startzero, + (unsigned) RANGEOF(struct pstats, pstat_startzero, pstat_endzero)); + bcopy(&p1->p_stats->pstat_startcopy, &p2->p_stats->pstat_startcopy, + (unsigned) RANGEOF(struct pstats, pstat_startcopy, pstat_endcopy)); +#undef RANGEOF /* * cpu_fork will copy and update the pcb, set up the kernel stack, -- cgit v1.1