acct.h revision 55205
11541Srgrimes/*-
214507Shsu * Copyright (c) 1990, 1993, 1994
31541Srgrimes *	The Regents of the University of California.  All rights reserved.
41541Srgrimes * (c) UNIX System Laboratories, Inc.
51541Srgrimes * All or some portions of this file are derived from material licensed
61541Srgrimes * to the University of California by American Telephone and Telegraph
71541Srgrimes * Co. or Unix System Laboratories, Inc. and are reproduced herein with
81541Srgrimes * the permission of UNIX System Laboratories, Inc.
91541Srgrimes *
101541Srgrimes * Redistribution and use in source and binary forms, with or without
111541Srgrimes * modification, are permitted provided that the following conditions
121541Srgrimes * are met:
131541Srgrimes * 1. Redistributions of source code must retain the above copyright
141541Srgrimes *    notice, this list of conditions and the following disclaimer.
151541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
161541Srgrimes *    notice, this list of conditions and the following disclaimer in the
171541Srgrimes *    documentation and/or other materials provided with the distribution.
181541Srgrimes * 3. All advertising materials mentioning features or use of this software
191541Srgrimes *    must display the following acknowledgement:
201541Srgrimes *	This product includes software developed by the University of
211541Srgrimes *	California, Berkeley and its contributors.
221541Srgrimes * 4. Neither the name of the University nor the names of its contributors
231541Srgrimes *    may be used to endorse or promote products derived from this software
241541Srgrimes *    without specific prior written permission.
251541Srgrimes *
261541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
271541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
281541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
291541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
301541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
311541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
321541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
331541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
341541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
351541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
361541Srgrimes * SUCH DAMAGE.
371541Srgrimes *
3814507Shsu *	@(#)acct.h	8.4 (Berkeley) 1/9/95
3950477Speter * $FreeBSD: head/sys/sys/acct.h 55205 1999-12-29 04:46:21Z peter $
401541Srgrimes */
411541Srgrimes
422165Spaul#ifndef _SYS_ACCT_H_
432165Spaul#define _SYS_ACCT_H_
442165Spaul
451541Srgrimes/*
461541Srgrimes * Accounting structures; these use a comp_t type which is a 3 bits base 8
471541Srgrimes * exponent, 13 bit fraction ``floating point'' number.  Units are 1/AHZ
481541Srgrimes * seconds.
491541Srgrimes */
5014507Shsutypedef u_int16_t comp_t;
511541Srgrimes
5255205Speter#ifdef _KERNEL
5348726Sphk#define __dev_t udev_t
5448726Sphk#else
5548726Sphk#define __dev_t dev_t
5648726Sphk#endif
5748726Sphk
5810086Sjkh#define AC_COMM_LEN 16
591541Srgrimesstruct acct {
6014507Shsu	char	  ac_comm[AC_COMM_LEN];	/* command name */
6114507Shsu	comp_t	  ac_utime;		/* user time */
6214507Shsu	comp_t	  ac_stime;		/* system time */
6314507Shsu	comp_t	  ac_etime;		/* elapsed time */
6414507Shsu	time_t	  ac_btime;		/* starting time */
6514507Shsu	uid_t	  ac_uid;		/* user id */
6614507Shsu	gid_t	  ac_gid;		/* group id */
6714507Shsu	u_int16_t ac_mem;		/* average memory usage */
6814507Shsu	comp_t	  ac_io;		/* count of IO blocks */
6948726Sphk	__dev_t	  ac_tty;		/* controlling tty */
7014507Shsu
7114507Shsu#define	AFORK	0x01			/* forked but not exec'ed */
721541Srgrimes#define	ASU	0x02			/* used super-user permissions */
731541Srgrimes#define	ACOMPAT	0x04			/* used compatibility mode */
741541Srgrimes#define	ACORE	0x08			/* dumped core */
751541Srgrimes#define	AXSIG	0x10			/* killed by a signal */
7614507Shsu	u_int8_t  ac_flag;		/* accounting flags */
771541Srgrimes};
7848726Sphk#undef __dev_t
791541Srgrimes
801541Srgrimes/*
811541Srgrimes * 1/AHZ is the granularity of the data encoded in the comp_t fields.
821541Srgrimes * This is not necessarily equal to hz.
831541Srgrimes */
841541Srgrimes#define	AHZ	64
851541Srgrimes
8655205Speter#ifdef _KERNEL
8732995Sbdestruct proc;
8832995Sbde
8914507Shsuint	acct_process __P((struct proc *p));
901541Srgrimes#endif
9114507Shsu
9214507Shsu#endif /* !_SYS_ACCT_H_ */
93