punybench: remove readdir_r
`readdir_r` is deprecated in glibc 2.24.
It is advised to use the readdir instead.
BUG=chromium:859528
TEST=emerge-samus punybench passes with glibc 2.27
Change-Id: I108c37eb3509137e72839727e6f2bc759e215deb
Reviewed-on: https://chromium-review.googlesource.com/1122844
Commit-Ready: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
diff --git a/fcalls.d/dir.c b/fcalls.d/dir.c
index 46d3b67..5a59ea1 100644
--- a/fcalls.d/dir.c
+++ b/fcalls.d/dir.c
@@ -114,13 +114,11 @@
void for_each_file (dir_s *dir, dir_f fn, void *user)
{
DIR *d;
- struct dirent entry;
struct dirent *result;
d = opendir(dir->name);
for (;;) {
- readdir_r(d, &entry, &result);
+ result = readdir(d);
if (result == NULL) break;
- if (!fn(&entry, user)) break;
}
closedir(d);
}
diff --git a/fcalls.d/fcalls.c b/fcalls.d/fcalls.c
index d41993c..2bbca10 100644
--- a/fcalls.d/fcalls.c
+++ b/fcalls.d/fcalls.c
@@ -674,16 +674,6 @@
return ent;
}
-int readdir_rk (Where_s w, int expected_err, DIR *dir, struct dirent *entry,
- struct dirent **result)
-{
- START_TIMER;
- s64 rc = readdir_r(dir, entry, result);
- STOP_TIMER;
- return Check(w, rc, expected_err, 0, "readdir_r(%p, %p, %p)",
- dir, entry, result);
-}
-
void rewinddirk (Where_s w, DIR *dir)
{
START_TIMER;
diff --git a/fcalls.d/fcalls.h b/fcalls.d/fcalls.h
index a27aca1..1c63634 100644
--- a/fcalls.d/fcalls.h
+++ b/fcalls.d/fcalls.h
@@ -87,7 +87,6 @@
#define closedir(dir) closedirk (WHERE, 0, dir)
#define opendir(p) opendirk (WHERE, FALSE, p)
#define readdir(d) readdirk (WHERE, d)
-#define readdir_r(d, t, r) readdir_rk(WHERE, 0, d, t, r)
#define rewinddir(d) rewinddirk(WHERE, d)
#define seekdir(d, o) seekdirk (WHERE, d, o)
#define telldir(d) telldirk (WHERE, 0, d)
diff --git a/fcalls.d/wrapper.h b/fcalls.d/wrapper.h
index de51b80..43a7101 100644
--- a/fcalls.d/wrapper.h
+++ b/fcalls.d/wrapper.h
@@ -104,8 +104,6 @@
int closedirk(Where_s w, int expected_err, DIR *dir);
DIR *opendirk(Where_s w, bool is_null, const char *path);
struct dirent *readdirk(Where_s w, DIR *dir);
-int readdir_rk(Where_s w, int expected_err, DIR *dir,
- struct dirent *entry, struct dirent **result);
void rewinddirk (Where_s w, DIR *dir);
void seekdirk(Where_s w, DIR *dir, long offset);
long telldirk(Where_s w, int expected_err, DIR *dir);