Removes getdtablesize(3) from LP64.
getdtablesize(3) was removed fro POSIX 2004. Keep the symbol around in LP32 for
binary compatibility, but remove the declaration from unistd.h.
Bug: 13935372
Change-Id: I1f96cd290bf9176f922dad58bd5a7ab2cae7ef0f
diff --git a/libc/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp
index 4834d6e..43078fd 100644
--- a/libc/bionic/ndk_cruft.cpp
+++ b/libc/bionic/ndk_cruft.cpp
@@ -255,4 +255,15 @@
return wait4(-1, status, options, rusage);
}
+// This was removed from POSIX 2004.
+extern "C" int getdtablesize() {
+ struct rlimit r;
+
+ if (getrlimit(RLIMIT_NOFILE, &r) < 0) {
+ return sysconf(_SC_OPEN_MAX);
+ }
+
+ return r.rlim_cur;
+}
+
#endif