321 }
322
323 /*
324 * Return the error message for this thread.
325 */
326 static jdwpTransportError JNICALL
327 shmemGetLastError(jdwpTransportEnv* env, char **msgP)
328 {
329 char *msg = (char *)sysTlsGet(tlsIndex);
330 if (msg == NULL) {
331 return JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE;
332 }
333 *msgP = (*callbacks->alloc)((int)strlen(msg)+1);
334 if (*msgP == NULL) {
335 return JDWPTRANSPORT_ERROR_OUT_OF_MEMORY;
336 }
337 strcpy(*msgP, msg);
338 return JDWPTRANSPORT_ERROR_NONE;
339 }
340
341 JNIEXPORT jint JNICALL
342 jdwpTransport_OnLoad(JavaVM *vm, jdwpTransportCallback* cbTablePtr,
343 jint version, jdwpTransportEnv** result)
344 {
345 if (version != JDWPTRANSPORT_VERSION_1_0) {
346 return JNI_EVERSION;
347 }
348 if (initialized) {
349 /*
350 * This library doesn't support multiple environments (yet)
351 */
352 return JNI_EEXIST;
353 }
354 initialized = JNI_TRUE;
355
356 /* initialize base shared memory system */
357 (void) shmemBase_initialize(vm, cbTablePtr);
358
359 /* save callbacks */
360 callbacks = cbTablePtr;
361
|
321 }
322
323 /*
324 * Return the error message for this thread.
325 */
326 static jdwpTransportError JNICALL
327 shmemGetLastError(jdwpTransportEnv* env, char **msgP)
328 {
329 char *msg = (char *)sysTlsGet(tlsIndex);
330 if (msg == NULL) {
331 return JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE;
332 }
333 *msgP = (*callbacks->alloc)((int)strlen(msg)+1);
334 if (*msgP == NULL) {
335 return JDWPTRANSPORT_ERROR_OUT_OF_MEMORY;
336 }
337 strcpy(*msgP, msg);
338 return JDWPTRANSPORT_ERROR_NONE;
339 }
340
341 jint JNICALL
342 jdwpTransport_OnLoad(JavaVM *vm, jdwpTransportCallback* cbTablePtr,
343 jint version, jdwpTransportEnv** result)
344 {
345 if (version != JDWPTRANSPORT_VERSION_1_0) {
346 return JNI_EVERSION;
347 }
348 if (initialized) {
349 /*
350 * This library doesn't support multiple environments (yet)
351 */
352 return JNI_EEXIST;
353 }
354 initialized = JNI_TRUE;
355
356 /* initialize base shared memory system */
357 (void) shmemBase_initialize(vm, cbTablePtr);
358
359 /* save callbacks */
360 callbacks = cbTablePtr;
361
|