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