From e0100781277b2ca6e69975405f95195e28b19797 Mon Sep 17 00:00:00 2001
From: Raph Levien <raph@google.com>
Date: Tue, 21 Feb 2017 15:07:03 -0800
Subject: [PATCH] Make readdir available on all unix targets

The readdir_r call has problems, and we'll probably want to move to
readdir on many, if not most, unix targets. This patch makes readdir
available in unix, rather than just solaris as before.

See https://github.com/rust-lang/rust/issues/40021
---
 src/unix/mod.rs         | 3 +++
 src/unix/solaris/mod.rs | 1 -
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index 427553d1..224061c8 100644
--- a/src/unix/mod.rs
+++ b/src/unix/mod.rs
@@ -350,6 +350,9 @@ extern {
                link_name = "opendir$INODE64$UNIX2003")]
     #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")]
     pub fn opendir(dirname: *const c_char) -> *mut ::DIR;
+    #[cfg_attr(target_os = "macos", link_name = "readdir$INODE64")]
+    #[cfg_attr(target_os = "netbsd", link_name = "__readdir30")]
+    pub fn readdir(dirp: *mut ::DIR) -> *const ::dirent;
     #[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")]
     #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
     pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent,
diff --git a/src/unix/solaris/mod.rs b/src/unix/solaris/mod.rs
index 5a15f812..1247917b 100644
--- a/src/unix/solaris/mod.rs
+++ b/src/unix/solaris/mod.rs
@@ -1017,7 +1017,6 @@ extern {
                       buflen: ::c_int) -> *const passwd;
     pub fn setpwent();
     pub fn getpwent() -> *mut passwd;
-    pub fn readdir(dirp: *mut ::DIR) -> *const ::dirent;
     pub fn fdatasync(fd: ::c_int) -> ::c_int;
     pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
     pub fn duplocale(base: ::locale_t) -> ::locale_t;
-- 
GitLab