summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2017-02-21 15:07:03 -0800
committerRaph Levien <raph@google.com>2017-02-21 15:07:03 -0800
commite0100781277b2ca6e69975405f95195e28b19797 (patch)
treed95c0b11d0aaa432007df28bcee382c696dcf415
parent8d8264b967a31a1a8cebe2a05110564106b6e909 (diff)
downloadrust-libc-e0100781277b2ca6e69975405f95195e28b19797.tar.gz
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
-rw-r--r--src/unix/mod.rs3
-rw-r--r--src/unix/solaris/mod.rs1
2 files changed, 3 insertions, 1 deletions
diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index 427553d13e..224061c822 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 5a15f81286..1247917bc2 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;