1/*- 2 * Copyright (c) 1994 Christopher G. Demetriou 3 * Copyright (c) 1982, 1986, 1989, 1993 4 * The Regents of the University of California. All rights reserved. 5 * (c) UNIX System Laboratories, Inc. 6 * All or some portions of this file are derived from material licensed 7 * to the University of California by American Telephone and Telegraph 8 * Co. or Unix System Laboratories, Inc. and are reproduced herein with --- 23 unchanged lines hidden (view full) --- 32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * @(#)kern_acct.c 8.1 (Berkeley) 6/14/93 |
40 * $FreeBSD: head/sys/kern/kern_acct.c 91140 2002-02-23 11:12:57Z tanimura $ |
41 */ 42 43#include <sys/param.h> 44#include <sys/systm.h> 45#include <sys/lock.h> 46#include <sys/mutex.h> 47#include <sys/sysproto.h> 48#include <sys/proc.h> --- 179 unchanged lines hidden (view full) --- 228 /* (5) The number of disk I/O operations done */ 229 acct.ac_io = encode_comp_t(r->ru_inblock + r->ru_oublock, 0); 230 231 /* (6) The UID and GID of the process */ 232 acct.ac_uid = p->p_ucred->cr_ruid; 233 acct.ac_gid = p->p_ucred->cr_rgid; 234 235 /* (7) The terminal from which the process was started */ |
236 PROC_LOCK(p); 237 SESS_LOCK(p->p_session); |
238 if ((p->p_flag & P_CONTROLT) && p->p_pgrp->pg_session->s_ttyp) 239 acct.ac_tty = dev2udev(p->p_pgrp->pg_session->s_ttyp->t_dev); 240 else 241 acct.ac_tty = NOUDEV; |
242 SESS_UNLOCK(p->p_session); 243 PROC_UNLOCK(p); |
244 245 /* (8) The boolean flags that tell how the process terminated, etc. */ 246 acct.ac_flag = p->p_acflag; 247 248 /* 249 * Eliminate any file size rlimit. 250 */ 251 if (p->p_limit->p_refcnt > 1 && --- 96 unchanged lines hidden --- |