xref: /titanic_41/usr/src/uts/common/sys/acct.h (revision 35a5a3587fd94b666239c157d3722745250ccbd7)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 
26 /*
27  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 #ifndef _SYS_ACCT_H
32 #define	_SYS_ACCT_H
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35 
36 #include <sys/types.h>
37 #include <sys/types32.h>
38 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 /*
44  * Accounting structures
45  */
46 
47 typedef	ushort_t comp_t;		/* "floating point" */
48 		/* 13-bit fraction, 3-bit exponent  */
49 
50 /* SVR4 acct structure */
51 struct acct {
52 	char	ac_flag;		/* Accounting flag */
53 	char	ac_stat;		/* Exit status */
54 	uid32_t	ac_uid;			/* Accounting user ID */
55 	gid32_t	ac_gid;			/* Accounting group ID */
56 	dev32_t	ac_tty;			/* control typewriter */
57 	time32_t ac_btime;		/* Beginning time */
58 	comp_t	ac_utime;		/* acctng user time in clock ticks */
59 	comp_t	ac_stime;		/* acctng system time in clock ticks */
60 	comp_t	ac_etime;		/* acctng elapsed time in clock ticks */
61 	comp_t	ac_mem;			/* memory usage */
62 	comp_t	ac_io;			/* chars transferred */
63 	comp_t	ac_rw;			/* blocks read or written */
64 	char	ac_comm[8];		/* command name */
65 };
66 
67 /*
68  * Account commands will use this header to read SVR3
69  * accounting data files.
70  */
71 
72 struct o_acct {
73 	char	ac_flag;		/* Accounting flag */
74 	char	ac_stat;		/* Exit status */
75 	o_uid_t	ac_uid;			/* Accounting user ID */
76 	o_gid_t	ac_gid;			/* Accounting group ID */
77 	o_dev_t	ac_tty;			/* control typewriter */
78 	time32_t ac_btime;		/* Beginning time */
79 	comp_t	ac_utime;		/* acctng user time in clock ticks */
80 	comp_t	ac_stime;		/* acctng system time in clock ticks */
81 	comp_t	ac_etime;		/* acctng elapsed time in clock ticks */
82 	comp_t	ac_mem;			/* memory usage */
83 	comp_t	ac_io;			/* chars transferred */
84 	comp_t	ac_rw;			/* blocks read or written */
85 	char	ac_comm[8];		/* command name */
86 };
87 
88 #if !defined(_KERNEL)
89 #if defined(__STDC__)
90 extern int acct(const char *);
91 #else
92 extern int acct();
93 #endif
94 #endif /* !defined(_KERNEL) */
95 
96 #if defined(_KERNEL)
97 
98 void	acct(char);
99 int	sysacct(char *);
100 
101 struct vnode;
102 int	acct_fs_in_use(struct vnode *);
103 #endif
104 
105 #define	AFORK	0001		/* has executed fork, but no exec */
106 #define	ASU	0002		/* used super-user privileges */
107 #ifdef SUN_SRC_COMPAT
108 #define	ACOMPAT	0004		/* used compatibility mode (VAX) */
109 #define	ACORE	0010		/* dumped core */
110 #define	AXSIG	0020		/* killed by a signal */
111 #endif /* SUN_SRC_COMPAT */
112 #define	AEXPND	0040		/* expanded acct structure */
113 #define	ACCTF	0300		/* record type: 00 = acct */
114 
115 #ifdef	__cplusplus
116 }
117 #endif
118 
119 #endif	/* _SYS_ACCT_H */
120