512 |
{ |
{ |
513 |
#ifdef HAVE_MMAP |
#ifdef HAVE_MMAP |
514 |
jclass MappedByteBufferImpl_class; |
jclass MappedByteBufferImpl_class; |
|
jclass RawData_class; |
|
515 |
jmethodID MappedByteBufferImpl_init = NULL; |
jmethodID MappedByteBufferImpl_init = NULL; |
|
jmethodID RawData_init = NULL; |
|
516 |
jobject RawData_instance; |
jobject RawData_instance; |
517 |
volatile jobject buffer; |
volatile jobject buffer; |
518 |
long pagesize; |
long pagesize; |
533 |
return NULL; |
return NULL; |
534 |
#endif /* HAVE_GETPAGESIZE/HAVE_SYSCONF */ |
#endif /* HAVE_GETPAGESIZE/HAVE_SYSCONF */ |
535 |
|
|
|
#if (SIZEOF_VOID_P == 4) |
|
|
RawData_class = (*env)->FindClass (env, "gnu/classpath/RawData32"); |
|
|
if (RawData_class != NULL) |
|
|
{ |
|
|
RawData_init = (*env)->GetMethodID (env, RawData_class, |
|
|
"<init>", "(I)V"); |
|
|
} |
|
|
#elif (SIZEOF_VOID_P == 8) |
|
|
RawData_class = (*env)->FindClass (env, "gnu/classpath/RawData64"); |
|
|
if (RawData_class != NULL) |
|
|
{ |
|
|
RawData_init = (*env)->GetMethodID (env, RawData_class, |
|
|
"<init>", "(J)V"); |
|
|
} |
|
|
#else |
|
|
JCL_ThrowException (env, IO_EXCEPTION, |
|
|
"pointer size not supported"); |
|
|
return NULL; |
|
|
#endif /* SIZEOF_VOID_P */ |
|
|
|
|
536 |
if ((*env)->ExceptionOccurred (env)) |
if ((*env)->ExceptionOccurred (env)) |
537 |
{ |
{ |
538 |
return NULL; |
return NULL; |
561 |
down to a multiple of the page size. */ |
down to a multiple of the page size. */ |
562 |
address = (void *) ((char *) p + (position % pagesize)); |
address = (void *) ((char *) p + (position % pagesize)); |
563 |
|
|
564 |
#if (SIZEOF_VOID_P == 4) |
RawData_instance = JCL_NewRawDataObject(env, address); |
|
RawData_instance = (*env)->NewObject (env, RawData_class, |
|
|
RawData_init, (jint) address); |
|
|
#elif (SIZEOF_VOID_P == 8) |
|
|
RawData_instance = (*env)->NewObject (env, RawData_class, |
|
|
RawData_init, (jlong) address); |
|
|
#endif /* SIZEOF_VOID_P */ |
|
565 |
|
|
566 |
MappedByteBufferImpl_class = (*env)->FindClass (env, |
MappedByteBufferImpl_class = (*env)->FindClass (env, |
567 |
"java/nio/MappedByteBufferImpl"); |
"java/nio/MappedByteBufferImpl"); |