acct.h revision 92719
12061Sjkh/*-
250479Speter * Copyright (c) 1990, 1993, 1994
32061Sjkh *	The Regents of the University of California.  All rights reserved.
438666Sjb * (c) UNIX System Laboratories, Inc.
532427Sjb * All or some portions of this file are derived from material licensed
638666Sjb * to the University of California by American Telephone and Telegraph
738666Sjb * Co. or Unix System Laboratories, Inc. and are reproduced herein with
838666Sjb * the permission of UNIX System Laboratories, Inc.
938666Sjb *
1038666Sjb * Redistribution and use in source and binary forms, with or without
1144918Sjkh * modification, are permitted provided that the following conditions
1238666Sjb * are met:
1338666Sjb * 1. Redistributions of source code must retain the above copyright
1438666Sjb *    notice, this list of conditions and the following disclaimer.
1538666Sjb * 2. Redistributions in binary form must reproduce the above copyright
1638666Sjb *    notice, this list of conditions and the following disclaimer in the
1738666Sjb *    documentation and/or other materials provided with the distribution.
1838666Sjb * 3. All advertising materials mentioning features or use of this software
1938978Sjb *    must display the following acknowledgement:
2038978Sjb *	This product includes software developed by the University of
2132427Sjb *	California, Berkeley and its contributors.
2238666Sjb * 4. Neither the name of the University nor the names of its contributors
2338666Sjb *    may be used to endorse or promote products derived from this software
2438666Sjb *    without specific prior written permission.
2538666Sjb *
2638666Sjb * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2738666Sjb * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2817308Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2938666Sjb * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
3038666Sjb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3138666Sjb * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3219175Sbde * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3338666Sjb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3438666Sjb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3538042Sbde * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3639726Sjb * SUCH DAMAGE.
3738666Sjb *
3838666Sjb *	@(#)acct.h	8.4 (Berkeley) 1/9/95
3938042Sbde * $FreeBSD: head/sys/sys/acct.h 92719 2002-03-19 20:18:42Z alfred $
4038666Sjb */
4149315Shoek
4217308Speter#ifndef _SYS_ACCT_H_
4338666Sjb#define _SYS_ACCT_H_
4438666Sjb
4538666Sjb/*
4638666Sjb * Accounting structures; these use a comp_t type which is a 3 bits base 8
4717308Speter * exponent, 13 bit fraction ``floating point'' number.  Units are 1/AHZ
4845108Sobrien * seconds.
4942128Speter */
5042128Spetertypedef u_int16_t comp_t;
5138666Sjb
5251361Sjb#ifdef _KERNEL
5338666Sjb#define __dev_t udev_t
5417308Speter#else
5538666Sjb#define __dev_t dev_t
5617308Speter#endif
5738666Sjb
5817308Speter#define AC_COMM_LEN 16
5927910Sasamistruct acct {
6043226Sjkh	char	  ac_comm[AC_COMM_LEN];	/* command name */
6143226Sjkh	comp_t	  ac_utime;		/* user time */
6243226Sjkh	comp_t	  ac_stime;		/* system time */
6338666Sjb	comp_t	  ac_etime;		/* elapsed time */
6427910Sasami	time_t	  ac_btime;		/* starting time */
6538666Sjb	uid_t	  ac_uid;		/* user id */
6638666Sjb	gid_t	  ac_gid;		/* group id */
6738666Sjb	u_int16_t ac_mem;		/* average memory usage */
6827910Sasami	comp_t	  ac_io;		/* count of IO blocks */
6938666Sjb	__dev_t	  ac_tty;		/* controlling tty */
7038666Sjb
7143226Sjkh#define	AFORK	0x01			/* forked but not exec'ed */
7243226Sjkh/* ASU is no longer supported */
7327910Sasami#define	ASU	0x02			/* used super-user permissions */
7438666Sjb#define	ACOMPAT	0x04			/* used compatibility mode */
7538666Sjb#define	ACORE	0x08			/* dumped core */
7627910Sasami#define	AXSIG	0x10			/* killed by a signal */
7738666Sjb	u_int8_t  ac_flag;		/* accounting flags */
7827910Sasami};
7917308Speter#undef __dev_t
8038666Sjb
8138666Sjb/*
8217308Speter * 1/AHZ is the granularity of the data encoded in the comp_t fields.
8355678Smarcel * This is not necessarily equal to hz.
8455678Smarcel */
8557457Smarkm#define	AHZ	64
8657457Smarkm
872061Sjkh#ifdef _KERNEL
8855026Smarcelstruct thread;
8955026Smarcel
9054324Smarcelint	acct_process(struct thread *td);
9117308Speter#endif
9238666Sjb
9317308Speter#endif /* !_SYS_ACCT_H_ */
9455678Smarcel