SCCS-vsn: sys/kern/kern_acct.c 8.6
register struct rusage *ru;
struct vnode *vp;
struct timeval t, ut, st;
register struct rusage *ru;
struct vnode *vp;
struct timeval t, ut, st;
struct acct acctbuf;
register struct acct *ap = &acctbuf;
struct acct acctbuf;
register struct acct *ap = &acctbuf;
- if ((vp = acctp) == NULL)
+ s = splclock();
+ if ((vp = acctp) == NULL) {
+ splx(s);
if (vp->v_type == VBAD) {
(void) vn_close(vp, FWRITE, NOCRED, NULL);
acctp = NULL;
if (vp->v_type == VBAD) {
(void) vn_close(vp, FWRITE, NOCRED, NULL);
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);
return (0);
}
bcopy(p->p_comm, ap->ac_comm, sizeof(ap->ac_comm));
ru = &p->p_stats->p_ru;
calcru(p, &ut, &st, NULL);
ap->ac_utime = compress(ut.tv_sec, ut.tv_usec);
ap->ac_stime = compress(st.tv_sec, st.tv_usec);
timevalsub(&t, &p->p_stats->p_start);
ap->ac_utime = compress(ut.tv_sec, ut.tv_usec);
ap->ac_stime = compress(st.tv_sec, st.tv_usec);
timevalsub(&t, &p->p_stats->p_start);
ap->ac_tty = NODEV;
ap->ac_flag = p->p_acflag;
VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
ap->ac_tty = NODEV;
ap->ac_flag = p->p_acflag;
VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
- return (vn_rdwr(UIO_WRITE, vp, (caddr_t)ap, sizeof (acctbuf), (off_t)0,
+ error = vn_rdwr(UIO_WRITE, vp, (caddr_t)ap, sizeof (acctbuf), (off_t)0,
UIO_SYSSPACE, IO_UNIT|IO_APPEND, p->p_ucred, (int *)0,
UIO_SYSSPACE, IO_UNIT|IO_APPEND, p->p_ucred, (int *)0,
+ (struct proc *)0);
+ splx(s);
+ return (error);