xref: /titanic_44/usr/src/cmd/acctadm/aconf.h (revision 1cb6af97c6f66f456d4f726ef056e1ebc0f73305)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1999-2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_ACONF_H
28 #define	_ACONF_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 #include <sys/param.h>
34 #include <stdio.h>
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 /*
41  * Permissions and ownership for the configuration file:
42  */
43 #define	AC_OWNER	0		/* Uid 0 (root) */
44 #define	AC_GROUP	1		/* Gid 1 (other) */
45 #define	AC_PERM		(S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)	/* Mode 0644 */
46 
47 #define	MAXRESLEN	256
48 
49 typedef struct acctconf {
50 	FILE	*ac_conf_fp;		/* file pointer for config file */
51 	int	ac_conf_fd;		/* file descriptor for config file */
52 	int	ac_proc_state;
53 	char	ac_proc_file[MAXPATHLEN];
54 	char	ac_proc_tracked[MAXRESLEN];
55 	char	ac_proc_untracked[MAXRESLEN];
56 	char	ac_task_file[MAXPATHLEN];
57 	char	ac_task_tracked[MAXRESLEN];
58 	char	ac_task_untracked[MAXRESLEN];
59 	int	ac_task_state;
60 	char	ac_flow_file[MAXPATHLEN];
61 	char	ac_flow_tracked[MAXRESLEN];
62 	char	ac_flow_untracked[MAXRESLEN];
63 	int	ac_flow_state;
64 } acctconf_t;
65 
66 /*
67  * Predefined strings
68  */
69 #define	AC_STR_YES	"yes"
70 #define	AC_STR_NO	"no"
71 #define	AC_STR_NONE	"none"
72 
73 extern void	aconf_init(acctconf_t *);
74 extern int	aconf_create(acctconf_t *, const char *);
75 extern int	aconf_open(acctconf_t *, const char *);
76 extern int	aconf_close(acctconf_t *);
77 extern int	aconf_setup(acctconf_t *);
78 extern int	aconf_write(acctconf_t *);
79 extern int	aconf_update(acctconf_t *);
80 extern void	aconf_print(acctconf_t *, FILE *, int);
81 
82 extern int	aconf_str2enable(acctconf_t *, char *, int);
83 extern int	aconf_str2file(acctconf_t *, char *, int);
84 extern int	aconf_str2tracked(acctconf_t *, char *, int);
85 extern int	aconf_str2untracked(acctconf_t *, char *, int);
86 
87 #ifdef	__cplusplus
88 }
89 #endif
90 
91 #endif	/* _ACONF_H */
92