Bug 1092004 - Use getdtablesize for non-gonk builds as well. r=glandium
authorNathan Toone <nathan@toonetown.com>
Mon, 14 Mar 2016 16:19:12 -0600
changeset 288943 3a99126a3b55fc9f4bd327c4ed232cfd4284dcde
parent 288942 4b003bd6f7362b9b00e67b1dcd20bbf9477a524f
child 288944 ffdeaea4ceaeafe10594ae274acf2c1d913b6f33
push id73628
push usercbook@mozilla.com
push dateWed, 16 Mar 2016 10:02:13 +0000
treeherdermozilla-inbound@ffdeaea4ceae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1092004, 1103816
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1092004 - Use getdtablesize for non-gonk builds as well. r=glandium When building non-gonk builds, ANDROID_VERSION is not set. Beginning with NDK 11, getdtablesize is no longer included. This means that we should use the stub version of the function that is defined in android_stub.h for all android platforms. This patch moves the function out of the "#if ANDROID_VERSION >=21" block so that all android code can use it. Adding glandium as the reviewer, because he reviewed the original patch at bug 1103816. MozReview-Commit-ID: 2NmUl5XuvDS
security/manager/android_stub.h
--- a/security/manager/android_stub.h
+++ b/security/manager/android_stub.h
@@ -8,30 +8,32 @@
 #ifndef ANDROID_STUB_H
 #define ANDROID_STUB_H
 
 /* sysinfo is defined but not implemented.
  * we may be able to implement it ourselves. */
 #define _SYS_SYSINFO_H_
 
 #include <sys/cdefs.h>
+#include <sys/resource.h>
 #include <linux/kernel.h>
-
-#if ANDROID_VERSION >= 21
-#include <sys/resource.h>
 #include <unistd.h>
 
-static int getdtablesize(void)
+/* Use this stub version of getdtablesize
+ * instead of the one in the header */
+__attribute__((unused))
+static int getdtablesize_stub(void)
 {
     struct rlimit r;
     if (getrlimit(RLIMIT_NOFILE, &r) < 0) {
         return sysconf(_SC_OPEN_MAX);
     }
     return r.rlim_cur;
 }
-#else
+#define getdtablesize() getdtablesize_stub()
+
+#if ANDROID_VERSION < 21
 #define RTLD_NOLOAD 0
-extern int getdtablesize(void);
 #endif
 
 #define sysinfo(foo) -1
 
 #endif /* ANDROID_STUB_H */