- ilock(ip);
- bcopy(u.u_comm, ap->ac_comm, sizeof(ap->ac_comm));
- 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, NULL, chk * hz);
+}
+
+/*
+ * 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;
+ calcru(p, &ut, &st, NULL);
+ s = splclock();