kern/58647: itimers aren't cleared on fork()

John Baldwin jhb at FreeBSD.org
Tue Oct 28 12:00:36 PST 2003


The following reply was made to PR kern/58647; it has been noted by GNATS.

From: John Baldwin <jhb at FreeBSD.org>
To: freebsd-gnats-submit at FreeBSD.org
Cc:  
Subject: Re: kern/58647: itimers aren't cleared on fork()
Date: Tue, 28 Oct 2003 14:55:18 -0500 (EST)

 It seems that fork() doesn't explicitly clear the realtimer, rather
 p_realtimer is in the zero'd section of struct proc whereas the
 p_itimer array with the old real timer and the other two interval
 timers is in the copy section of p_stat.  The patch below moves
 p_itimer to the zero section of p_stat instead:
 
 Index: resourcevar.h
 ===================================================================
 RCS file: /usr/cvs/src/sys/sys/resourcevar.h,v
 retrieving revision 1.35
 diff -u -r1.35 resourcevar.h
 --- resourcevar.h       20 Apr 2003 13:54:04 -0000      1.35
 +++ resourcevar.h       28 Oct 2003 19:51:10 -0000
 @@ -52,11 +52,10 @@
  #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 */
 
 -- 
 
 John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
 "Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


More information about the freebsd-bugs mailing list