xref: /titanic_51/usr/src/uts/common/sys/acct.h (revision 794f0adb050e571bbfde4d2a19b9f88b852079dd)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*794f0adbSRoger A. Faulkner  * Common Development and Distribution License (the "License").
6*794f0adbSRoger A. Faulkner  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21*794f0adbSRoger A. Faulkner 
22*794f0adbSRoger A. Faulkner /*
23*794f0adbSRoger A. Faulkner  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24*794f0adbSRoger A. Faulkner  */
25*794f0adbSRoger A. Faulkner 
267c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
277c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifndef _SYS_ACCT_H
307c478bd9Sstevel@tonic-gate #define	_SYS_ACCT_H
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #include <sys/types.h>
337c478bd9Sstevel@tonic-gate #include <sys/types32.h>
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
367c478bd9Sstevel@tonic-gate extern "C" {
377c478bd9Sstevel@tonic-gate #endif
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate /*
407c478bd9Sstevel@tonic-gate  * Accounting structures
417c478bd9Sstevel@tonic-gate  */
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate typedef	ushort_t comp_t;		/* "floating point" */
447c478bd9Sstevel@tonic-gate 		/* 13-bit fraction, 3-bit exponent  */
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate /* SVR4 acct structure */
477c478bd9Sstevel@tonic-gate struct acct {
487c478bd9Sstevel@tonic-gate 	char	ac_flag;		/* Accounting flag */
497c478bd9Sstevel@tonic-gate 	char	ac_stat;		/* Exit status */
507c478bd9Sstevel@tonic-gate 	uid32_t	ac_uid;			/* Accounting user ID */
517c478bd9Sstevel@tonic-gate 	gid32_t	ac_gid;			/* Accounting group ID */
527c478bd9Sstevel@tonic-gate 	dev32_t	ac_tty;			/* control typewriter */
537c478bd9Sstevel@tonic-gate 	time32_t ac_btime;		/* Beginning time */
547c478bd9Sstevel@tonic-gate 	comp_t	ac_utime;		/* acctng user time in clock ticks */
557c478bd9Sstevel@tonic-gate 	comp_t	ac_stime;		/* acctng system time in clock ticks */
567c478bd9Sstevel@tonic-gate 	comp_t	ac_etime;		/* acctng elapsed time in clock ticks */
577c478bd9Sstevel@tonic-gate 	comp_t	ac_mem;			/* memory usage */
587c478bd9Sstevel@tonic-gate 	comp_t	ac_io;			/* chars transferred */
597c478bd9Sstevel@tonic-gate 	comp_t	ac_rw;			/* blocks read or written */
607c478bd9Sstevel@tonic-gate 	char	ac_comm[8];		/* command name */
617c478bd9Sstevel@tonic-gate };
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate /*
647c478bd9Sstevel@tonic-gate  * Account commands will use this header to read SVR3
657c478bd9Sstevel@tonic-gate  * accounting data files.
667c478bd9Sstevel@tonic-gate  */
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate struct o_acct {
697c478bd9Sstevel@tonic-gate 	char	ac_flag;		/* Accounting flag */
707c478bd9Sstevel@tonic-gate 	char	ac_stat;		/* Exit status */
717c478bd9Sstevel@tonic-gate 	o_uid_t	ac_uid;			/* Accounting user ID */
727c478bd9Sstevel@tonic-gate 	o_gid_t	ac_gid;			/* Accounting group ID */
737c478bd9Sstevel@tonic-gate 	o_dev_t	ac_tty;			/* control typewriter */
747c478bd9Sstevel@tonic-gate 	time32_t ac_btime;		/* Beginning time */
757c478bd9Sstevel@tonic-gate 	comp_t	ac_utime;		/* acctng user time in clock ticks */
767c478bd9Sstevel@tonic-gate 	comp_t	ac_stime;		/* acctng system time in clock ticks */
777c478bd9Sstevel@tonic-gate 	comp_t	ac_etime;		/* acctng elapsed time in clock ticks */
787c478bd9Sstevel@tonic-gate 	comp_t	ac_mem;			/* memory usage */
797c478bd9Sstevel@tonic-gate 	comp_t	ac_io;			/* chars transferred */
807c478bd9Sstevel@tonic-gate 	comp_t	ac_rw;			/* blocks read or written */
817c478bd9Sstevel@tonic-gate 	char	ac_comm[8];		/* command name */
827c478bd9Sstevel@tonic-gate };
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate #if !defined(_KERNEL)
857c478bd9Sstevel@tonic-gate #if defined(__STDC__)
867c478bd9Sstevel@tonic-gate extern int acct(const char *);
877c478bd9Sstevel@tonic-gate #else
887c478bd9Sstevel@tonic-gate extern int acct();
897c478bd9Sstevel@tonic-gate #endif
907c478bd9Sstevel@tonic-gate #endif /* !defined(_KERNEL) */
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate #if defined(_KERNEL)
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate void	acct(char);
957c478bd9Sstevel@tonic-gate int	sysacct(char *);
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate struct vnode;
987c478bd9Sstevel@tonic-gate int	acct_fs_in_use(struct vnode *);
997c478bd9Sstevel@tonic-gate #endif
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate #define	AFORK	0001		/* has executed fork, but no exec */
1027c478bd9Sstevel@tonic-gate #define	ASU	0002		/* used super-user privileges */
1037c478bd9Sstevel@tonic-gate #define	AEXPND	0040		/* expanded acct structure */
1047c478bd9Sstevel@tonic-gate #define	ACCTF	0300		/* record type: 00 = acct */
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1077c478bd9Sstevel@tonic-gate }
1087c478bd9Sstevel@tonic-gate #endif
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate #endif	/* _SYS_ACCT_H */
111