aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2004-07-02 03:45:07 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2004-07-02 03:45:07 +0000
commitd202e0cccc9b7cc291e92fef13ec1609a12a0e8c (patch)
tree1805467e5fd32a548b6d78dae106899c5f48426f /sys
parentb68c582ef8b2190b90caf758b3a14a9380761b50 (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/vm_glue.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c
index 5ea15abb60609..dd85fa90e01d8 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,