📄 jvm.h
字号:
JNIEXPORT jobject JNICALLJVM_NewInstance(JNIEnv *env, jclass cls);/* * java.security.* */JNIEXPORT jobject JNICALLJVM_DoPrivileged(JNIEnv *env, jclass cls, jobject action, jobject context, jboolean wrapException);JNIEXPORT jobject JNICALLJVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls);JNIEXPORT jobject JNICALLJVM_GetStackAccessControlContext(JNIEnv *env, jclass cls);/* * sun.misc.Signal stuff. Not a standard Java API. Don't need to implement * them on all VMs. */JNIEXPORT void * JNICALLJVM_RegisterSignal(jint sig, void *handler);JNIEXPORT jboolean JNICALLJVM_RaiseSignal(jint sig);JNIEXPORT jint JNICALLJVM_FindSignal(const char *name);#ifndef CDC_10/* * Retrieve the assertion directives for the specified class. */JNIEXPORT jboolean JNICALLJVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls);/* * Retrieve the assertion directives from the VM. */JNIEXPORT jobject JNICALLJVM_AssertionStatusDirectives(JNIEnv *env, jclass unused);#endif/* Constants in class files */#define JVM_ACC_PUBLIC 0x0001 /* visible to everyone */#define JVM_ACC_PRIVATE 0x0002 /* visible only to the defining class */#define JVM_ACC_PROTECTED 0x0004 /* visible to subclasses */#define JVM_ACC_STATIC 0x0008 /* instance variable is static */#define JVM_ACC_FINAL 0x0010 /* no further subclassing, overriding */#define JVM_ACC_SYNCHRONIZED 0x0020 /* wrap method call in monitor lock */#define JVM_ACC_SUPER 0x0020 /* funky handling of invokespecial */#define JVM_ACC_VOLATILE 0x0040 /* can not cache in registers */#define JVM_ACC_BRIDGE 0x0040 /* bridge method generated by compiler */#define JVM_ACC_TRANSIENT 0x0080 /* not persistant */#define JVM_ACC_VARARGS 0x0080 /* method declared with variable number of args */#define JVM_ACC_NATIVE 0x0100 /* implemented in C */#define JVM_ACC_INTERFACE 0x0200 /* class is an interface */#define JVM_ACC_ABSTRACT 0x0400 /* no definition provided */#define JVM_ACC_STRICT 0x0800 /* strict floating point */#define JVM_ACC_SYNTHETIC 0x1000 /* compiler-generated class, method or field */#define JVM_ACC_ANNOTATION 0x2000 /* annotation type */#define JVM_ACC_ENUM 0x4000 /* field is declared as element of enum */#define JVM_ACC_PUBLIC_BIT 0#define JVM_ACC_PRIVATE_BIT 1#define JVM_ACC_PROTECTED_BIT 2#define JVM_ACC_STATIC_BIT 3#define JVM_ACC_FINAL_BIT 4#define JVM_ACC_SYNCHRONIZED_BIT 5#define JVM_ACC_SUPER_BIT 5#define JVM_ACC_VOLATILE_BIT 6#define JVM_ACC_BRIDGE_BIT 6#define JVM_ACC_TRANSIENT_BIT 7#define JVM_ACC_VARARGS_BIT 7#define JVM_ACC_NATIVE_BIT 8#define JVM_ACC_INTERFACE_BIT 9#define JVM_ACC_ABSTRACT_BIT 10#define JVM_ACC_STRICT_BIT 11#define JVM_ACC_SYNTHETIC_BIT 12#define JVM_ACC_ANNOTATION_BIT 13#define JVM_ACC_ENUM_BIT 14enum { JVM_CONSTANT_Utf8 = 1, JVM_CONSTANT_Unicode, /* unused */ JVM_CONSTANT_Integer, JVM_CONSTANT_Float, JVM_CONSTANT_Long, JVM_CONSTANT_Double, JVM_CONSTANT_Class, JVM_CONSTANT_String, JVM_CONSTANT_Fieldref, JVM_CONSTANT_Methodref, JVM_CONSTANT_InterfaceMethodref, JVM_CONSTANT_NameAndType};/* Used in the newarray instruction. */#define JVM_T_BOOLEAN 4#define JVM_T_CHAR 5#define JVM_T_FLOAT 6#define JVM_T_DOUBLE 7#define JVM_T_BYTE 8#define JVM_T_SHORT 9#define JVM_T_INT 10#define JVM_T_LONG 11/* JVM method signatures */#define JVM_SIGNATURE_ARRAY '['#define JVM_SIGNATURE_BYTE 'B'#define JVM_SIGNATURE_CHAR 'C'#define JVM_SIGNATURE_CLASS 'L'#define JVM_SIGNATURE_ENDCLASS ';'#define JVM_SIGNATURE_ENUM 'E'#define JVM_SIGNATURE_FLOAT 'F'#define JVM_SIGNATURE_DOUBLE 'D'#define JVM_SIGNATURE_FUNC '('#define JVM_SIGNATURE_ENDFUNC ')'#define JVM_SIGNATURE_INT 'I'#define JVM_SIGNATURE_LONG 'J'#define JVM_SIGNATURE_SHORT 'S'#define JVM_SIGNATURE_VOID 'V'#define JVM_SIGNATURE_BOOLEAN 'Z'/* * StackMap type tags. Used in the CLDC StackMap attribute * as well as the JDK StackMapTable attribute. */enum { JVM_STACKMAP_TOP = 0, JVM_STACKMAP_INT, JVM_STACKMAP_FLOAT, JVM_STACKMAP_DOUBLE, JVM_STACKMAP_LONG, JVM_STACKMAP_NULL, JVM_STACKMAP_UNINIT_THIS, JVM_STACKMAP_OBJECT, JVM_STACKMAP_UNINIT_OBJECT,};/* * A function defined by the byte-code verifier and called by the VM. * This is not a function implemented in the VM. * * Returns JNI_FALSE if verification fails. A detailed error message * will be places in msg_buf, whose length is specified by buf_len. */ typedef jboolean (*verifier_fn_t)(JNIEnv *env, jclass cb, char * msg_buf, jint buf_len);/* * Support for a VM-independent class format checker. */ typedef struct { unsigned long code; /* byte code */ unsigned long excs; /* exceptions */ unsigned long etab; /* catch table */ unsigned long lnum; /* line number */ unsigned long lvar; /* local vars */} method_size_info;typedef struct { unsigned int constants; /* constant pool */ unsigned int fields; unsigned int methods; unsigned int interfaces; unsigned int fields2; /* number of static 2-word fields */ unsigned int innerclasses; /* # of records in InnerClasses attr */ method_size_info clinit; /* memory used in clinit */ method_size_info main; /* used everywhere else */} class_size_info;/* * Functions defined in libjava.so to perform string conversions. * */typedef jstring (*to_java_string_fn_t)(JNIEnv *env, char *str);typedef char *(*to_c_string_fn_t)(JNIEnv *env, jstring s, jboolean *b);/* This is the function defined in libjava.so that performs class * format checks. This functions fills in size information about * the class file and returns: * * 0: good * -1: out of memory * -2: bad format * -3: unsupported version * -4: bad class name */typedef jint (*check_format_fn_t)(char *class_name, unsigned char *data, unsigned int data_size, class_size_info *class_size, char *message_buffer, jint buffer_length, jboolean measure_only, jboolean check_relaxed);#define JVM_RECOGNIZED_CLASS_MODIFIERS (JVM_ACC_PUBLIC | \ JVM_ACC_FINAL | \ JVM_ACC_SUPER | \ JVM_ACC_INTERFACE | \ JVM_ACC_ABSTRACT | \ JVM_ACC_ANNOTATION | \ JVM_ACC_SYNTHETIC | \ JVM_ACC_ENUM) #define JVM_RECOGNIZED_FIELD_MODIFIERS (JVM_ACC_PUBLIC | \ JVM_ACC_PRIVATE | \ JVM_ACC_PROTECTED | \ JVM_ACC_STATIC | \ JVM_ACC_FINAL | \ JVM_ACC_VOLATILE | \ JVM_ACC_TRANSIENT | \ JVM_ACC_ENUM | \ JVM_ACC_SYNTHETIC)#define JVM_RECOGNIZED_METHOD_MODIFIERS (JVM_ACC_PUBLIC | \ JVM_ACC_PRIVATE | \ JVM_ACC_PROTECTED | \ JVM_ACC_STATIC | \ JVM_ACC_FINAL | \ JVM_ACC_SYNCHRONIZED | \ JVM_ACC_BRIDGE | \ JVM_ACC_VARARGS | \ JVM_ACC_NATIVE | \ JVM_ACC_ABSTRACT | \ JVM_ACC_STRICT | \ JVM_ACC_SYNTHETIC)/************************************************************************* PART 3: I/O and Network Support ************************************************************************//* Note that the JVM IO functions are expected to return JVM_IO_ERR * when there is any kind of error. The caller can then use the * platform specific support (e.g., errno) to get the detailed * error info. The JVM_GetLastErrorString procedure may also be used * to obtain a descriptive error string. */#define JVM_IO_ERR (-1)/* For interruptible IO. Returning JVM_IO_INTR indicates that an IO * operation has been disrupted by Thread.interrupt. There are a * number of technical difficulties related to interruptible IO that * need to be solved. For example, most existing programs do not handle * InterruptedIOExceptions specially, they simply treat those as any * IOExceptions, which typically indicate fatal errors. * * There are also two modes of operation for interruptible IO. In the * resumption mode, an interrupted IO operation is guaranteed not to * have any side-effects, and can be restarted. In the termination mode, * an interrupted IO operation corrupts the underlying IO stream, so * that the only reasonable operation on an interrupted stream is to * close that stream. The resumption mode seems to be impossible to * implement on Win32 and Solaris. Implementing the termination mode is * easier, but it's not clear that's the right semantics. * * Interruptible IO is not supported on Win32.It can be enabled/disabled * using a compile-time flag on Solaris. Third-party JVM ports do not * need to implement interruptible IO. */#define JVM_IO_INTR (-2)/* Write a string into the given buffer, in the platform's local encoding, * that describes the most recent system-level error to occur in this thread. * Return the length of the string or zero if no error occurred. */JNIEXPORT jint JNICALLJVM_GetLastErrorString(char *buf, int len);/* * Convert a pathname into native format. This function does syntactic * cleanup, such as removing redundant separator characters. It modifies * the given pathname string in place. */JNIEXPORT char * JNICALLJVM_NativePath(char *);/* * JVM I/O error codes */#define JVM_EEXIST -100/* * Open a file descriptor. This function returns a negative error code * on error, and a non-negative integer that is the file descriptor on * success. */JNIEXPORT jint JNICALLJVM_Open(const char *fname, jint flags, jint mode);/* * Close a file descriptor. This function returns -1 on error, and 0 * on success. * * fd the file descriptor to close. */JNIEXPORT jint JNICALLJVM_Close(jint fd);/* * Read data from a file decriptor into a char array. * * fd the file descriptor to read from. * buf the buffer where to put the read data. * nbytes the number of bytes to read. * * This function returns -1 on error, and 0 on success. */JNIEXPORT jint JNICALLJVM_Read(jint fd, char *buf, jint nbytes);/* * Write data from a char array to a file decriptor. * * fd the file descriptor to read from. * buf the buffer from which to fetch the data. * nbytes the number of bytes to write. * * This function returns -1 on error, and 0 on success. */JNIEXPORT jint JNICALLJVM_Write(jint fd, char *buf, jint nbytes);/* * Returns the number of bytes available for reading from a given file * descriptor */JNIEXPORT jint JNICALLJVM_Available(jint fd, jlong *pbytes);/* * Move the file descriptor pointer from whence by offset. * * fd the file descriptor to move. * offset the number of bytes to move it by. * whence the start from where to move it. * * This function returns the resulting pointer location. */JNIEXPORT jlong JNICALLJVM_Lseek(jint fd, jlong offset, jint whence);/* * Set the length of the file associated with the given descriptor to the given * length. If the new length is longer than the current length then the file * is extended; the contents of the extended portion are not defined. The * value of the file pointer is undefined after this procedure returns. */JNIEXPORT jint JNICALLJVM_SetLength(jint fd, jlong length);/* * Synchronize the file descriptor's in memory state with that of the * physical device. Return of -1 is an error, 0 is OK. */JNIEXPORT jint JNICALLJVM_Sync(jint fd);/* * Networking library support */JNIEXPORT jint JNICALLJVM_InitializeSocketLibrary(void);struct sockaddr;JNIEXPORT jint JNICALLJVM_Socket(jint domain, jint type, jint protocol);JNIEXPORT jint JNICALLJVM_SocketClose(jint fd);JNIEXPORT jint JNICALLJVM_SocketShutdown(jint fd, jint howto);JNIEXPORT jint JNICALLJVM_Recv(jint fd, char *buf, jint nBytes, jint flags);JNIEXPORT jint JNICALLJVM_Send(jint fd, char *buf, jint nBytes, jint flags);JNIEXPORT jint JNICALLJVM_Timeout(int fd, long timeout);JNIEXPORT jint JNICALLJVM_Listen(jint fd, jint count);JNIEXPORT jint JNICALLJVM_Connect(jint fd, struct sockaddr *him, jint len);JNIEXPORT jint JNICALLJVM_Bind(jint fd, struct sockaddr *him, jint len);JNIEXPORT jint JNICALLJVM_Accept(jint fd, struct sockaddr *him, jint *len);JNIEXPORT jint JNICALLJVM_RecvFrom(jint fd, char *buf, int nBytes, int flags, struct sockaddr *from, int *fromlen);JNIEXPORT jint JNICALLJVM_SendTo(jint fd, char *buf, int len, int flags, struct sockaddr *to, int tolen);JNIEXPORT jint JNICALLJVM_SocketAvailable(jint fd, jint *result);JNIEXPORT jint JNICALLJVM_GetSockName(jint fd, struct sockaddr *him, int *len);JNIEXPORT jint JNICALLJVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen);JNIEXPORT jint JNICALLJVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen);JNIEXPORT struct protoent * JNICALLJVM_GetProtoByName(char* name);JNIEXPORT struct hostent* JNICALLJVM_GetHostByAddr(const char* name, int len, int type);JNIEXPORT struct hostent* JNICALLJVM_GetHostByName(char* name);JNIEXPORT int JNICALLJVM_GetHostName(char* name, int namelen);/* * The standard printing functions supported by the Java VM. (Should they * be renamed to JVM_* in the future? *//* * BE CAREFUL! The following functions do not implement the * full feature set of standard C printf formats. */intjio_vsnprintf(char *str, size_t count, const char *fmt, va_list args);intjio_snprintf(char *str, size_t count, const char *fmt, ...);intjio_fprintf(FILE *, const char *fmt, ...);intjio_vfprintf(FILE *, const char *fmt, va_list args);JNIEXPORT void * JNICALLJVM_RawMonitorCreate(void);JNIEXPORT void JNICALLJVM_RawMonitorDestroy(void *mon);JNIEXPORT jint JNICALLJVM_RawMonitorEnter(void *mon);JNIEXPORT void JNICALLJVM_RawMonitorExit(void *mon);#ifdef JAVASE/* * java.lang.management support */JNIEXPORT void* JNICALLJVM_GetManagement(jint version);/* Generics reflection support. * * Returns information about the given class's EnclosingMethod * attribute, if present, or null if the class had no enclosing * method. * * If non-null, the returned array contains three elements. Element 0 * is the java.lang.Class of which the enclosing method is a member, * and elements 1 and 2 are the java.lang.Strings for the enclosing * method's name and descriptor, respectively. */JNIEXPORT jobjectArray JNICALLJVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass);#endif /* JAVASE */#ifdef __cplusplus} /* extern "C" */#endif /* __cplusplus */#endif /* !_JAVASOFT_JVM_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -