diff options
author | jhb <jhb@FreeBSD.org> | 2003-10-28 20:46:23 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2003-10-28 20:46:23 +0000 |
commit | 6ed78687ed5b2116130d2f07d2bd761989ffc34c (patch) | |
tree | afd6b79800e365b34a8e2bc920e421f08a8c8725 /sys | |
parent | ba29587a94ca9095fb6130b6ebbd3c09132e797a (diff) | |
download | FreeBSD-src-6ed78687ed5b2116130d2f07d2bd761989ffc34c.zip FreeBSD-src-6ed78687ed5b2116130d2f07d2bd761989ffc34c.tar.gz |
According to the submitter, POSIX mandates that all interval timers are
reset in a child process after a fork(). Currently, however, only the
real timer is cleared while the virtual and profiling timers are inherited.
The realtimer is cleared because it lives directly in struct proc in
p_realtimer. It is in the zero'd section of struct proc. The other timers
live in the p_timer[] array in struct pstats. These timers are copied on
fork() rather than zero'd. The fix is to move p_timer[] to the zero'd
part of struct pstats so that they are zero'd instead of copied on fork().
Note: Since at least FreeBSD 2.0 (and possibly earlier) we've had storage
for two real interval timers. Now that the uarea is less important,
perhaps we could move all of p_timer[] over to struct proc and drop the
p_realtimer special case to fix that.
PR: kern/58647
Reported by: Dan Nelson <dnelson@allantgroup.com>
MFC after: 1 week
Diffstat (limited to 'sys')
-rw-r--r-- | sys/sys/resourcevar.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h index 6368585..5007c77 100644 --- a/sys/sys/resourcevar.h +++ b/sys/sys/resourcevar.h @@ -52,11 +52,10 @@ struct pstats { #define pstat_startzero p_ru struct rusage p_ru; /* stats for this proc */ struct rusage p_cru; /* sum of stats for reaped children */ -#define pstat_endzero pstat_startcopy - -#define pstat_startcopy p_timer struct itimerval p_timer[3]; /* virtual-time timers */ +#define pstat_endzero pstat_startcopy +#define pstat_startcopy p_prof struct uprof { /* profile arguments */ caddr_t pr_base; /* buffer base */ u_long pr_size; /* buffer size */ |