Bug 1092004 - Use getdtablesize for non-gonk builds as well. r=glandium draft
authorNathan Toone <nathan@toonetown.com>
Mon, 14 Mar 2016 16:19:12 -0600
changeset 340035 038c2fe02074d03a6c34d44f68cb5f078a2472cc
parent 339874 f0c0480732d36153e8839c7f17394d45f679f87d
child 516127 da4130aeeb700583858f7fac7082c037b090a4c5
push id12888
push usernathan@toonetown.com
push dateMon, 14 Mar 2016 22:20:15 +0000
bugs1092004, 1103816
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
--- a/security/manager/android_stub.h
+++ b/security/manager/android_stub.h
@@ -8,30 +8,32 @@
 /* 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>
-#include <sys/resource.h>
 #include <unistd.h>
-static int getdtablesize(void)
+/* Use this stub version of getdtablesize
+ * instead of the one in the header */
+static int getdtablesize_stub(void)
     struct rlimit r;
     if (getrlimit(RLIMIT_NOFILE, &r) < 0) {
         return sysconf(_SC_OPEN_MAX);
     return r.rlim_cur;
+#define getdtablesize() getdtablesize_stub()
 #define RTLD_NOLOAD 0
-extern int getdtablesize(void);
 #define sysinfo(foo) -1
 #endif /* ANDROID_STUB_H */