commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r802336 - in /commons/sandbox/runtime/trunk/src/main/native: include/arch/windows/acr_arch.h os/win32/pmutex.c os/win32/shm.c os/win32/wutil.c
Date Sat, 08 Aug 2009 10:23:29 GMT
Author: mturk
Date: Sat Aug  8 10:23:29 2009
New Revision: 802336

URL: http://svn.apache.org/viewvc?rev=802336&view=rev
Log:
Always use global kernel object prefix

Modified:
    commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h
    commons/sandbox/runtime/trunk/src/main/native/os/win32/pmutex.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c

Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h?rev=802336&r1=802335&r2=802336&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h Sat Aug
 8 10:23:29 2009
@@ -335,7 +335,7 @@
     return;
 }
 
-wchar_t *res_name_from_filenamew(int,  wchar_t *, const wchar_t *);
+wchar_t *res_name_from_filenamew(int, wchar_t *, const wchar_t *);
 
 /*
  * ---------------------------------------------------------------------

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/pmutex.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/pmutex.c?rev=802336&r1=802335&r2=802336&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/pmutex.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/pmutex.c Sat Aug  8 10:23:29 2009
@@ -30,7 +30,7 @@
             CloseHandle(mutex);
         return ACR_SUCCESS;
     }
-    return ACR_EINVAL;
+    return ACR_EBADF;
 }
 
 ACR_DECLARE(int) ACR_ProcMutexCreate(JNIEnv *_E, const acr_pchar_t *fname)
@@ -49,7 +49,7 @@
          * without slashes or backslashes, and prepends the \global
          * prefix on Win2K and later
          */
-        reskey = res_name_from_filenamew(1, keybuf, fname);
+        reskey = res_name_from_filenamew(ACR_DT_MUTEX, keybuf, fname);
     }
     m = CreateMutexW(NULL, FALSE, reskey);
     if (!m)
@@ -74,7 +74,7 @@
      * without slashes or backslashes, and prepends the \global
      * prefix on Win2K and later
      */
-    res_name_from_filenamew(1, reskey, fname);
+    res_name_from_filenamew(ACR_DT_MUTEX, reskey, fname);
 
     m = OpenMutexW(MUTEX_ALL_ACCESS, FALSE, reskey);
     if (!m)
@@ -146,3 +146,4 @@
      */
     return acr_ioh_close(mutex);
 }
+

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c?rev=802336&r1=802335&r2=802336&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c Sat Aug  8 10:23:29 2009
@@ -46,7 +46,7 @@
     acr_shm_t *m = (acr_shm_t *)shm;
 
     if (type != ACR_DT_SHM) {
-        return ACR_EINVAL;
+        return ACR_EBADF;
     }
     if (!UnmapViewOfFile(m->memblk)) {
         rc = ACR_GET_OS_ERROR();
@@ -163,7 +163,7 @@
          * without slashes or backslashes, and prepends the \global
          * prefix on Win2K and later
          */
-        reskey = res_name_from_filenamew(1, keybuf, filename);
+        reskey = res_name_from_filenamew(ACR_DT_SHM, keybuf, filename);
 
     }
     hmap = CreateFileMappingW(hfile, NULL, PAGE_READWRITE,
@@ -243,7 +243,7 @@
     shm = ACR_Calloc(_E, THROW_FMARK, sizeof(acr_shm_t));
     if (!shm)
         return -1;
-    res_name_from_filenamew(1, reskey, filename);
+    res_name_from_filenamew(ACR_DT_SHM, reskey, filename);
     hmap = OpenFileMappingW(FILE_MAP_READ | FILE_MAP_WRITE, FALSE, reskey);
     if (!hmap) {
         rc = ACR_GET_OS_ERROR();
@@ -326,3 +326,4 @@
     else
         return m->length;
 }
+

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c?rev=802336&r1=802335&r2=802336&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c Sat Aug  8 10:23:29 2009
@@ -21,27 +21,40 @@
 #include "acr_error.h"
 #include "acr_memory.h"
 #include "acr_string.h"
+#include "acr_descriptor.h"
 #include "acr_crypto.h"
 
-wchar_t *res_name_from_filenamew(int global, wchar_t *rname,
+/*
+ * XXX: Make sure it is synced with ACR_DT_ types
+ */
+static const wchar_t *dtnames[] = {
+    L"a0_",     /* ACR_DT_UNKNOWN   */
+    L"a1_",     /* ACR_DT_FILE      */
+    L"a2_",     /* ACR_DT_USER      */
+    L"a3_",     /* ACR_DT_GROUP     */
+    L"a4_",     /* ACR_DT_MUTEX     */
+    L"a5_",     /* ACR_DT_SHM       */
+    L"a6_",     /* ACR_DT_PIPE      */
+    L"a7_",     /* ACR_DT_SOCKET    */
+    L"a8_",     /* ACR_DT_DSO       */
+    NULL
+};
+
+wchar_t *res_name_from_filenamew(int type, wchar_t *rname,
                                  const wchar_t *fname)
 {
     DWORD   rc;
     wchar_t pname[ACR_HBUFF_SIZ];
-    const wchar_t *prefix;
-
-    if (global)
-        prefix = L"Global\\ACR_";
-    else
-        prefix = L"Local\\ACR_";
 
-    wcscpy(rname, prefix);
+    wcscpy(rname, L"Global\\");
+    wcscat(rname, dtnames[type]);
     rc = GetFullPathNameW(fname, ACR_HBUFF_LEN, pname, NULL);
     if (rc == 0 || rc > ACR_HBUFF_LEN)
-        ACR_Sha1Base16W(fname, wcslen(fname), rname + wcslen(prefix));
+        ACR_Sha1Base16W(fname, wcslen(fname), rname + 10);
     else
-        ACR_Sha1Base16W(pname, wcslen(pname), rname + wcslen(prefix));
+        ACR_Sha1Base16W(pname, wcslen(pname), rname + 10);
     fprintf(stdout, "Converted %S from %S\n", rname, pname);
     fflush(stdout);
     return rname;
 }
+



Mime
View raw message