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