harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r591963 - in /harmony/enhanced/classlib/trunk/modules: awt/src/main/native/x11wrapper/unix/ luni/src/main/native/launcher/shared/ luni/src/main/native/launcher/unix/ luni/src/main/native/luni/shared/ luni/src/main/native/luni/unix/
Date Mon, 05 Nov 2007 11:30:48 GMT
Author: odeakin
Date: Mon Nov  5 03:30:46 2007
New Revision: 591963

URL: http://svn.apache.org/viewvc?rev=591963&view=rev
Log:
z/OS specific changes - mostly alterations to header file includes and fixups for differences
in unix and zOS system headers.

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/native/x11wrapper/unix/nativelib_common.h
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/unix/main_hlp.c
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/dblparse.c
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c
    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
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/native/x11wrapper/unix/nativelib_common.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/native/x11wrapper/unix/nativelib_common.h?rev=591963&r1=591962&r2=591963&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/native/x11wrapper/unix/nativelib_common.h
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/native/x11wrapper/unix/nativelib_common.h
Mon Nov  5 03:30:46 2007
@@ -21,10 +21,17 @@
 #ifndef NATIVELIB_COMMON_H
 #define NATIVELIB_COMMON_H
 
-#if defined(LINUX) || defined(FREEBSD) || defined(AIX) || defined(MACOSX)
+#if defined(LINUX) || defined(FREEBSD) || defined(AIX) || defined(MACOSX) || defined(ZOS)
 // common linux section--------------------------------
-#include <dlfcn.h>
+#ifndef ZOS
 #include <stdint.h>
+#else
+#include <stddef.h>
+#ifndef __SUSV3
+#define __SUSV3
+#endif
+#endif
+#include <dlfcn.h>
 
 #define mkstr(x) #x
 
@@ -33,7 +40,7 @@
 
 #define FindFunction(lib, name) (void *)dlsym(lib, name)
 
-#if !defined(__INTEL_COMPILER) && !defined(AIX)
+#if !defined(__INTEL_COMPILER) && !defined(AIX) && !defined(ZOS)
     typedef long long __int64;
 #endif
 

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c?rev=591963&r1=591962&r2=591963&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c Mon
Nov  5 03:30:46 2007
@@ -29,6 +29,10 @@
 #endif /* HY_NO_THR */
 #include <string.h>
 #include <stdlib.h>
+#ifdef ZOS
+#include <unistd.h>
+#endif
+
 
 #define PORT_LIB_OPTION "_org.apache.harmony.vmi.portlib"
 
@@ -46,7 +50,7 @@
 #define PLATFORM_STRNICMP strnicmp
 #endif
 
-#if defined(LINUX) || defined(FREEBSD) || defined(AIX) || defined(MACOSX)
+#if defined(LINUX) || defined(FREEBSD) || defined(AIX) || defined(MACOSX) || defined(ZOS)
 #define PLATFORM_STRNICMP strncasecmp
 #endif
 
@@ -1196,11 +1200,14 @@
     }
   stringMid = ((*env)->GetMethodID (env, stringClass, "<init>", "([BII)V"));
 
+#ifndef ZOS /* Only do UTF conversion on non-z/OS platforms*/
   if (nameIsUTF)
-    {
+#endif /* !ZOS */
+  {
       cls = (*env)->FindClass (env, slashifiedClassName);
       portLibrary->mem_free_memory (portLibrary, slashifiedClassName);
     }
+#ifndef ZOS
   else
     {
       rc =
@@ -1236,10 +1243,12 @@
           rc = 12;
           goto done;
         }
+
       cls = (*env)->FindClass (env, utfClassName);
       (*env)->ReleaseStringUTFChars (env, str, utfClassName);
       (*env)->DeleteLocalRef (env, str);
     }
+#endif /* !ZOS */
 
   if (!cls)
     {
@@ -1259,6 +1268,7 @@
     }
   for (i = 0; i < java_argc; ++i)
     {
+#ifndef ZOS /* Only convert the option strings on non-zOS platforms */
       rc =
         convertString (env, portLibrary, stringClass, stringMid, java_argv[i],
                        &str);
@@ -1282,6 +1292,9 @@
         }
 
       (*env)->SetObjectArrayElement (env, args, i, str);
+#else
+      (*env)->SetObjectArrayElement (env, args, i, (*env)->NewStringUTF(env, java_argv[i]));
+#endif /* !ZOS */
       if ((*env)->ExceptionCheck (env))
         {
           /* HYNLS_EXELIB_INTERNAL_VM_ERR_FAILED_SET_ARRAY_ELEM=Internal VM error: Failed
to set array element for %s\n */
@@ -1291,7 +1304,9 @@
           rc = 9;
           goto done;
         }
+#ifndef ZOS
       (*env)->DeleteLocalRef (env, str);
+#endif /* !ZOS */
     }
 
   mid =

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/unix/main_hlp.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/unix/main_hlp.c?rev=591963&r1=591962&r2=591963&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/unix/main_hlp.c
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/unix/main_hlp.c
Mon Nov  5 03:30:46 2007
@@ -26,6 +26,17 @@
 #include <pwd.h>
 #include <sys/types.h>
 
+#if defined(ZOS)
+/* zOS does not define PATH_MAX, so just set it to be _POSIX_PATH_MAX */
+#ifndef PATH_MAX
+#define PATH_MAX _POSIX_PATH_MAX
+#endif
+/* Need to define this to get RTLD_NOW on zOS */
+#ifndef __SUSV3
+#define __SUSV3
+#endif
+#endif
+
 #if defined(LINUX)
 #include <sys/sysinfo.h>
 #endif

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/dblparse.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/dblparse.c?rev=591963&r1=591962&r2=591963&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/dblparse.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/dblparse.c Mon
Nov  5 03:30:46 2007
@@ -22,7 +22,7 @@
 #include "harmonyglob.h"
 #include "exceptions.h"
 
-#if defined(LINUX) || defined(FREEBSD)
+#if defined(LINUX) || defined(FREEBSD) || defined(ZOS)
 #define USE_LL
 #endif
 

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c?rev=591963&r1=591962&r2=591963&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c Mon
Nov  5 03:30:46 2007
@@ -22,7 +22,7 @@
 #include "harmonyglob.h"
 #include "exceptions.h"
 
-#if defined(LINUX)
+#if defined(LINUX) || defined(ZOS)
 #define USE_LL
 #endif
 

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=591963&r1=591962&r2=591963&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
Mon Nov  5 03:30:46 2007
@@ -23,7 +23,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
-#if defined(FREEBSD)
+#if defined(FREEBSD) || defined(ZOS)
 #include <sys/types.h>
 #include <sys/socket.h>
 #else

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=591963&r1=591962&r2=591963&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
Mon Nov  5 03:30:46 2007
@@ -30,6 +30,11 @@
 #include "OSMemory.h"
 #include "IMemorySystem.h"
 
+/* z/OS mman.h does not define MAP_FAILED - it should always be ((void*)-1) */
+#ifndef MAP_FAILED
+#define MAP_FAILED      ((void *) -1)
+#endif
+
 #define	OS_JNI(func) JNICALL Java_org_apache_harmony_luni_platform_OSMemory_##func
 
 JNIEXPORT jboolean JNICALL Java_org_apache_harmony_luni_platform_OSMemory_isLittleEndianImpl(JNIEnv
* env, jclass clazz)
@@ -67,6 +72,7 @@
 
 JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSMemory_loadImpl
   (JNIEnv * env, jobject thiz, jlong addr, jlong size){
+#if !defined(ZOS)
    if(mlock((void *)((IDATA)addr), size)!=-1)
    {
       if(munlock((void *)((IDATA)addr),size)!=-1)
@@ -77,10 +83,14 @@
       	   return 0;
    }
    return -1;
+#else
+   return 0;
+#endif /* !defined(ZOS) */
   }
 
 JNIEXPORT jboolean JNICALL Java_org_apache_harmony_luni_platform_OSMemory_isLoadedImpl
   (JNIEnv * env, jobject thiz, jlong addr, jlong size){
+#if !defined(ZOS)
 	  PORT_ACCESS_FROM_ENV (env);
   	  jboolean result = 0;
   	  IDATA m_addr = (IDATA)addr;
@@ -103,6 +113,9 @@
 	  }
 	  hymem_free_memory(vec);
       return result;
+#else
+      return ;
+#endif /* !defined(ZOS) */
   }
 
 JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSMemory_flushImpl

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c?rev=591963&r1=591962&r2=591963&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
Mon Nov  5 03:30:46 2007
@@ -15,14 +15,26 @@
  *  limitations under the License.
  */
 
-#if defined(FREEBSD) || defined(AIX) || defined(MACOSX)
+#if defined(FREEBSD) || defined(AIX) || defined(MACOSX) || defined(ZOS)
 #include <sys/types.h>
 #include <netinet/in.h>
 #endif
+
+#if !defined(ZOS)
 #include <sys/poll.h>
+#else
+/* poll.h in a different location on zOS */
+#include <poll.h>
+#endif
+
+/* We do not get these header files "for free" on zOS, so we will use the
+  definitions for these structures defined in OSNetworkSystem.h */
+#if !defined(ZOS)
 #include <netinet/in_systm.h>
 #include<netinet/ip.h>
 #include<netinet/ip_icmp.h>
+#endif /* !ZOS */
+
 #include "nethelp.h"
 #include "harmonyglob.h"
 #include "hysock.h"
@@ -36,7 +48,11 @@
 #define SOCKET_ERROR -1
 
 unsigned short ip_checksum(unsigned short * buffer, int size);
+#if !defined(ZOS)
 void set_icmp_packet(struct icmp * icmp_hdr, int packet_size);
+#else
+void set_icmp_packet(struct ICMPHeader * icmp_hdr, int packet_size);
+#endif
 
 // Alternative Select function
 int
@@ -59,13 +75,21 @@
   (JNIEnv * env, jobject clz, jobject address, jobject localaddr,  jint ttl, jint timeout){
   PORT_ACCESS_FROM_ENV (env);
   struct sockaddr_in dest,source,local;
+#if !defined(ZOS)
   struct icmp * send_buf = 0;
   struct ip * recv_buf = 0;
+  struct icmp* icmphdr = 0;
+#else /* !ZOS */
+  struct ICMPHeader* send_buf = 0;
+  struct IPHeader* recv_buf = 0;
+  struct ICMPHeader* icmphdr = 0;
+#endif /* !ZOS */
   int result,ret=UNREACHABLE;
   struct pollfd my_pollfd;
   int sockadd_size = sizeof (source);
   jbyte host[HYSOCK_INADDR6_LEN];
   U_32 length;
+  unsigned short header_len = 0;
 
   int sock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
   if (INVALID_SOCKET == sock){
@@ -131,14 +155,25 @@
   	goto cleanup;
   }  
 			    
-  unsigned short header_len = recv_buf->ip_hl << 2;
-  struct icmp* icmphdr = (struct icmp*)((char*)recv_buf + header_len);
+#if !defined(ZOS)
+  header_len = recv_buf->ip_hl << 2;
+  icmphdr = (struct icmp*)((char*)recv_buf + header_len);
   if ((result < header_len + ICMP_SIZE)||
 	(icmphdr->icmp_type != ICMP_ECHO_REPLY)||
 	(icmphdr->icmp_id != getpid())) {	
 	if (!(icmphdr->icmp_type == ICMP_ECHO_REQUEST && icmphdr->icmp_seq == 0))
 		goto cleanup;
   }
+#else
+  header_len = recv_buf->h_len << 2;
+  icmphdr = (struct ICMPHeader*)((char*)recv_buf + header_len);
+  if ((result < header_len + ICMP_SIZE)||
+	(icmphdr->type != ICMP_ECHO_REPLY)||
+	(icmphdr->id != getpid())) {	
+	if (!(icmphdr->type == ICMP_ECHO_REQUEST && icmphdr->seq == 0))
+		goto cleanup;
+  }
+#endif
   ret = REACHABLE;
 cleanup:
 
@@ -173,8 +208,10 @@
     return (unsigned short )(~sum);
 }
 
+#if !defined(ZOS)
 void set_icmp_packet(struct icmp* icmp_hdr, int packet_size)
 {
+
     icmp_hdr->icmp_type = ICMP_ECHO_REQUEST;
     icmp_hdr->icmp_code = 0;
     icmp_hdr->icmp_cksum = 0;
@@ -184,6 +221,21 @@
     // Calculate a checksum on the result
     icmp_hdr->icmp_cksum = ip_checksum((unsigned short*)icmp_hdr, packet_size);
 }
+#else
+void set_icmp_packet(struct ICMPHeader* icmp_hdr, int packet_size)
+{
+
+    icmp_hdr->type = ICMP_ECHO_REQUEST;
+    icmp_hdr->code = 0;
+    icmp_hdr->checksum = 0;
+    icmp_hdr->id = getpid();
+    icmp_hdr->seq = 0;
+
+    // Calculate a checksum on the result
+    icmp_hdr->checksum = ip_checksum((unsigned short*)icmp_hdr, packet_size);
+}
+#endif
+
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem



Mime
View raw message