harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r801543 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/procimpl.c
Date Thu, 06 Aug 2009 08:50:27 GMT
Author: odeakin
Date: Thu Aug  6 08:50:27 2009
New Revision: 801543

URL: http://svn.apache.org/viewvc?rev=801543&view=rev
Log:
Adjust file handles for zOS so hyfile_read/write work on the created pipes.

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

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/procimpl.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/procimpl.c?rev=801543&r1=801542&r2=801543&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/procimpl.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/procimpl.c Thu
Aug  6 08:50:27 2009
@@ -33,6 +33,12 @@
 extern char **environ;
 #endif
 
+#ifdef ZOS
+#define FD_BIAS 1000
+#else
+#define FD_BIAS 0
+#endif /* ZOS */
+
 #include <sys/wait.h>
 
 #include "procimpl.h"
@@ -153,7 +159,6 @@
   if (grdpid == 0) {
     char dummy = '\0';
 
-#ifndef ZOS
     /* Close file descriptors that are not used */
     close(newFD[0][1]);
     close(newFD[1][0]);
@@ -167,7 +172,6 @@
     setCloseOnExec(newFD[2][1]);
     setCloseOnExec(forkedChildIsRunning[1]);
     setCloseOnExec(execvFailure[1]);
-#endif /* ZOS */
 
     /* Redirect pipes so grand-child inherits new pipes */
     dup2(newFD[0][0], 0);
@@ -212,9 +216,9 @@
     close(newFD[1][1]);
     close(newFD[2][1]);
     /* Store the rw handles to the childs io */
-    *(inHandle) = (IDATA) newFD[0][1];
-    *(outHandle) = (IDATA) newFD[1][0];
-    *(errHandle) = (IDATA) newFD[2][0];
+    *(inHandle) = (IDATA) newFD[0][1] + FD_BIAS;
+    *(outHandle) = (IDATA) newFD[1][0] + FD_BIAS;
+    *(errHandle) = (IDATA) newFD[2][0] + FD_BIAS;
     *(procHandle) = (IDATA) grdpid;
 
     /* let the forked child start. */
@@ -328,7 +332,7 @@
 getAvailable(IDATA sHandle)
 {
   int avail, rc;
-  rc = ioctl((int) sHandle, FIONREAD, &avail);
+  rc = ioctl((int) sHandle - FD_BIAS, FIONREAD, &avail);
   if (rc == -1)
     return -2;
   return avail;



Mime
View raw message