Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_acct.c
Show First 20 Lines • Show All 372 Lines • ▼ Show 20 Lines | acct_process(struct thread *td) | ||||
} | } | ||||
p = td->td_proc; | p = td->td_proc; | ||||
/* | /* | ||||
* Get process accounting information. | * Get process accounting information. | ||||
*/ | */ | ||||
sx_slock(&proctree_lock); | sx_slock(&V_proctree_lock); | ||||
PROC_LOCK(p); | PROC_LOCK(p); | ||||
/* (1) The terminal from which the process was started */ | /* (1) The terminal from which the process was started */ | ||||
if ((p->p_flag & P_CONTROLT) && p->p_pgrp->pg_session->s_ttyp) | if ((p->p_flag & P_CONTROLT) && p->p_pgrp->pg_session->s_ttyp) | ||||
acct.ac_tty = tty_udev(p->p_pgrp->pg_session->s_ttyp); | acct.ac_tty = tty_udev(p->p_pgrp->pg_session->s_ttyp); | ||||
else | else | ||||
acct.ac_tty = NODEV; | acct.ac_tty = NODEV; | ||||
sx_sunlock(&proctree_lock); | sx_sunlock(&V_proctree_lock); | ||||
/* (2) The name of the command that ran */ | /* (2) The name of the command that ran */ | ||||
bcopy(p->p_comm, acct.ac_comm, sizeof acct.ac_comm); | bcopy(p->p_comm, acct.ac_comm, sizeof acct.ac_comm); | ||||
/* (3) The amount of user and system time that was used */ | /* (3) The amount of user and system time that was used */ | ||||
rufetchcalc(p, &ru, &ut, &st); | rufetchcalc(p, &ru, &ut, &st); | ||||
acct.ac_utime = encode_timeval(ut); | acct.ac_utime = encode_timeval(ut); | ||||
acct.ac_stime = encode_timeval(st); | acct.ac_stime = encode_timeval(st); | ||||
▲ Show 20 Lines • Show All 262 Lines • Show Last 20 Lines |