📄 loaderfile.c
字号:
/*0001*//*
/*0002./ * Copyright (c) 1998-2001 Sun Microsystems, Inc. All Rights Reserved.
/*0003./ *
/*0004./ * This software is the confidential and proprietary information of Sun
/*0005./ * Microsystems, Inc. ("Confidential Information"). You shall not
/*0006./ * disclose such Confidential Information and shall use it only in
/*0007./ * accordance with the terms of the license agreement you entered into
/*0008./ * with Sun.
/*0009./ *
/*0010./ * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
/*0011./ * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
/*0012./ * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
/*0013./ * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
/*0014./ * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
/*0015./ * THIS SOFTWARE OR ITS DERIVATIVES.
/*0016./ *
/*0017./ */
/*0018*/
/*0019*//*=========================================================================
/*0020./ * SYSTEM: KVM
/*0021./ * SUBSYSTEM: Class loader
/*0022./ * FILE: loaderFile.c
/*0023./ * OVERVIEW: Structures and operations needed for loading
/*0024./ * Java classfiles from the file system. This file
/*0025./ * (loaderFile.c) provides the default file system
/*0026./ * operations that are typically very useful on all those
/*0027./ * target platforms that have a regular file system.
/*0028./ *
/*0029./ * These operations have been separated from the actual
/*0030./ * class loading operations (VmCommon/src/loader.c), since
/*0031./ * the mapping between the KVM and the Java classfile
/*0032./ * storage mechanisms of the host operating system can vary
/*0033./ * considerably in different embedded devices.
/*0034./ * AUTHOR: Tasneem Sayeed, Consumer & Embedded division
/*0035./ * Frank Yellin
/*0036./ *=======================================================================*/
/*0037*/
/*0038*//*=========================================================================
/*0039./ * Include files
/*0040./ *=======================================================================*/
/*0041*/
/*0042*/#include <global.h>
/*0043*/#include <stdio.h>
/*0044*/#include <sys/stat.h>
/*0045*/#include <jar.h>
/*0046*/
/*0047*/#if !JAR_FILES_USE_STDIO
/*0048*/#include <sys/types.h>
/*0049*/#include <fcntl.h>
/*0050*/#include <sys/mman.h>
/*0051*/#endif
/*0052*/
/*0053*//*=========================================================================
/*0054./ * Definitions and declarations
/*0055./ *=======================================================================*/
/*0056*/
/*0057*/struct filePointerStruct {
/*0058*/ /* If set to true, indicates a JAR file */
/*0059*/ bool_t isJarFile;
/*0060*/};
/*0061*/
/*0062*/struct stdioPointerStruct {
/*0063*/ bool_t isJarFile; /* Always TRUE */
/*0064*/ FILE *file; /* Pointer to class file */
/*0065*/};
/*0066*/
/*0067*/struct jarPointerStruct {
/*0068*/ bool_t isJarFile; /* always FALSE */
/*0069*/ long dataLen; /* length of data stream */
/*0070*/ long dataIndex; /* current position for reading */
/*0071*/ unsigned char data[1];
/*0072*/};
/*0073*/
/*0074*/typedef struct classPathEntryStruct {
/*0075*/ union {
/*0076*/ struct jarInfoStruct jarInfo; /* if it's a jar file */
/*0077*/ /* Leave possibility of other types, for later */
/*0078*/ } u;
/*0079*/ char type;
/*0080*/ char name[1];
/*0081*/} *CLASS_PATH_ENTRY, **CLASS_PATH_ENTRY_HANDLE;
/*0082*/
/*0083*//*=========================================================================
/*0084./ * Variables
/*0085./ *=======================================================================*/
/*0086*/
/*0087*//* A table for storing the individual directory paths along classpath.
/*0088./ * Each entry is one element in the list.
/*0089./ *
/*0090./ * An entry consists of the letter 'j' or 'd' followed by more information.
/*0091./ * 'd' means this is a directory. It is immediately followed by the name
/*0092./ * of the directory.
/*0093./ * 'j' means a zip file. It is followed by 3 ignored spaces, then 4 bytes
/*0094./ * giving the location of the first local header, 4 bytes giving
/*0095./ * the location of the first central header, and then the name of the
/*0096./ * zip file.
/*0097./ */
/*0098*/
/*0099*//* Remember: This table contains object pointers (= GC root) */
/*0100*/static POINTERLIST ClassPathTable = NIL;
//\\
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -