__system_property_get is now public for 64-bit
authorFredrik Fornwall <fredrik@fornwall.net>
Wed, 20 Apr 2016 07:06:40 +0000 (03:06 -0400)
committerFredrik Fornwall <fredrik@fornwall.net>
Wed, 20 Apr 2016 07:08:05 +0000 (03:08 -0400)
As of NDK r11 the __system_property_get is public, and
  https://developer.android.com/preview/behavior-changes.html#ndk
documents it, so no need to hack around.

packages/c-ares/ares_init.c.patch [deleted file]
packages/nodejs/deps-cares-src-ares_init.c.patch [deleted file]

diff --git a/packages/c-ares/ares_init.c.patch b/packages/c-ares/ares_init.c.patch
deleted file mode 100644 (file)
index 96ecfd2..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-diff -u -r ../c-ares-1.10.0/ares_init.c ./ares_init.c
---- ../c-ares-1.10.0/ares_init.c       2013-02-17 11:44:02.000000000 -0500
-+++ ./ares_init.c      2016-01-03 08:28:33.855590585 -0500
-@@ -43,7 +43,36 @@
- #endif
- #if defined(ANDROID) || defined(__ANDROID__)
--#include <sys/system_properties.h>
-+
-+# ifdef __LP64__
-+# include <dlfcn.h>
-+// http://stackoverflow.com/questions/28413530/api-to-get-android-system-properties-is-removed-in-arm64-platforms
-+// Android 64-bit makes __system_property_get a non-global symbol.
-+// Here we provide a stub which loads the symbol from libc via dlsym.
-+#define PROP_NAME_MAX 31
-+#define PROP_VALUE_MAX 91
-+typedef int (*PFN_SYSTEM_PROP_GET)(const char *, char *);
-+int __system_property_get(const char* name, char* value)
-+{
-+       static PFN_SYSTEM_PROP_GET __real_system_property_get = NULL;
-+       if (!__real_system_property_get) {
-+               // libc.so should already be open, get a handle to it.
-+               void *handle = dlopen("libc.so", RTLD_NOLOAD);
-+               if (!handle) {
-+                       printf("Cannot dlopen libc.so: %s.\n", dlerror());
-+               } else {
-+                       __real_system_property_get = (PFN_SYSTEM_PROP_GET)dlsym(handle, "__system_property_get");
-+               }
-+               if (!__real_system_property_get) {
-+                       printf("Cannot resolve __system_property_get(): %s.\n", dlerror());
-+               }
-+       }
-+       return (*__real_system_property_get)(name, value);
-+} 
-+# else
-+#  include <sys/system_properties.h>
-+#endif
-+
- /* From the Bionic sources */
- #define DNS_PROP_NAME_PREFIX  "net.dns"
- #define MAX_DNS_PROPERTIES    8
diff --git a/packages/nodejs/deps-cares-src-ares_init.c.patch b/packages/nodejs/deps-cares-src-ares_init.c.patch
deleted file mode 100644 (file)
index ec2f1c3..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-diff -u -r ../node-v4.2.2/deps/cares/src/ares_init.c ./deps/cares/src/ares_init.c
---- ../node-v4.2.2/deps/cares/src/ares_init.c  2015-11-03 15:00:03.000000000 -0500
-+++ ./deps/cares/src/ares_init.c       2015-12-01 21:18:14.327288234 -0500
-@@ -43,7 +43,35 @@
- #endif
- #if defined(ANDROID) || defined(__ANDROID__)
-+# ifdef __LP64__
-+# include <dlfcn.h>
-+// http://stackoverflow.com/questions/28413530/api-to-get-android-system-properties-is-removed-in-arm64-platforms
-+// Android 'L' makes __system_property_get a non-global symbol.
-+// Here we provide a stub which loads the symbol from libc via dlsym.
-+#define PROP_NAME_MAX 31
-+#define PROP_VALUE_MAX 91
-+typedef int (*PFN_SYSTEM_PROP_GET)(const char *, char *);
-+int __system_property_get(const char* name, char* value)
-+{
-+      static PFN_SYSTEM_PROP_GET __real_system_property_get = NULL;
-+      if (!__real_system_property_get) {
-+              // libc.so should already be open, get a handle to it.
-+              void *handle = dlopen("libc.so", RTLD_NOLOAD);
-+              if (!handle) {
-+                      printf("Cannot dlopen libc.so: %s.\n", dlerror());
-+              } else {
-+                      __real_system_property_get = (PFN_SYSTEM_PROP_GET)dlsym(handle, "__system_property_get");
-+              }
-+              if (!__real_system_property_get) {
-+                      printf("Cannot resolve __system_property_get(): %s.\n", dlerror());
-+              }
-+      }
-+      return (*__real_system_property_get)(name, value);
-+} 
-+# else
- #include <sys/system_properties.h>
-+#endif
-+
- /* From the Bionic sources */
- #define DNS_PROP_NAME_PREFIX  "net.dns"
- #define MAX_DNS_PROPERTIES    8