xref: /titanic_51/usr/src/cmd/sgs/include/rtc.h (revision fa9e4066f08beec538e775443c5be79dd423fcab)
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 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_RTC_H
28 #define	_RTC_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Global include file for the runtime configuration support.
34  */
35 #include <time.h>
36 #include <machdep.h>
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 /*
43  * Configuration header.
44  */
45 typedef struct {
46 	Word	ch_version;		/* version of config file */
47 	Word	ch_cnflags;		/* configuration flags */
48 	Word	ch_dlflags;		/* dldump() flags used */
49 	Word	ch_app;			/* application that this config file */
50 					/*	is specific to */
51 	Word	ch_hash;		/* hash table offset */
52 	Word	ch_obj;			/* object table offset */
53 	Word	ch_str;			/* string table offset */
54 	Word	ch_file;		/* file entries */
55 	Word	ch_dir;			/* directory entries */
56 	Word	ch_edlibpath;		/* ELF default library path offset */
57 	Word	ch_adlibpath;		/* AOUT default library path offset */
58 	Word	ch_eslibpath;		/* ELF secure library path offset */
59 	Word	ch_aslibpath;		/* AOUT secure library path offset */
60 	Lword	ch_resbgn;		/* memory reservation required to map */
61 	Lword	ch_resend;		/*	alternative objects defined */
62 					/*	by the configuration info */
63 	Word	ch_env;			/* environment variables */
64 	Word	ch_fltr;		/* filter table entries */
65 	Word	ch_flte;		/* filtee table entries */
66 } Rtc_head;
67 
68 #define	RTC_HDR_IGNORE	0x0001		/* ignore config information */
69 #define	RTC_HDR_ALTER	0x0002		/* alternative objects are defined - */
70 					/*	these may exist without a */
71 					/*	memory reservation (see -a) */
72 #define	RTC_HDR_64	0x0004		/* 64-bit objects used */
73 #define	RTC_HDR_UPM	0x0008		/* includes unified process model */
74 
75 /*
76  * Object descriptor.
77  */
78 typedef struct {
79 	Lword	co_info;		/* validation information */
80 	Word	co_name;		/* object name (directory or file) */
81 	Word	co_hash;		/* name hash value */
82 	Half	co_id;			/* directory identifier */
83 	Half	co_flags;		/* various flags */
84 	Word	co_alter;		/* alternative object file */
85 } Rtc_obj;
86 
87 #define	RTC_OBJ_DIRENT	0x0001		/* object defines a directory */
88 #define	RTC_OBJ_ALLENTS	0x0002		/* directory was scanned for all */
89 					/*	containing objects */
90 #define	RTC_OBJ_NOEXIST	0x0004		/* object does not exist */
91 #define	RTC_OBJ_EXEC	0x0008		/* object identifies executable */
92 #define	RTC_OBJ_ALTER	0x0010		/* object has an alternate */
93 #define	RTC_OBJ_DUMP	0x0020		/* alternate created by dldump(3x) */
94 #define	RTC_OBJ_REALPTH	0x0040		/* object identifies real path */
95 #define	RTC_OBJ_NOALTER	0x0080		/* object can't have an alternate */
96 #define	RTC_OBJ_GROUP	0x0100		/* object was expanded as a group */
97 #define	RTC_OBJ_APP	0x0200		/* object indicates app which makes */
98 					/*	configuration file specific */
99 #define	RTC_OBJ_CMDLINE	0x0400		/* object specified from command line */
100 #define	RTC_OBJ_FILTER	0x0800		/* object identifies a filter */
101 #define	RTC_OBJ_FILTEE	0x1000		/* object identifies a filtee */
102 #define	RTC_OBJ_OPTINAL	0x2000		/* object alternative is optional */
103 
104 /*
105  * Directory and file descriptors.  The configuration cache (cd_dir) points to
106  * an array of directory descriptors, this in turn point to their associated
107  * arrays of file descriptors.  Both of these provide sequential access for
108  * configuration file validation (directory, and possible file stat()'s).
109  */
110 typedef struct {
111 	Word	cd_obj;			/* index to Rtc_obj */
112 	Word	cd_file;		/* index to Rtc_file[] */
113 } Rtc_dir;
114 
115 typedef	struct {
116 	Word	cf_obj;			/* index to Rtc_obj */
117 } Rtc_file;
118 
119 
120 #define	RTC_VER_NONE	0
121 #define	RTC_VER_ONE	1		/* original version */
122 #define	RTC_VER_TWO	2		/* updated for -u use */
123 #define	RTC_VER_THREE	3		/* updated for -e/-E use */
124 #define	RTC_VER_FOUR	4		/* updated for filter/filtees */
125 #define	RTC_VER_CURRENT RTC_VER_FOUR
126 #define	RTC_VER_NUM	5
127 
128 /*
129  * Environment variable descriptor.  The configuration cache (ch_env) points to
130  * an array of these descriptors.
131  */
132 typedef struct {
133 	Word	env_str;		/* index into string table */
134 	Word	env_flags;		/* various flags */
135 } Rtc_env;
136 
137 #define	RTC_ENV_REPLACE	0x0001		/* replaceable string definition */
138 #define	RTC_ENV_PERMANT	0x0002		/* permanent string definition */
139 #define	RTC_ENV_CONFIG	0x1000		/* string originates from config file */
140 
141 /*
142  * Filter descriptor.  The configuration cache (ch_flt) points to an array of
143  * these descriptors.
144  */
145 typedef struct {
146 	Word	fr_filter;		/* filter name, and filtee string */
147 	Word	fr_string;		/*	as indexs into string table */
148 	Word	fr_filtee;		/* index into filtee array */
149 } Rtc_fltr;
150 
151 typedef struct {
152 	Word	fe_filtee;
153 } Rtc_flte;
154 
155 #ifdef	__cplusplus
156 }
157 #endif
158 
159 #endif	/* _RTC_H */
160