acct.h revision 130640
1178825Sdfr/*-
2233294Sstas * Copyright (c) 1990, 1993, 1994
3233294Sstas *	The Regents of the University of California.  All rights reserved.
4233294Sstas * (c) UNIX System Laboratories, Inc.
5178825Sdfr * All or some portions of this file are derived from material licensed
6233294Sstas * to the University of California by American Telephone and Telegraph
7233294Sstas * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8233294Sstas * the permission of UNIX System Laboratories, Inc.
9178825Sdfr *
10233294Sstas * Redistribution and use in source and binary forms, with or without
11233294Sstas * modification, are permitted provided that the following conditions
12178825Sdfr * are met:
13233294Sstas * 1. Redistributions of source code must retain the above copyright
14233294Sstas *    notice, this list of conditions and the following disclaimer.
15233294Sstas * 2. Redistributions in binary form must reproduce the above copyright
16178825Sdfr *    notice, this list of conditions and the following disclaimer in the
17178825Sdfr *    documentation and/or other materials provided with the distribution.
18178825Sdfr * 4. Neither the name of the University nor the names of its contributors
19178825Sdfr *    may be used to endorse or promote products derived from this software
20178825Sdfr *    without specific prior written permission.
21178825Sdfr *
22178825Sdfr * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23178825Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24178825Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25178825Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26178825Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27178825Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28178825Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29178825Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30178825Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31178825Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32178825Sdfr * SUCH DAMAGE.
33178825Sdfr *
34178825Sdfr *	@(#)acct.h	8.4 (Berkeley) 1/9/95
35178825Sdfr * $FreeBSD: head/sys/sys/acct.h 130640 2004-06-17 17:16:53Z phk $
36178825Sdfr */
37178825Sdfr
38178825Sdfr#ifndef _SYS_ACCT_H_
39178825Sdfr#define _SYS_ACCT_H_
40178825Sdfr
41178825Sdfr/*
42178825Sdfr * Accounting structures; these use a comp_t type which is a 3 bits base 8
43178825Sdfr * exponent, 13 bit fraction ``floating point'' number.  Units are 1/AHZ
44178825Sdfr * seconds.
45178825Sdfr */
46178825Sdfrtypedef u_int16_t comp_t;
47178825Sdfr
48178825Sdfr#define AC_COMM_LEN 16
49178825Sdfrstruct acct {
50178825Sdfr	char	  ac_comm[AC_COMM_LEN];	/* command name */
51178825Sdfr	comp_t	  ac_utime;		/* user time */
52178825Sdfr	comp_t	  ac_stime;		/* system time */
53178825Sdfr	comp_t	  ac_etime;		/* elapsed time */
54178825Sdfr	time_t	  ac_btime;		/* starting time */
55178825Sdfr	uid_t	  ac_uid;		/* user id */
56178825Sdfr	gid_t	  ac_gid;		/* group id */
57178825Sdfr	u_int16_t ac_mem;		/* average memory usage */
58178825Sdfr	comp_t	  ac_io;		/* count of IO blocks */
59178825Sdfr	__dev_t   ac_tty;		/* controlling tty */
60178825Sdfr
61233294Sstas#define	AFORK	0x01			/* forked but not exec'ed */
62178825Sdfr/* ASU is no longer supported */
63178825Sdfr#define	ASU	0x02			/* used super-user permissions */
64178825Sdfr#define	ACOMPAT	0x04			/* used compatibility mode */
65178825Sdfr#define	ACORE	0x08			/* dumped core */
66178825Sdfr#define	AXSIG	0x10			/* killed by a signal */
67233294Sstas	u_int8_t  ac_flag;		/* accounting flags */
68178825Sdfr};
69178825Sdfr
70178825Sdfr/*
71178825Sdfr * 1/AHZ is the granularity of the data encoded in the comp_t fields.
72178825Sdfr * This is not necessarily equal to hz.
73178825Sdfr */
74178825Sdfr#define	AHZ	64
75178825Sdfr
76178825Sdfr#ifdef _KERNEL
77178825Sdfrstruct thread;
78178825Sdfr
79178825Sdfrint	acct_process(struct thread *td);
80178825Sdfr#endif
81178825Sdfr
82178825Sdfr#endif /* !_SYS_ACCT_H_ */
83178825Sdfr