You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/08/06 19:47:46 UTC

svn commit: r801745 - in /commons/sandbox/runtime/trunk/src/main/native: include/acr_shm.h os/unix/shm.c test/testcase.c

Author: mturk
Date: Thu Aug  6 17:47:45 2009
New Revision: 801745

URL: http://svn.apache.org/viewvc?rev=801745&view=rev
Log:
use only close instead destroy/detach

Modified:
    commons/sandbox/runtime/trunk/src/main/native/include/acr_shm.h
    commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c
    commons/sandbox/runtime/trunk/src/main/native/test/testcase.c

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_shm.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_shm.h?rev=801745&r1=801744&r2=801745&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_shm.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_shm.h Thu Aug  6 17:47:45 2009
@@ -75,19 +75,12 @@
                                const acr_pchar_t *filename);
 
 /**
- * Destroy a shared memory segment and associated memory.
- * @param env JNI environment to use.
- * @param m The shared memory segment structure to destroy.
- */
-ACR_DECLARE(int) ACR_ShmDestroy(JNIEnv *env, int m);
-
-/**
- * Detach from a shared memory segment without destroying it.
+ * Destroy or detach from a shared memory segment.
  * @param env JNI environment to use.
  * @param m The shared memory structure representing the segment
- *        to detach from.
+ *        to destroy or detach from.
  */
-ACR_DECLARE(int) ACR_ShmDetach(JNIEnv *env, int m);
+ACR_DECLARE(int) ACR_ShmClose(JNIEnv *env, int m);
 
 /**
  * Remove named resource associated with a shared memory segment,

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c?rev=801745&r1=801744&r2=801745&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c Thu Aug  6 17:47:45 2009
@@ -117,34 +117,6 @@
     return rc;
 }
 
-ACR_DECLARE(int) ACR_ShmDestroy(JNIEnv *_E, int shm)
-{
-    int rv;
-
-    rv = acr_ioh_close(shm);
-    if (rv  && !IS_INVALID_HANDLE(_E)) {
-        if (rv == EACCES)
-            ACR_ThrowException(_E, THROW_NMARK, ACR_EX_ESECURITY, 0);
-        else
-            ACR_ThrowException(_E, THROW_NMARK, ACR_EX_EIO, rv);
-    }
-    return rv;
-}
-
-ACR_DECLARE(int) ACR_ShmDetach(JNIEnv *_E, int shm)
-{
-    int rv;
-
-    rv = acr_ioh_close(shm);
-    if (rv  && !IS_INVALID_HANDLE(_E)) {
-        if (rv == EACCES)
-            ACR_ThrowException(_E, THROW_NMARK, ACR_EX_ESECURITY, 0);
-        else
-            ACR_ThrowException(_E, THROW_NMARK, ACR_EX_EIO, rv);
-    }
-    return rv;
-}
-
 ACR_DECLARE(int) ACR_ShmClose(JNIEnv *_E, int shm)
 {
     int rv;

Modified: commons/sandbox/runtime/trunk/src/main/native/test/testcase.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/test/testcase.c?rev=801745&r1=801744&r2=801745&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/test/testcase.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/test/testcase.c Thu Aug  6 17:47:45 2009
@@ -663,7 +663,7 @@
 
 ACR_JNI_EXPORT_DECLARE(jint, TestPrivate, test062)(ACR_JNISTDARGS, jint s)
 {
-    return ACR_ShmDestroy(_E, s);
+    return ACR_ShmClose(_E, s);
 }
 
 ACR_JNI_EXPORT_DECLARE(jint, TestPrivate, test063)(ACR_JNISTDARGS, jint d)
@@ -678,7 +678,7 @@
 
 ACR_JNI_EXPORT_DECLARE(jint, TestPrivate, test065)(ACR_JNISTDARGS, jint s)
 {
-    return ACR_ShmDetach(_E, s);
+    return ACR_ShmClose(_E, s);
 }
 
 ACR_JNI_EXPORT_DECLARE(jint, TestPrivate, test066)(ACR_JNISTDARGS, jint s)