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

--HG--
extra : transplant_source : %03%8C/%E0%20t%D0%3Al4%D4Oh%CB_%07%8A%24r%CC
This commit is contained in:
Nathan Toone 2016-03-14 16:19:12 -06:00
parent f0d2a7676e
commit 4557e5f651

View File

@ -13,13 +13,14 @@
#define _SYS_SYSINFO_H_
#include <sys/cdefs.h>
#include <linux/kernel.h>
#if ANDROID_VERSION >= 21
#include <sys/resource.h>
#include <linux/kernel.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) {
@ -27,9 +28,10 @@ static int getdtablesize(void)
}
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