Remove getdents from bionic.
Bug: 11156955
Change-Id: I6c306989801be552d85fba8a50dcdc79282fb9d2
diff --git a/libc/bionic/dirent.cpp b/libc/bionic/dirent.cpp
index 0f9b26a..091423e 100644
--- a/libc/bionic/dirent.cpp
+++ b/libc/bionic/dirent.cpp
@@ -37,6 +37,8 @@
#include "private/ErrnoRestorer.h"
#include "private/ScopedPthreadMutexLocker.h"
+extern "C" int __getdents64(unsigned int, struct dirent*, unsigned int);
+
struct DIR {
int fd_;
size_t available_bytes_;
@@ -81,7 +83,7 @@
}
static bool __fill_DIR(DIR* d) {
- int rc = TEMP_FAILURE_RETRY(getdents(d->fd_, d->buff_, sizeof(d->buff_)));
+ int rc = TEMP_FAILURE_RETRY(__getdents64(d->fd_, d->buff_, sizeof(d->buff_)));
if (rc <= 0) {
return false;
}
diff --git a/libc/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp
index cb9c9c9..b0adf26 100644
--- a/libc/bionic/ndk_cruft.cpp
+++ b/libc/bionic/ndk_cruft.cpp
@@ -238,4 +238,9 @@
return _signal(signum, handler, SA_RESETHAND);
}
+// This is a system call that was never in POSIX. Use readdir(3) instead.
+extern "C" int getdents(unsigned int fd, struct dirent* dirp, unsigned int count) {
+ return __getdents64(fd, dirp, count);
+}
+
#endif