commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r810882 - in /commons/sandbox/runtime/trunk/src/main/native: include/arch/unix/acr_arch.h include/arch/windows/acr_arch.h os/unix/ios.c os/unix/pmmap.c
Date Thu, 03 Sep 2009 10:44:19 GMT
Author: mturk
Date: Thu Sep  3 10:44:19 2009
New Revision: 810882

URL: http://svn.apache.org/viewvc?rev=810882&view=rev
Log:
Rename HANDLE macros. No functional change

Modified:
    commons/sandbox/runtime/trunk/src/main/native/include/arch/unix/acr_arch.h
    commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h
    commons/sandbox/runtime/trunk/src/main/native/os/unix/ios.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/pmmap.c

Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/unix/acr_arch.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/unix/acr_arch.h?rev=810882&r1=810881&r2=810882&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/unix/acr_arch.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/unix/acr_arch.h Thu Sep  3
10:44:19 2009
@@ -51,6 +51,10 @@
 #define IS_INVALID_HANDLE(h) (((h) == NULL || (h) == INVALID_HANDLE_VALUE))
 #define IS_VALID_HANDLE(h)   (((h) != NULL && (h) != INVALID_HANDLE_VALUE))
 
+#define INVALID_MEMORY_VALUE ((void *)(ptrdiff_t)-1)
+#define IS_INVALID_MEMORY(h) (((h) == NULL || (h) == INVALID_MEMORY_VALUE))
+#define IS_VALID_MEMORY(h)   (((h) != NULL && (h) != INVALID_MEMORY_VALUE))
+
 typedef struct acr_ioh acr_ioh;
 typedef int (acr_ioh_cleanup_fn_t)(void *, int, unsigned int);
 

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=810882&r1=810881&r2=810882&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 Thu Sep
 3 10:44:19 2009
@@ -683,6 +683,11 @@
 
 #define IS_INVALID_HANDLE(h) (((h) == NULL || (h) == INVALID_HANDLE_VALUE))
 #define IS_VALID_HANDLE(h)   (((h) != NULL && (h) != INVALID_HANDLE_VALUE))
+
+#define INVALID_MEMORY_VALUE ((void *)(ptrdiff_t)-1)
+#define IS_INVALID_MEMORY(h) (((h) == NULL || (h) == INVALID_MEMORY_VALUE))
+#define IS_VALID_MEMORY(h)   (((h) != NULL && (h) != INVALID_MEMORY_VALUE))
+
 #define ACR_REGS_CPU  "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\"
 #define ACR_REGS_CPU0 ACR_REGS_CPU "0\\"
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/ios.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/ios.c?rev=810882&r1=810881&r2=810882&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/ios.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/ios.c Thu Sep  3 10:44:19 2009
@@ -29,7 +29,7 @@
 #define __SET_BMP(X, B)    __bitmap[(X)] |= __zero_bit_mask[(B) & 0x07]
 #define __CLR_BMP(X, B)    __bitmap[(X)] &= __ones_bit_mask[(B) & 0x07]
 
-static   acr_ioh nul_ioh_tab = { INVALID_HANDLE_VALUE };
+static   acr_ioh nul_ioh_tab = { INVALID_HANDLE_VALUE, NULL, 0, 0 };
 acr_ioh *acr_ioh_tab = &nul_ioh_tab;
 int      acr_ioh_mask;
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/pmmap.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/pmmap.c?rev=810882&r1=810881&r2=810882&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/pmmap.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/pmmap.c Thu Sep  3 10:44:19 2009
@@ -63,7 +63,7 @@
     if (type != ACR_DT_MMAP) {
         return ACR_EFTYPE;
     }
-    if (IS_VALID_HANDLE(m->base)) {
+    if (IS_VALID_MEMORY(m->base)) {
         if (munmap(m->base, m->size))
             rc = ACR_GET_OS_ERROR();
     }
@@ -79,7 +79,7 @@
 
 static int mmap_pointer_cleanup(void *address, size_t length)
 {
-    if (!length || IS_INVALID_HANDLE(address))
+    if (!length || IS_INVALID_MEMORY(address))
         return ACR_EBADF;
     if (munmap(address, length))
         return ACR_GET_OS_ERROR();
@@ -106,7 +106,7 @@
                 if (ACR_IOH_FTYPE(dp->di) != ACR_DT_MMAP)
                     rc = ACR_EFTYPE;
                 else {
-                    if (IS_VALID_HANDLE(m->base)) {
+                    if (IS_VALID_MEMORY(m->base)) {
                         if (msync(m->base, m->size, MS_SYNC)) {
                             /* Error during sync */
                             rc = ACR_GET_OS_ERROR();
@@ -122,7 +122,7 @@
                 if (ACR_IOH_FTYPE(dp->di) != ACR_DT_MMAP)
                     rc = ACR_EFTYPE;
                 else {
-                    if (IS_VALID_HANDLE(m->base)) {
+                    if (IS_VALID_MEMORY(m->base)) {
                         if (msync(m->base, m->size, MS_SYNC | MS_INVALIDATE)) {
                             /* This will return ACR_EBUSY if some other memory
                              * mapped region is locked
@@ -236,7 +236,7 @@
         ACR_THROW_EX_IF_ERR(ACR_EX_EINVAL, ACR_EFTYPE);
         return NULL;
     }
-    if (IS_VALID_HANDLE(m->base)) {
+    if (IS_VALID_MEMORY(m->base)) {
         /* Already mapped.
          */
         if (m->offset == offset && m->size == size) {
@@ -249,7 +249,7 @@
         return NULL;
     }
     m->base = mmap(NULL, size, m->flags, MAP_SHARED, m->fd, offset);
-    if (m->base == MAP_FAILED) {
+    if (IS_INVALID_MEMORY(m->base)) {
         ACR_THROW_IO_ERRNO();
         return NULL;
     }
@@ -267,16 +267,16 @@
         ACR_THROW_EX_IF_ERR(ACR_EX_EINVAL, ACR_EFTYPE);
         return ACR_EFTYPE;
     }
-    if (IS_INVALID_HANDLE(m->base)) {
+    if (IS_INVALID_MEMORY(m->base)) {
         ACR_THROW_IO_IF_ERR(ACR_EBADF);
         return ACR_EBADF;
     }
     if (munmap(m->base, m->size)) {
-        m->base = MAP_FAILED;
+        m->base = INVALID_MEMORY_VALUE;
         ACR_THROW_IO_ERRNO();
         return ACR_GET_OS_ERROR();
     }
-    m->base   = MAP_FAILED;
+    m->base   = INVALID_MEMORY_VALUE;
     m->offset = 0;
     m->size   = 0;
 
@@ -397,7 +397,7 @@
         return NULL;
     }
     base = mmap(NULL, (size_t)size, m->flags, MAP_SHARED, m->fd, (off_t)offset);
-    if (base == MAP_FAILED) {
+    if (IS_INVALID_MEMORY(base)) {
         ACR_THROW_IO_ERRNO();
         return NULL;
     }
@@ -429,7 +429,7 @@
     }
     size = s.st_size - offset;
     base = mmap(NULL, (size_t)size, m->flags, MAP_SHARED, m->fd, (off_t)offset);
-    if (base == MAP_FAILED) {
+    if (IS_INVALID_MEMORY(base)) {
         ACR_THROW_IO_ERRNO();
         return NULL;
     }



Mime
View raw message