11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_CLASSFILE_SHAREDPATHSMISCINFO_HPP
26 #define SHARE_VM_CLASSFILE_SHAREDPATHSMISCINFO_HPP
27
28 #include "classfile/classLoader.hpp"
29 #include "runtime/os.hpp"
30
31 // During dumping time, when processing class paths, we build up the dump-time
32 // classpath. The JAR files that exist are stored in the list ClassLoader::_first_append_entry.
33 // However, we need to store other "misc" information for run-time checking, such as
34 //
35 // + The values of Arguments::get_sysclasspath() used during dumping.
36 //
37 // + The meta-index file(s) used during dumping (incl modification time and size)
38 //
39 // + The class path elements specified during dumping but did not exist --
40 // these elements must also be specified at run time, and they also must not
41 // exist at run time.
42 //
43 // These misc items are stored in a linear buffer in SharedPathsMiscInfo.
44 // The storage format is stream oriented to minimize its size.
45 //
46 // When writing the information to the archive file, SharedPathsMiscInfo is stored in
47 // the archive file header. At run-time, this information is used only during initialization
48 // (accessed using read() instead of mmap()), and is deallocated afterwards to save space.
49 //
50 // The SharedPathsMiscInfo class is used for both creating the the information (during
122 bool dump_to_file(int fd) {
123 int n = get_used_bytes();
124 return (os::write(fd, _buf_start, n) == (size_t)n);
125 }
126
127 // reading --
128
129 enum {
130 BOOT = 1,
131 NON_EXIST = 2
132 };
133
134 virtual const char* type_name(int type) {
135 switch (type) {
136 case BOOT: return "BOOT";
137 case NON_EXIST: return "NON_EXIST";
138 default: ShouldNotReachHere(); return "?";
139 }
140 }
141
142 virtual void print_path(int type, const char* path);
143
144 bool check();
145 bool read_jint(jint *ptr) {
146 return read(ptr, sizeof(jint));
147 }
148 bool read_long(long *ptr) {
149 return read(ptr, sizeof(long));
150 }
151 bool read_time(time_t *ptr) {
152 return read(ptr, sizeof(time_t));
153 }
154 };
155
156 #endif // SHARE_VM_CLASSFILE_SHAREDPATHSMISCINFO_HPP
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_CLASSFILE_SHAREDPATHSMISCINFO_HPP
26 #define SHARE_VM_CLASSFILE_SHAREDPATHSMISCINFO_HPP
27
28 #include "classfile/classLoader.hpp"
29 #include "runtime/os.hpp"
30
31 class outputStream;
32 // During dumping time, when processing class paths, we build up the dump-time
33 // classpath. The JAR files that exist are stored in the list ClassLoader::_first_append_entry.
34 // However, we need to store other "misc" information for run-time checking, such as
35 //
36 // + The values of Arguments::get_sysclasspath() used during dumping.
37 //
38 // + The meta-index file(s) used during dumping (incl modification time and size)
39 //
40 // + The class path elements specified during dumping but did not exist --
41 // these elements must also be specified at run time, and they also must not
42 // exist at run time.
43 //
44 // These misc items are stored in a linear buffer in SharedPathsMiscInfo.
45 // The storage format is stream oriented to minimize its size.
46 //
47 // When writing the information to the archive file, SharedPathsMiscInfo is stored in
48 // the archive file header. At run-time, this information is used only during initialization
49 // (accessed using read() instead of mmap()), and is deallocated afterwards to save space.
50 //
51 // The SharedPathsMiscInfo class is used for both creating the the information (during
123 bool dump_to_file(int fd) {
124 int n = get_used_bytes();
125 return (os::write(fd, _buf_start, n) == (size_t)n);
126 }
127
128 // reading --
129
130 enum {
131 BOOT = 1,
132 NON_EXIST = 2
133 };
134
135 virtual const char* type_name(int type) {
136 switch (type) {
137 case BOOT: return "BOOT";
138 case NON_EXIST: return "NON_EXIST";
139 default: ShouldNotReachHere(); return "?";
140 }
141 }
142
143 virtual void print_path(outputStream* os, int type, const char* path);
144
145 bool check();
146 bool read_jint(jint *ptr) {
147 return read(ptr, sizeof(jint));
148 }
149 bool read_long(long *ptr) {
150 return read(ptr, sizeof(long));
151 }
152 bool read_time(time_t *ptr) {
153 return read(ptr, sizeof(time_t));
154 }
155 };
156
157 #endif // SHARE_VM_CLASSFILE_SHAREDPATHSMISCINFO_HPP
|