Merge "Make use of the DNS query hook in the netcontext"
diff --git a/libc/include/sys/epoll.h b/libc/include/sys/epoll.h
index b7fdd4d..5e92fdc 100644
--- a/libc/include/sys/epoll.h
+++ b/libc/include/sys/epoll.h
@@ -75,6 +75,22 @@
int epoll_create(int);
int epoll_create1(int) __INTRODUCED_IN(21);
+
+/*
+ * Some third-party code uses the existence of EPOLL_CLOEXEC to detect the
+ * availability of epoll_create1. This is not correct, since having up-to-date
+ * UAPI headers says nothing about the C library, but for the time being we
+ * don't want to harm adoption to the unified headers. We'll undef EPOLL_CLOEXEC
+ * if we don't have epoll_create1 for the time being, and maybe revisit this
+ * later.
+ *
+ * https://github.com/android-ndk/ndk/issues/302
+ * https://github.com/android-ndk/ndk/issues/394
+ */
+#if __ANDROID_API__ < __ANDROID_API_L__ && defined(EPOLL_CLOEXEC)
+#undef EPOLL_CLOEXEC
+#endif
+
int epoll_ctl(int, int, int, struct epoll_event*);
int epoll_wait(int, struct epoll_event*, int, int);
int epoll_pwait(int, struct epoll_event*, int, int, const sigset_t*) __INTRODUCED_IN(21);
diff --git a/libc/include/sys/inotify.h b/libc/include/sys/inotify.h
index 2e99144..98f7198 100644
--- a/libc/include/sys/inotify.h
+++ b/libc/include/sys/inotify.h
@@ -37,8 +37,21 @@
__BEGIN_DECLS
+/*
+ * Some third-party code uses the existence of IN_CLOEXEC/IN_NONBLOCK to detect
+ * the availability of inotify_init1. This is not correct, since
+ * `syscall(__NR_inotify_init1, IN_CLOEXEC)` is still valid even if the C
+ * library doesn't have that function, but for the time being we don't want to
+ * harm adoption to the unified headers. We'll avoid defining IN_CLOEXEC and
+ * IN_NONBLOCK if we don't have inotify_init1 for the time being, and maybe
+ * revisit this later.
+ *
+ * https://github.com/android-ndk/ndk/issues/394
+ */
+#if __ANDROID_API__ >= __ANDROID_API_L__
#define IN_CLOEXEC O_CLOEXEC
#define IN_NONBLOCK O_NONBLOCK
+#endif
int inotify_init(void);
int inotify_init1(int) __INTRODUCED_IN(21);
diff --git a/tests/libs/Android.build.dlext_testzip.mk b/tests/libs/Android.build.dlext_testzip.mk
index 0220ae2..4b6d099 100644
--- a/tests/libs/Android.build.dlext_testzip.mk
+++ b/tests/libs/Android.build.dlext_testzip.mk
@@ -22,7 +22,7 @@
include $(CLEAR_VARS)
-LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_CLASS := NATIVE_TESTS
LOCAL_MODULE := libdlext_test_zip_zipaligned
LOCAL_MODULE_SUFFIX := .zip
LOCAL_MODULE_PATH := $($(bionic_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs/libdlext_test_zip
@@ -44,7 +44,7 @@
include $(CLEAR_VARS)
-LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_CLASS := NATIVE_TESTS
LOCAL_MODULE := libdlext_test_runpath_zip_zipaligned
LOCAL_MODULE_SUFFIX := .zip
LOCAL_MODULE_PATH := $($(bionic_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs/libdlext_test_runpath_zip