harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r773961 - in /harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix: OSFileSystemLinux32.c OSMemoryLinux32.c
Date Tue, 12 May 2009 16:17:04 GMT
Author: odeakin
Date: Tue May 12 16:17:03 2009
New Revision: 773961

URL: http://svn.apache.org/viewvc?rev=773961&view=rev
Log:
Make sure we use the correct file descriptors on z/OS.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c?rev=773961&r1=773960&r2=773961&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSFileSystemLinux32.c
Tue May 12 16:17:03 2009
@@ -181,7 +181,7 @@
     vectors[i].iov_len = lengths[i];
     i++;
   }
-  totalRead = readv(fd, vectors, size);
+  totalRead = readv(fd-FD_BIAS, vectors, size);
   if(bufsCopied){
     (*env)->ReleaseLongArrayElements(env, jbuffers, bufs, JNI_ABORT);
   }
@@ -223,7 +223,7 @@
     vectors[i].iov_len = lengths[i];
     i++;
   }
-  totalWritten = writev(fd, vectors, size);
+  totalWritten = writev(fd-FD_BIAS, vectors, size);
   if(bufsCopied){
     (*env)->ReleaseLongArrayElements(env, jbuffers, bufs, JNI_ABORT);
   }
@@ -255,7 +255,7 @@
 #if defined(AIX) || defined(ZOS)
   {
     struct sf_parms parms;
-    parms.file_descriptor = (int)fd;
+    parms.file_descriptor = (int)fd-FD_BIAS;
     parms.file_offset = (off64_t)offset;
     parms.file_bytes = count;
     parms.header_data = 0;
@@ -270,9 +270,9 @@
    */
   off_t off = offset;
 #if !defined(FREEBSD)
-  return sendfile(socket,(int)fd,(off_t *)&off,(size_t)count);	
+  return sendfile(socket,(int)fd-FD_BIAS,(off_t *)&off,(size_t)count);	
 #else
-  return sendfile(fd, socket, off, (size_t)count, NULL, NULL, 0);
+  return sendfile(fd-FD_BIAS, socket, off, (size_t)count, NULL, NULL, 0);
 #endif
 #endif
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c?rev=773961&r1=773960&r2=773961&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSMemoryLinux32.c
Tue May 12 16:17:03 2009
@@ -30,6 +30,12 @@
 #include "OSMemory.h"
 #include "IMemorySystem.h"
 
+#ifdef ZOS
+#define FD_BIAS 1000
+#else
+#define FD_BIAS 0
+#endif /* ZOS */
+
 /* z/OS mman.h does not define MAP_FAILED - it should always be ((void*)-1) */
 #ifndef MAP_FAILED
 #define MAP_FAILED      ((void *) -1)
@@ -171,7 +177,7 @@
         return -1;
     }
 
-  mapAddress = mmap(0, (size_t)(size&0x7fffffff), prot, flags,fd,(off_t)(alignment&0x7fffffff));
+  mapAddress = mmap(0, (size_t)(size&0x7fffffff), prot, flags, fd-FD_BIAS, (off_t)(alignment&0x7fffffff));
   if (mapAddress == MAP_FAILED)
     {
       return -1;



Mime
View raw message