xref: /illumos-gate/usr/src/uts/common/sys/acct.h (revision b4203d75)
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
5794f0adbSRoger A. Faulkner  * Common Development and Distribution License (the "License").
6794f0adbSRoger 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  */
21794f0adbSRoger A. Faulkner 
22794f0adbSRoger A. Faulkner /*
23*ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24794f0adbSRoger A. Faulkner  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
25794f0adbSRoger A. Faulkner  */
26794f0adbSRoger A. Faulkner 
277c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
287c478bd9Sstevel@tonic-gate /*	  All Rights Reserved	*/
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifndef _SYS_ACCT_H
317c478bd9Sstevel@tonic-gate #define	_SYS_ACCT_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #include <sys/types.h>
347c478bd9Sstevel@tonic-gate #include <sys/types32.h>
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
377c478bd9Sstevel@tonic-gate extern "C" {
387c478bd9Sstevel@tonic-gate #endif
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * Accounting structures
427c478bd9Sstevel@tonic-gate  */
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate typedef	ushort_t comp_t;		/* "floating point" */
457c478bd9Sstevel@tonic-gate 		/* 13-bit fraction, 3-bit exponent  */
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate /* SVR4 acct structure */
487c478bd9Sstevel@tonic-gate struct acct {
497c478bd9Sstevel@tonic-gate 	char	ac_flag;		/* Accounting flag */
507c478bd9Sstevel@tonic-gate 	char	ac_stat;		/* Exit status */
517c478bd9Sstevel@tonic-gate 	uid32_t	ac_uid;			/* Accounting user ID */
527c478bd9Sstevel@tonic-gate 	gid32_t	ac_gid;			/* Accounting group ID */
537c478bd9Sstevel@tonic-gate 	dev32_t	ac_tty;			/* control typewriter */
547c478bd9Sstevel@tonic-gate 	time32_t ac_btime;		/* Beginning time */
557c478bd9Sstevel@tonic-gate 	comp_t	ac_utime;		/* acctng user time in clock ticks */
567c478bd9Sstevel@tonic-gate 	comp_t	ac_stime;		/* acctng system time in clock ticks */
577c478bd9Sstevel@tonic-gate 	comp_t	ac_etime;		/* acctng elapsed time in clock ticks */
587c478bd9Sstevel@tonic-gate 	comp_t	ac_mem;			/* memory usage */
597c478bd9Sstevel@tonic-gate 	comp_t	ac_io;			/* chars transferred */
607c478bd9Sstevel@tonic-gate 	comp_t	ac_rw;			/* blocks read or written */
617c478bd9Sstevel@tonic-gate 	char	ac_comm[8];		/* command name */
627c478bd9Sstevel@tonic-gate };
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate /*
657c478bd9Sstevel@tonic-gate  * Account commands will use this header to read SVR3
667c478bd9Sstevel@tonic-gate  * accounting data files.
677c478bd9Sstevel@tonic-gate  */
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate struct o_acct {
707c478bd9Sstevel@tonic-gate 	char	ac_flag;		/* Accounting flag */
717c478bd9Sstevel@tonic-gate 	char	ac_stat;		/* Exit status */
727c478bd9Sstevel@tonic-gate 	o_uid_t	ac_uid;			/* Accounting user ID */
737c478bd9Sstevel@tonic-gate 	o_gid_t	ac_gid;			/* Accounting group ID */
747c478bd9Sstevel@tonic-gate 	o_dev_t	ac_tty;			/* control typewriter */
757c478bd9Sstevel@tonic-gate 	time32_t ac_btime;		/* Beginning time */
767c478bd9Sstevel@tonic-gate 	comp_t	ac_utime;		/* acctng user time in clock ticks */
777c478bd9Sstevel@tonic-gate 	comp_t	ac_stime;		/* acctng system time in clock ticks */
787c478bd9Sstevel@tonic-gate 	comp_t	ac_etime;		/* acctng elapsed time in clock ticks */
797c478bd9Sstevel@tonic-gate 	comp_t	ac_mem;			/* memory usage */
807c478bd9Sstevel@tonic-gate 	comp_t	ac_io;			/* chars transferred */
817c478bd9Sstevel@tonic-gate 	comp_t	ac_rw;			/* blocks read or written */
827c478bd9Sstevel@tonic-gate 	char	ac_comm[8];		/* command name */
837c478bd9Sstevel@tonic-gate };
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate #if !defined(_KERNEL)
867c478bd9Sstevel@tonic-gate extern int acct(const char *);
877c478bd9Sstevel@tonic-gate #endif /* !defined(_KERNEL) */
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate #if defined(_KERNEL)
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate void	acct(char);
927c478bd9Sstevel@tonic-gate int	sysacct(char *);
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate struct vnode;
957c478bd9Sstevel@tonic-gate int	acct_fs_in_use(struct vnode *);
967c478bd9Sstevel@tonic-gate #endif
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate #define	AFORK	0001		/* has executed fork, but no exec */
997c478bd9Sstevel@tonic-gate #define	ASU	0002		/* used super-user privileges */
1007c478bd9Sstevel@tonic-gate #define	AEXPND	0040		/* expanded acct structure */
1017c478bd9Sstevel@tonic-gate #define	ACCTF	0300		/* record type: 00 = acct */
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1047c478bd9Sstevel@tonic-gate }
1057c478bd9Sstevel@tonic-gate #endif
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate #endif	/* _SYS_ACCT_H */
108