- ilock(ip);
- for (i = 0; i < sizeof (ap->ac_comm); i++)
- ap->ac_comm[i] = u.u_comm[i];
- ru = &u.u_ru;
- ap->ac_utime = compress(ru->ru_utime.tv_sec, ru->ru_utime.tv_usec);
- ap->ac_stime = compress(ru->ru_stime.tv_sec, ru->ru_stime.tv_usec);
+ timeout(acctwatch, (caddr_t)resettime, hzto(resettime));
+}
+
+/*
+ * This routine calculates an accounting record for a process and,
+ * if accounting is enabled, writes it to the accounting file.
+ */
+acct(p)
+ register struct proc *p;
+{
+ register struct rusage *ru;
+ struct vnode *vp;
+ struct timeval t, ut, st;
+ int i, s;
+ struct acct acctbuf;
+ register struct acct *ap = &acctbuf;
+
+ if ((vp = acctp) == NULL)
+ return (0);
+ bcopy(p->p_comm, ap->ac_comm, sizeof(ap->ac_comm));
+ ru = &p->p_stats->p_ru;
+ s = splclock();
+ ut = p->p_utime;
+ st = p->p_stime;