Commit 4785581a authored by Narayan Kamath's avatar Narayan Kamath
Browse files

Build native code for the host.

Nothing too alarming, except for a change to deal with code
that assumed imr_multiaddr and imr_interface in ip_mreq were
uint32_t (like in the kernel UAPI) and not in_addr like they
are in glibc.

Change-Id: I98f7208939df12edb086e6cdf6f09cec0527ec50
parent 29c564f6
......@@ -65,12 +65,11 @@ LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/NativeCode.mk
core_src_files :=
openjdk_core_src_files :=
#Include the sub.m in openjdk.
#Include the sub.mk for openjdk.
$(foreach dir, \
ojluni/src/main/native, \
$(eval $(call include-openjdk-native-dir,$(dir))))
# Include the sub.mk files.
$(foreach dir, \
dalvik/src/main/native luni/src/main/native, \
......@@ -165,6 +164,19 @@ LOCAL_STATIC_LIBRARIES += $(core_static_libraries) libziparchive-host libutils
LOCAL_MULTILIB := both
include $(BUILD_HOST_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(openjdk_core_src_files)
LOCAL_C_INCLUDES := $(core_c_includes)
LOCAL_CFLAGS := -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -DLINUX -D__GLIBC__ # Sigh.
LOCAL_SHARED_LIBRARIES := $(core_shared_libraries) libcrypto-host libz-host
LOCAL_SHARED_LIBRARIES += libart libnativehelper
LOCAL_STATIC_LIBRARIES := $(core_static_libraries) libfdlibm
LOCAL_MODULE_TAGS := optional
LOCAL_LDLIBS += -ldl -lpthread
LOCAL_MODULE := libopenjdkjavacore
LOCAL_MULTILIB := both
include $(BUILD_HOST_SHARED_LIBRARY)
ifeq ($(LIBCORE_SKIP_TESTS),)
include $(CLEAR_VARS)
LOCAL_CLANG := true
......
......@@ -451,10 +451,18 @@ Java_sun_nio_ch_Net_joinOrDrop4(JNIEnv *env, jobject this, jboolean join, jobjec
#ifdef MACOSX
/* no IPv4 include-mode filtering for now */
return IOS_UNAVAILABLE;
#else
// Begin Android changed.
#if defined(__GLIBC__)
mreq_source.imr_multiaddr.s_addr = htonl(group);
mreq_source.imr_sourceaddr.s_addr = htonl(source);
mreq_source.imr_interface.s_addr = htonl(interf);
#else
mreq_source.imr_multiaddr = htonl(group);
mreq_source.imr_sourceaddr = htonl(source);
mreq_source.imr_interface = htonl(interf);
#endif
// End Android changed.
opt = (join) ? IP_ADD_SOURCE_MEMBERSHIP : IP_DROP_SOURCE_MEMBERSHIP;
optval = (void*)&mreq_source;
optlen = sizeof(mreq_source);
......@@ -482,9 +490,16 @@ Java_sun_nio_ch_Net_blockOrUnblock4(JNIEnv *env, jobject this, jboolean block, j
int n;
int opt = (block) ? IP_BLOCK_SOURCE : IP_UNBLOCK_SOURCE;
mreq_source.imr_multiaddr = htonl(group);
mreq_source.imr_sourceaddr = htonl(source);
mreq_source.imr_interface = htonl(interf);
// Begin Android changed.
#if defined(__GLIBC__)
mreq_source.imr_multiaddr.s_addr = htonl(group);
mreq_source.imr_sourceaddr.s_addr = htonl(source);
mreq_source.imr_interface.s_addr = htonl(interf);
#else
mreq_source.imr_multiaddr = htonl(group);
mreq_source.imr_sourceaddr = htonl(source);
mreq_source.imr_interface = htonl(interf);
#endif
n = setsockopt(fdval(env,fdo), IPPROTO_IP, opt,
(void*)&mreq_source, sizeof(mreq_source));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment