xref: /titanic_41/usr/src/uts/common/sys/acct.h (revision bb3db448291a7208a0162997e1d17d3fa993871a)
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 2014 Garrett D'Amore <garrett@damore.org>
24  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
25  */
26 
27 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 #ifndef _SYS_ACCT_H
31 #define	_SYS_ACCT_H
32 
33 #include <sys/types.h>
34 #include <sys/types32.h>
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 /*
41  * Accounting structures
42  */
43 
44 typedef	ushort_t comp_t;		/* "floating point" */
45 		/* 13-bit fraction, 3-bit exponent  */
46 
47 /* SVR4 acct structure */
48 struct acct {
49 	char	ac_flag;		/* Accounting flag */
50 	char	ac_stat;		/* Exit status */
51 	uid32_t	ac_uid;			/* Accounting user ID */
52 	gid32_t	ac_gid;			/* Accounting group ID */
53 	dev32_t	ac_tty;			/* control typewriter */
54 	time32_t ac_btime;		/* Beginning time */
55 	comp_t	ac_utime;		/* acctng user time in clock ticks */
56 	comp_t	ac_stime;		/* acctng system time in clock ticks */
57 	comp_t	ac_etime;		/* acctng elapsed time in clock ticks */
58 	comp_t	ac_mem;			/* memory usage */
59 	comp_t	ac_io;			/* chars transferred */
60 	comp_t	ac_rw;			/* blocks read or written */
61 	char	ac_comm[8];		/* command name */
62 };
63 
64 /*
65  * Account commands will use this header to read SVR3
66  * accounting data files.
67  */
68 
69 struct o_acct {
70 	char	ac_flag;		/* Accounting flag */
71 	char	ac_stat;		/* Exit status */
72 	o_uid_t	ac_uid;			/* Accounting user ID */
73 	o_gid_t	ac_gid;			/* Accounting group ID */
74 	o_dev_t	ac_tty;			/* control typewriter */
75 	time32_t ac_btime;		/* Beginning time */
76 	comp_t	ac_utime;		/* acctng user time in clock ticks */
77 	comp_t	ac_stime;		/* acctng system time in clock ticks */
78 	comp_t	ac_etime;		/* acctng elapsed time in clock ticks */
79 	comp_t	ac_mem;			/* memory usage */
80 	comp_t	ac_io;			/* chars transferred */
81 	comp_t	ac_rw;			/* blocks read or written */
82 	char	ac_comm[8];		/* command name */
83 };
84 
85 #if !defined(_KERNEL)
86 extern int acct(const char *);
87 #endif /* !defined(_KERNEL) */
88 
89 #if defined(_KERNEL)
90 
91 void	acct(char);
92 int	sysacct(char *);
93 
94 struct vnode;
95 int	acct_fs_in_use(struct vnode *);
96 #endif
97 
98 #define	AFORK	0001		/* has executed fork, but no exec */
99 #define	ASU	0002		/* used super-user privileges */
100 #define	AEXPND	0040		/* expanded acct structure */
101 #define	ACCTF	0300		/* record type: 00 = acct */
102 
103 #ifdef	__cplusplus
104 }
105 #endif
106 
107 #endif	/* _SYS_ACCT_H */
108