94 */ 95 JNIEXPORT jstring JNICALL 96 JVM_InternString(JNIEnv *env, jstring str); 97 98 /* 99 * java.lang.System 100 */ 101 JNIEXPORT jlong JNICALL 102 JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored); 103 104 JNIEXPORT jlong JNICALL 105 JVM_NanoTime(JNIEnv *env, jclass ignored); 106 107 JNIEXPORT void JNICALL 108 JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos, 109 jobject dst, jint dst_pos, jint length); 110 111 JNIEXPORT jobject JNICALL 112 JVM_InitProperties(JNIEnv *env, jobject p); 113 114 /* 115 * java.io.File 116 */ 117 JNIEXPORT void JNICALL 118 JVM_OnExit(void (*func)(void)); 119 120 /* 121 * java.lang.Runtime 122 */ 123 JNIEXPORT void JNICALL 124 JVM_Exit(jint code); 125 126 JNIEXPORT void JNICALL 127 JVM_Halt(jint code); 128 129 JNIEXPORT void JNICALL 130 JVM_GC(void); 131 132 /* Returns the number of real-time milliseconds that have elapsed since the 133 * least-recently-inspected heap object was last inspected by the garbage 134 * collector. 135 * 136 * For simple stop-the-world collectors this value is just the time 137 * since the most recent collection. For generational collectors it is the 138 * time since the oldest generation was most recently collected. Other 139 * collectors are free to return a pessimistic estimate of the elapsed time, or 140 * simply the time since the last full collection was performed. 141 * 142 * Note that in the presence of reference objects, a given object that is no 143 * longer strongly reachable may have to be inspected multiple times before it 144 * can be reclaimed. 145 */ 146 JNIEXPORT jlong JNICALL 147 JVM_MaxObjectInspectionAge(void); 148 149 JNIEXPORT void JNICALL 150 JVM_TraceInstructions(jboolean on); 151 152 JNIEXPORT void JNICALL 153 JVM_TraceMethodCalls(jboolean on); 154 155 JNIEXPORT jlong JNICALL 156 JVM_TotalMemory(void); 157 158 JNIEXPORT jlong JNICALL 159 JVM_FreeMemory(void); 160 161 JNIEXPORT jlong JNICALL 162 JVM_MaxMemory(void); 163 164 JNIEXPORT jint JNICALL 165 JVM_ActiveProcessorCount(void); 166 167 JNIEXPORT void * JNICALL 168 JVM_LoadLibrary(const char *name); 169 170 JNIEXPORT void JNICALL 171 JVM_UnloadLibrary(void * handle); 172 173 JNIEXPORT void * JNICALL 174 JVM_FindLibraryEntry(void *handle, const char *name); 175 176 JNIEXPORT jboolean JNICALL 177 JVM_IsSupportedJNIVersion(jint version); 178 179 /* 180 * java.lang.Float and java.lang.Double 181 */ 182 JNIEXPORT jboolean JNICALL 183 JVM_IsNaN(jdouble d); 184 185 /* 186 * java.lang.Throwable 187 */ 188 JNIEXPORT void JNICALL 189 JVM_FillInStackTrace(JNIEnv *env, jobject throwable); 190 191 JNIEXPORT jint JNICALL 192 JVM_GetStackTraceDepth(JNIEnv *env, jobject throwable); 193 194 JNIEXPORT jobject JNICALL 195 JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index); 196 197 /* 198 * java.lang.Compiler 199 */ 200 JNIEXPORT void JNICALL 201 JVM_InitializeCompiler (JNIEnv *env, jclass compCls); 202 203 JNIEXPORT jboolean JNICALL 204 JVM_IsSilentCompiler(JNIEnv *env, jclass compCls); 205 206 JNIEXPORT jboolean JNICALL 207 JVM_CompileClass(JNIEnv *env, jclass compCls, jclass cls); 208 209 JNIEXPORT jboolean JNICALL 210 JVM_CompileClasses(JNIEnv *env, jclass cls, jstring jname); 211 212 JNIEXPORT jobject JNICALL 213 JVM_CompilerCommand(JNIEnv *env, jclass compCls, jobject arg); 214 215 JNIEXPORT void JNICALL 216 JVM_EnableCompiler(JNIEnv *env, jclass compCls); 217 218 JNIEXPORT void JNICALL 219 JVM_DisableCompiler(JNIEnv *env, jclass compCls); 220 221 /* 222 * java.lang.Thread 223 */ 224 JNIEXPORT void JNICALL 225 JVM_StartThread(JNIEnv *env, jobject thread); 226 227 JNIEXPORT void JNICALL 228 JVM_StopThread(JNIEnv *env, jobject thread, jobject exception); 229 230 JNIEXPORT jboolean JNICALL 231 JVM_IsThreadAlive(JNIEnv *env, jobject thread); 232 233 JNIEXPORT void JNICALL 234 JVM_SuspendThread(JNIEnv *env, jobject thread); 235 236 JNIEXPORT void JNICALL 237 JVM_ResumeThread(JNIEnv *env, jobject thread); 238 239 JNIEXPORT void JNICALL 240 JVM_SetThreadPriority(JNIEnv *env, jobject thread, jint prio); 241 287 288 JNIEXPORT jint JNICALL 289 JVM_ClassDepth(JNIEnv *env, jstring name); 290 291 JNIEXPORT jint JNICALL 292 JVM_ClassLoaderDepth(JNIEnv *env); 293 294 /* 295 * java.lang.Package 296 */ 297 JNIEXPORT jstring JNICALL 298 JVM_GetSystemPackage(JNIEnv *env, jstring name); 299 300 JNIEXPORT jobjectArray JNICALL 301 JVM_GetSystemPackages(JNIEnv *env); 302 303 /* 304 * java.io.ObjectInputStream 305 */ 306 JNIEXPORT jobject JNICALL 307 JVM_AllocateNewObject(JNIEnv *env, jobject obj, jclass currClass, 308 jclass initClass); 309 310 JNIEXPORT jobject JNICALL 311 JVM_AllocateNewArray(JNIEnv *env, jobject obj, jclass currClass, 312 jint length); 313 314 JNIEXPORT jobject JNICALL 315 JVM_LatestUserDefinedLoader(JNIEnv *env); 316 317 /* 318 * This function has been deprecated and should not be considered 319 * part of the specified JVM interface. 320 */ 321 JNIEXPORT jclass JNICALL 322 JVM_LoadClass0(JNIEnv *env, jobject obj, jclass currClass, 323 jstring currClassName); 324 325 /* 326 * java.lang.reflect.Array 327 */ 328 JNIEXPORT jint JNICALL 329 JVM_GetArrayLength(JNIEnv *env, jobject arr); 330 331 JNIEXPORT jobject JNICALL 332 JVM_GetArrayElement(JNIEnv *env, jobject arr, jint index); 333 334 JNIEXPORT jvalue JNICALL 335 JVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode); 336 337 JNIEXPORT void JNICALL 338 JVM_SetArrayElement(JNIEnv *env, jobject arr, jint index, jobject val); 339 340 JNIEXPORT void JNICALL 341 JVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v, 342 unsigned char vCode); 343 344 JNIEXPORT jobject JNICALL 345 JVM_NewArray(JNIEnv *env, jclass eltClass, jint length); 356 /* 357 * Returns the immediate caller class of the native method invoking 358 * JVM_GetCallerClass. The Method.invoke and other frames due to 359 * reflection machinery are skipped. 360 * 361 * The depth parameter must be -1 (JVM_DEPTH). The caller is expected 362 * to be marked with sun.reflect.CallerSensitive. The JVM will throw 363 * an error if it is not marked propertly. 364 */ 365 JNIEXPORT jclass JNICALL 366 JVM_GetCallerClass(JNIEnv *env, int depth); 367 368 369 /* 370 * Find primitive classes 371 * utf: class name 372 */ 373 JNIEXPORT jclass JNICALL 374 JVM_FindPrimitiveClass(JNIEnv *env, const char *utf); 375 376 /* 377 * Link the class 378 */ 379 JNIEXPORT void JNICALL 380 JVM_ResolveClass(JNIEnv *env, jclass cls); 381 382 /* 383 * Find a class from a boot class loader. Returns NULL if class not found. 384 */ 385 JNIEXPORT jclass JNICALL 386 JVM_FindClassFromBootLoader(JNIEnv *env, const char *name); 387 388 /* 389 * Find a class from a given class loader. Throw ClassNotFoundException 390 * or NoClassDefFoundError depending on the value of the last 391 * argument. 392 */ 393 JNIEXPORT jclass JNICALL 394 JVM_FindClassFromClassLoader(JNIEnv *env, const char *name, jboolean init, 395 jobject loader, jboolean throwError); 396 397 /* 398 * Find a class from a given class. 399 */ 400 JNIEXPORT jclass JNICALL 1071 JVM_ACC_BRIDGE | \ 1072 JVM_ACC_VARARGS | \ 1073 JVM_ACC_NATIVE | \ 1074 JVM_ACC_ABSTRACT | \ 1075 JVM_ACC_STRICT | \ 1076 JVM_ACC_SYNTHETIC) 1077 1078 /* 1079 * This is the function defined in libjava.so to perform path 1080 * canonicalization. VM call this function before opening jar files 1081 * to load system classes. 1082 * 1083 */ 1084 1085 typedef int (*canonicalize_fn_t)(JNIEnv *env, char *orig, char *out, int len); 1086 1087 /************************************************************************* 1088 PART 3: I/O and Network Support 1089 ************************************************************************/ 1090 1091 /* Note that the JVM IO functions are expected to return JVM_IO_ERR 1092 * when there is any kind of error. The caller can then use the 1093 * platform specific support (e.g., errno) to get the detailed 1094 * error info. The JVM_GetLastErrorString procedure may also be used 1095 * to obtain a descriptive error string. 1096 */ 1097 #define JVM_IO_ERR (-1) 1098 1099 /* For interruptible IO. Returning JVM_IO_INTR indicates that an IO 1100 * operation has been disrupted by Thread.interrupt. There are a 1101 * number of technical difficulties related to interruptible IO that 1102 * need to be solved. For example, most existing programs do not handle 1103 * InterruptedIOExceptions specially, they simply treat those as any 1104 * IOExceptions, which typically indicate fatal errors. 1105 * 1106 * There are also two modes of operation for interruptible IO. In the 1107 * resumption mode, an interrupted IO operation is guaranteed not to 1108 * have any side-effects, and can be restarted. In the termination mode, 1109 * an interrupted IO operation corrupts the underlying IO stream, so 1110 * that the only reasonable operation on an interrupted stream is to 1111 * close that stream. The resumption mode seems to be impossible to 1112 * implement on Win32 and Solaris. Implementing the termination mode is 1113 * easier, but it's not clear that's the right semantics. 1114 * 1115 * Interruptible IO is not supported on Win32.It can be enabled/disabled 1116 * using a compile-time flag on Solaris. Third-party JVM ports do not 1117 * need to implement interruptible IO. 1118 */ 1119 #define JVM_IO_INTR (-2) 1120 1121 /* Write a string into the given buffer, in the platform's local encoding, 1122 * that describes the most recent system-level error to occur in this thread. 1123 * Return the length of the string or zero if no error occurred. 1124 */ 1125 JNIEXPORT jint JNICALL 1126 JVM_GetLastErrorString(char *buf, int len); 1127 1128 /* 1129 * Convert a pathname into native format. This function does syntactic 1130 * cleanup, such as removing redundant separator characters. It modifies 1131 * the given pathname string in place. 1132 */ 1133 JNIEXPORT char * JNICALL 1134 JVM_NativePath(char *); 1135 1136 /* 1137 * JVM I/O error codes 1138 */ 1139 #define JVM_EEXIST -100 1140 1141 /* 1142 * Open a file descriptor. This function returns a negative error code 1143 * on error, and a non-negative integer that is the file descriptor on 1144 * success. 1145 */ 1146 JNIEXPORT jint JNICALL 1147 JVM_Open(const char *fname, jint flags, jint mode); 1148 1149 /* 1150 * Close a file descriptor. This function returns -1 on error, and 0 1151 * on success. 1152 * 1153 * fd the file descriptor to close. 1154 */ 1155 JNIEXPORT jint JNICALL 1156 JVM_Close(jint fd); 1157 1158 /* 1159 * Read data from a file decriptor into a char array. 1160 * 1161 * fd the file descriptor to read from. 1162 * buf the buffer where to put the read data. 1163 * nbytes the number of bytes to read. 1164 * 1165 * This function returns -1 on error, and 0 on success. 1166 */ 1167 JNIEXPORT jint JNICALL 1168 JVM_Read(jint fd, char *buf, jint nbytes); 1169 1170 /* 1171 * Write data from a char array to a file decriptor. 1172 * 1173 * fd the file descriptor to read from. 1174 * buf the buffer from which to fetch the data. 1175 * nbytes the number of bytes to write. 1176 * 1177 * This function returns -1 on error, and 0 on success. 1178 */ 1179 JNIEXPORT jint JNICALL 1180 JVM_Write(jint fd, char *buf, jint nbytes); 1181 1182 /* 1183 * Returns the number of bytes available for reading from a given file 1184 * descriptor 1185 */ 1186 JNIEXPORT jint JNICALL 1187 JVM_Available(jint fd, jlong *pbytes); 1188 1189 /* 1190 * Move the file descriptor pointer from whence by offset. 1191 * 1192 * fd the file descriptor to move. 1193 * offset the number of bytes to move it by. 1194 * whence the start from where to move it. 1195 * 1196 * This function returns the resulting pointer location. 1197 */ 1198 JNIEXPORT jlong JNICALL 1199 JVM_Lseek(jint fd, jlong offset, jint whence); 1200 1201 /* 1202 * Set the length of the file associated with the given descriptor to the given 1203 * length. If the new length is longer than the current length then the file 1204 * is extended; the contents of the extended portion are not defined. The 1205 * value of the file pointer is undefined after this procedure returns. 1206 */ 1207 JNIEXPORT jint JNICALL 1208 JVM_SetLength(jint fd, jlong length); 1209 1210 /* 1211 * Synchronize the file descriptor's in memory state with that of the 1212 * physical device. Return of -1 is an error, 0 is OK. 1213 */ 1214 JNIEXPORT jint JNICALL 1215 JVM_Sync(jint fd); 1216 1217 /* 1218 * Networking library support 1219 */ 1220 1221 JNIEXPORT jint JNICALL 1222 JVM_InitializeSocketLibrary(void); 1223 1224 struct sockaddr; 1225 1226 JNIEXPORT jint JNICALL 1227 JVM_Socket(jint domain, jint type, jint protocol); 1228 1229 JNIEXPORT jint JNICALL 1230 JVM_SocketClose(jint fd); 1231 1232 JNIEXPORT jint JNICALL 1233 JVM_SocketShutdown(jint fd, jint howto); 1234 1235 JNIEXPORT jint JNICALL 1236 JVM_Recv(jint fd, char *buf, jint nBytes, jint flags); 1237 1238 JNIEXPORT jint JNICALL 1239 JVM_Send(jint fd, char *buf, jint nBytes, jint flags); 1240 1241 JNIEXPORT jint JNICALL 1242 JVM_Timeout(int fd, long timeout); 1243 1244 JNIEXPORT jint JNICALL 1245 JVM_Listen(jint fd, jint count); 1246 1247 JNIEXPORT jint JNICALL 1248 JVM_Connect(jint fd, struct sockaddr *him, jint len); 1249 1250 JNIEXPORT jint JNICALL 1251 JVM_Bind(jint fd, struct sockaddr *him, jint len); 1252 1253 JNIEXPORT jint JNICALL 1254 JVM_Accept(jint fd, struct sockaddr *him, jint *len); 1255 1256 JNIEXPORT jint JNICALL 1257 JVM_RecvFrom(jint fd, char *buf, int nBytes, 1258 int flags, struct sockaddr *from, int *fromlen); 1259 1260 JNIEXPORT jint JNICALL 1261 JVM_SendTo(jint fd, char *buf, int len, 1262 int flags, struct sockaddr *to, int tolen); 1263 1264 JNIEXPORT jint JNICALL 1265 JVM_SocketAvailable(jint fd, jint *result); 1266 1267 1268 JNIEXPORT jint JNICALL 1269 JVM_GetSockName(jint fd, struct sockaddr *him, int *len); 1270 1271 JNIEXPORT jint JNICALL 1272 JVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen); 1273 1274 JNIEXPORT jint JNICALL 1275 JVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen); 1276 1277 JNIEXPORT int JNICALL 1278 JVM_GetHostName(char* name, int namelen); 1279 1280 /* 1281 * The standard printing functions supported by the Java VM. (Should they 1282 * be renamed to JVM_* in the future? 1283 */ 1284 1285 /* 1286 * BE CAREFUL! The following functions do not implement the 1287 * full feature set of standard C printf formats. 1288 */ 1289 int 1290 jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args); 1291 1292 int 1293 jio_snprintf(char *str, size_t count, const char *fmt, ...); 1294 1295 int 1296 jio_fprintf(FILE *, const char *fmt, ...); 1297 1298 int 1299 jio_vfprintf(FILE *, const char *fmt, va_list args); 1300 1325 JNIEXPORT jobject JNICALL 1326 JVM_InitAgentProperties(JNIEnv *env, jobject agent_props); 1327 1328 JNIEXPORT jstring JNICALL 1329 JVM_GetTemporaryDirectory(JNIEnv *env); 1330 1331 /* Generics reflection support. 1332 * 1333 * Returns information about the given class's EnclosingMethod 1334 * attribute, if present, or null if the class had no enclosing 1335 * method. 1336 * 1337 * If non-null, the returned array contains three elements. Element 0 1338 * is the java.lang.Class of which the enclosing method is a member, 1339 * and elements 1 and 2 are the java.lang.Strings for the enclosing 1340 * method's name and descriptor, respectively. 1341 */ 1342 JNIEXPORT jobjectArray JNICALL 1343 JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass); 1344 1345 /* 1346 * Java thread state support 1347 */ 1348 enum { 1349 JAVA_THREAD_STATE_NEW = 0, 1350 JAVA_THREAD_STATE_RUNNABLE = 1, 1351 JAVA_THREAD_STATE_BLOCKED = 2, 1352 JAVA_THREAD_STATE_WAITING = 3, 1353 JAVA_THREAD_STATE_TIMED_WAITING = 4, 1354 JAVA_THREAD_STATE_TERMINATED = 5, 1355 JAVA_THREAD_STATE_COUNT = 6 1356 }; 1357 1358 /* 1359 * Returns an array of the threadStatus values representing the 1360 * given Java thread state. Returns NULL if the VM version is 1361 * incompatible with the JDK or doesn't support the given 1362 * Java thread state. 1363 */ 1364 JNIEXPORT jintArray JNICALL 1365 JVM_GetThreadStateValues(JNIEnv* env, jint javaThreadState); 1366 1367 /* 1368 * Returns an array of the substate names representing the 1369 * given Java thread state. Returns NULL if the VM version is 1370 * incompatible with the JDK or the VM doesn't support 1371 * the given Java thread state. 1372 * values must be the jintArray returned from JVM_GetThreadStateValues 1373 * and javaThreadState. 1374 */ 1375 JNIEXPORT jobjectArray JNICALL 1376 JVM_GetThreadStateNames(JNIEnv* env, jint javaThreadState, jintArray values); 1377 1378 /* ========================================================================= 1379 * The following defines a private JVM interface that the JDK can query 1380 * for the JVM version and capabilities. sun.misc.Version defines 1381 * the methods for getting the VM version and its capabilities. 1382 * 1383 * When a new bit is added, the following should be updated to provide 1384 * access to the new capability: 1385 * HS: JVM_GetVersionInfo and Abstract_VM_Version class 1386 * SDK: Version class 1387 * 1388 * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for 1389 * JVM to query for the JDK version and capabilities. 1390 * 1391 * When a new bit is added, the following should be updated to provide 1392 * access to the new capability: 1393 * HS: JDK_Version class 1394 * SDK: JDK_GetVersionInfo0 1395 * 1396 * ========================================================================== 1397 */ | 94 */ 95 JNIEXPORT jstring JNICALL 96 JVM_InternString(JNIEnv *env, jstring str); 97 98 /* 99 * java.lang.System 100 */ 101 JNIEXPORT jlong JNICALL 102 JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored); 103 104 JNIEXPORT jlong JNICALL 105 JVM_NanoTime(JNIEnv *env, jclass ignored); 106 107 JNIEXPORT void JNICALL 108 JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos, 109 jobject dst, jint dst_pos, jint length); 110 111 JNIEXPORT jobject JNICALL 112 JVM_InitProperties(JNIEnv *env, jobject p); 113 114 115 /* 116 * java.lang.Runtime 117 */ 118 JNIEXPORT void JNICALL 119 JVM_Halt(jint code); 120 121 JNIEXPORT void JNICALL 122 JVM_GC(void); 123 124 /* Returns the number of real-time milliseconds that have elapsed since the 125 * least-recently-inspected heap object was last inspected by the garbage 126 * collector. 127 * 128 * For simple stop-the-world collectors this value is just the time 129 * since the most recent collection. For generational collectors it is the 130 * time since the oldest generation was most recently collected. Other 131 * collectors are free to return a pessimistic estimate of the elapsed time, or 132 * simply the time since the last full collection was performed. 133 * 134 * Note that in the presence of reference objects, a given object that is no 135 * longer strongly reachable may have to be inspected multiple times before it 136 * can be reclaimed. 137 */ 138 JNIEXPORT jlong JNICALL 139 JVM_MaxObjectInspectionAge(void); 140 141 JNIEXPORT jlong JNICALL 142 JVM_TotalMemory(void); 143 144 JNIEXPORT jlong JNICALL 145 JVM_FreeMemory(void); 146 147 JNIEXPORT jlong JNICALL 148 JVM_MaxMemory(void); 149 150 JNIEXPORT jint JNICALL 151 JVM_ActiveProcessorCount(void); 152 153 JNIEXPORT void * JNICALL 154 JVM_LoadLibrary(const char *name); 155 156 JNIEXPORT void JNICALL 157 JVM_UnloadLibrary(void * handle); 158 159 JNIEXPORT void * JNICALL 160 JVM_FindLibraryEntry(void *handle, const char *name); 161 162 JNIEXPORT jboolean JNICALL 163 JVM_IsSupportedJNIVersion(jint version); 164 165 /* 166 * java.lang.Throwable 167 */ 168 JNIEXPORT void JNICALL 169 JVM_FillInStackTrace(JNIEnv *env, jobject throwable); 170 171 JNIEXPORT jint JNICALL 172 JVM_GetStackTraceDepth(JNIEnv *env, jobject throwable); 173 174 JNIEXPORT jobject JNICALL 175 JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index); 176 177 /* 178 * java.lang.Thread 179 */ 180 JNIEXPORT void JNICALL 181 JVM_StartThread(JNIEnv *env, jobject thread); 182 183 JNIEXPORT void JNICALL 184 JVM_StopThread(JNIEnv *env, jobject thread, jobject exception); 185 186 JNIEXPORT jboolean JNICALL 187 JVM_IsThreadAlive(JNIEnv *env, jobject thread); 188 189 JNIEXPORT void JNICALL 190 JVM_SuspendThread(JNIEnv *env, jobject thread); 191 192 JNIEXPORT void JNICALL 193 JVM_ResumeThread(JNIEnv *env, jobject thread); 194 195 JNIEXPORT void JNICALL 196 JVM_SetThreadPriority(JNIEnv *env, jobject thread, jint prio); 197 243 244 JNIEXPORT jint JNICALL 245 JVM_ClassDepth(JNIEnv *env, jstring name); 246 247 JNIEXPORT jint JNICALL 248 JVM_ClassLoaderDepth(JNIEnv *env); 249 250 /* 251 * java.lang.Package 252 */ 253 JNIEXPORT jstring JNICALL 254 JVM_GetSystemPackage(JNIEnv *env, jstring name); 255 256 JNIEXPORT jobjectArray JNICALL 257 JVM_GetSystemPackages(JNIEnv *env); 258 259 /* 260 * java.io.ObjectInputStream 261 */ 262 JNIEXPORT jobject JNICALL 263 JVM_LatestUserDefinedLoader(JNIEnv *env); 264 265 /* 266 * java.lang.reflect.Array 267 */ 268 JNIEXPORT jint JNICALL 269 JVM_GetArrayLength(JNIEnv *env, jobject arr); 270 271 JNIEXPORT jobject JNICALL 272 JVM_GetArrayElement(JNIEnv *env, jobject arr, jint index); 273 274 JNIEXPORT jvalue JNICALL 275 JVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode); 276 277 JNIEXPORT void JNICALL 278 JVM_SetArrayElement(JNIEnv *env, jobject arr, jint index, jobject val); 279 280 JNIEXPORT void JNICALL 281 JVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v, 282 unsigned char vCode); 283 284 JNIEXPORT jobject JNICALL 285 JVM_NewArray(JNIEnv *env, jclass eltClass, jint length); 296 /* 297 * Returns the immediate caller class of the native method invoking 298 * JVM_GetCallerClass. The Method.invoke and other frames due to 299 * reflection machinery are skipped. 300 * 301 * The depth parameter must be -1 (JVM_DEPTH). The caller is expected 302 * to be marked with sun.reflect.CallerSensitive. The JVM will throw 303 * an error if it is not marked propertly. 304 */ 305 JNIEXPORT jclass JNICALL 306 JVM_GetCallerClass(JNIEnv *env, int depth); 307 308 309 /* 310 * Find primitive classes 311 * utf: class name 312 */ 313 JNIEXPORT jclass JNICALL 314 JVM_FindPrimitiveClass(JNIEnv *env, const char *utf); 315 316 317 /* 318 * Find a class from a boot class loader. Returns NULL if class not found. 319 */ 320 JNIEXPORT jclass JNICALL 321 JVM_FindClassFromBootLoader(JNIEnv *env, const char *name); 322 323 /* 324 * Find a class from a given class loader. Throw ClassNotFoundException 325 * or NoClassDefFoundError depending on the value of the last 326 * argument. 327 */ 328 JNIEXPORT jclass JNICALL 329 JVM_FindClassFromClassLoader(JNIEnv *env, const char *name, jboolean init, 330 jobject loader, jboolean throwError); 331 332 /* 333 * Find a class from a given class. 334 */ 335 JNIEXPORT jclass JNICALL 1006 JVM_ACC_BRIDGE | \ 1007 JVM_ACC_VARARGS | \ 1008 JVM_ACC_NATIVE | \ 1009 JVM_ACC_ABSTRACT | \ 1010 JVM_ACC_STRICT | \ 1011 JVM_ACC_SYNTHETIC) 1012 1013 /* 1014 * This is the function defined in libjava.so to perform path 1015 * canonicalization. VM call this function before opening jar files 1016 * to load system classes. 1017 * 1018 */ 1019 1020 typedef int (*canonicalize_fn_t)(JNIEnv *env, char *orig, char *out, int len); 1021 1022 /************************************************************************* 1023 PART 3: I/O and Network Support 1024 ************************************************************************/ 1025 1026 /* 1027 * Convert a pathname into native format. This function does syntactic 1028 * cleanup, such as removing redundant separator characters. It modifies 1029 * the given pathname string in place. 1030 */ 1031 JNIEXPORT char * JNICALL 1032 JVM_NativePath(char *); 1033 1034 /* 1035 * The standard printing functions supported by the Java VM. (Should they 1036 * be renamed to JVM_* in the future? 1037 */ 1038 1039 /* 1040 * BE CAREFUL! The following functions do not implement the 1041 * full feature set of standard C printf formats. 1042 */ 1043 int 1044 jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args); 1045 1046 int 1047 jio_snprintf(char *str, size_t count, const char *fmt, ...); 1048 1049 int 1050 jio_fprintf(FILE *, const char *fmt, ...); 1051 1052 int 1053 jio_vfprintf(FILE *, const char *fmt, va_list args); 1054 1079 JNIEXPORT jobject JNICALL 1080 JVM_InitAgentProperties(JNIEnv *env, jobject agent_props); 1081 1082 JNIEXPORT jstring JNICALL 1083 JVM_GetTemporaryDirectory(JNIEnv *env); 1084 1085 /* Generics reflection support. 1086 * 1087 * Returns information about the given class's EnclosingMethod 1088 * attribute, if present, or null if the class had no enclosing 1089 * method. 1090 * 1091 * If non-null, the returned array contains three elements. Element 0 1092 * is the java.lang.Class of which the enclosing method is a member, 1093 * and elements 1 and 2 are the java.lang.Strings for the enclosing 1094 * method's name and descriptor, respectively. 1095 */ 1096 JNIEXPORT jobjectArray JNICALL 1097 JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass); 1098 1099 /* ========================================================================= 1100 * The following defines a private JVM interface that the JDK can query 1101 * for the JVM version and capabilities. sun.misc.Version defines 1102 * the methods for getting the VM version and its capabilities. 1103 * 1104 * When a new bit is added, the following should be updated to provide 1105 * access to the new capability: 1106 * HS: JVM_GetVersionInfo and Abstract_VM_Version class 1107 * SDK: Version class 1108 * 1109 * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for 1110 * JVM to query for the JDK version and capabilities. 1111 * 1112 * When a new bit is added, the following should be updated to provide 1113 * access to the new capability: 1114 * HS: JDK_Version class 1115 * SDK: JDK_GetVersionInfo0 1116 * 1117 * ========================================================================== 1118 */ |