Author: mturk Date: Mon Dec 14 07:25:33 2009 New Revision: 890202 URL: http://svn.apache.org/viewvc?rev=890202&view=rev Log: Use int descriptor directly
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SharedMemory.java commons/sandbox/runtime/trunk/src/main/native/shared/shm.c Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SharedMemory.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SharedMemory.java?rev=890202&r1=890201&r2=890202&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SharedMemory.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/SharedMemory.java Mon Dec 14 07:25:33 2009 @@ -243,7 +243,7 @@ } } - private static native Pointer map0(Descriptor shm) + private static native Pointer map0(int shm) throws IOException; /** * Retrieve new {...@code Pointer} base address of the shared memory segment. @@ -258,7 +258,7 @@ throws IOException, ClosedDescriptorException { if (shm.valid()) { - Pointer p = map0(shm); + Pointer p = map0(shm.fd()); mappedRegions.add(p); return p; } @@ -267,7 +267,7 @@ } } - private static native Pointer map1(Descriptor shm, long off, long size) + private static native Pointer map1(int shm, long off, long size) throws IOException, IndexOutOfBoundsException; /** * Retrieve new {...@code Pointer} address of the shared memory segment. @@ -284,7 +284,7 @@ throws IOException, IndexOutOfBoundsException, ClosedDescriptorException { if (shm.valid()) { - Pointer p = map1(shm, offset, size); + Pointer p = map1(shm.fd(), offset, size); mappedRegions.add(p); return p; } Modified: commons/sandbox/runtime/trunk/src/main/native/shared/shm.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/shm.c?rev=890202&r1=890201&r2=890202&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/shared/shm.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/shared/shm.c Mon Dec 14 07:25:33 2009 @@ -68,14 +68,12 @@ } ACR_JNI_EXPORT_DECLARE(jobject, SharedMemory, map0)(ACR_JNISTDARGS, - jobject shmd) + jint sd) { jobject mpo = NULL; - int sd; UNREFERENCED_O; - sd = ACR_DescriptorGetInt(_E, shmd); if (sd > 0) { size_t len; char *mem = (char *)ACR_ShmGetBaseAddr(sd); @@ -90,17 +88,15 @@ } ACR_JNI_EXPORT_DECLARE(jobject, SharedMemory, map1)(ACR_JNISTDARGS, - jobject shmd, + jint sd, jlong off, jlong siz) { jobject mpo = NULL; size_t of = (size_t)off; size_t sz = (size_t)siz; - int sd; UNREFERENCED_O; - sd = ACR_DescriptorGetInt(_E, shmd); if (sd > 0) { size_t len; char *mem = (char *)ACR_ShmGetBaseAddr(sd);