2012-05-31 09:33:35 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-05-19 20:13:25 +00:00
|
|
|
|
|
|
|
/* This file allows NSS to build by stubbing out
|
|
|
|
* features that aren't provided by Android/Bionic */
|
|
|
|
|
|
|
|
#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>
|
2014-12-17 02:35:09 +00:00
|
|
|
#include <sys/resource.h>
|
2016-03-14 22:19:12 +00:00
|
|
|
#include <linux/kernel.h>
|
2014-12-17 02:35:09 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
|
2016-07-22 07:40:21 +00:00
|
|
|
#ifndef ANDROID_VERSION
|
|
|
|
#include <android/api-level.h>
|
|
|
|
#define ANDROID_VERSION __ANDROID_API__
|
|
|
|
#endif
|
|
|
|
|
2016-03-14 22:19:12 +00:00
|
|
|
/* Use this stub version of getdtablesize
|
|
|
|
* instead of the one in the header */
|
|
|
|
__attribute__((unused))
|
|
|
|
static int getdtablesize_stub(void)
|
2014-12-17 02:35:09 +00:00
|
|
|
{
|
|
|
|
struct rlimit r;
|
|
|
|
if (getrlimit(RLIMIT_NOFILE, &r) < 0) {
|
|
|
|
return sysconf(_SC_OPEN_MAX);
|
|
|
|
}
|
|
|
|
return r.rlim_cur;
|
|
|
|
}
|
2016-03-14 22:19:12 +00:00
|
|
|
#define getdtablesize() getdtablesize_stub()
|
|
|
|
|
|
|
|
#if ANDROID_VERSION < 21
|
2014-12-17 02:35:09 +00:00
|
|
|
#define RTLD_NOLOAD 0
|
|
|
|
#endif
|
|
|
|
|
2010-05-19 20:13:25 +00:00
|
|
|
#define sysinfo(foo) -1
|
|
|
|
|
|
|
|
#endif /* ANDROID_STUB_H */
|