You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2009/02/24 14:21:41 UTC
svn commit: r747375 -
/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c
Author: hindessm
Date: Tue Feb 24 13:21:41 2009
New Revision: 747375
URL: http://svn.apache.org/viewvc?rev=747375&view=rev
Log:
Workaround to compile on Aix and hopefully zOS with slight loss of
functionality.
Modified:
harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c?rev=747375&r1=747374&r2=747375&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/helpers.c Tue Feb 24 13:21:41 2009
@@ -42,6 +42,11 @@
#include "jclprots.h"
#include "harmonyglob.h"
+#if defined(LINUX)
+#define HAS_RTNETLINK 1
+#endif
+
+#if defined(HAS_RTNETLINK)
#include <asm/types.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
@@ -70,6 +75,7 @@
U_32 remainingLength;
U_32 done;
} netlinkContext_struct;
+#endif
int portCmp (const void **a, const void **b);
@@ -486,6 +492,7 @@
jboolean isEmpty = JNI_TRUE;
jbyteArray bytearray = NULL;
+#if defined(SIOCGIFHWADDR)
/* required call if we are going to call port library methods */
PORT_ACCESS_FROM_ENV (env);
@@ -537,9 +544,11 @@
}
close(fd);
hymem_free_memory (interfaceName);
+#endif
return bytearray;
}
+#if defined(HAS_RTNETLINK)
void
initNetlinkContext (I_32 netlinkSocketHandle,
struct netlinkContext_struct * netlinkContext)
@@ -709,6 +718,7 @@
}
}
}
+#endif
I_32
getPlatformInterfaceAddresses(JNIEnv * env,
@@ -717,15 +727,16 @@
interfaceAddressArray_struct* interfaceAddressArray)
{
interfaceAddress_struct *interfaces = NULL;
- int counter = 0;
+ U_32 numAddresses = 0;
+#if defined(HAS_RTNETLINK)
+ int counter = 0;
U_8 addressFamily = 0;
int netlinkSocketHandle = 0;
netlinkContext_struct netlinkContext;
struct addrReq_struct addrRequest;
U_32 sendLength = 0;
U_32 result = 0;
- U_32 numAddresses = 0;
struct nlmsghdr *currentNlHeader = NULL;
struct ifaddrmsg *returnedAddrHeader = NULL;
@@ -893,13 +904,15 @@
}
- interfaceAddressArray -> length = numAddresses;
- interfaceAddressArray -> elements = interfaces;
-
/* do any final clean up before returning */
close (netlinkSocketHandle);
cleanupNetlinkContext(env, &netlinkContext);
- return 0;
+
+#endif
+ interfaceAddressArray -> length = numAddresses;
+ interfaceAddressArray -> elements = interfaces;
+
+ return 0;
}
I_32