diff options
author | Scott Lamb <slamb@slamb.org> | 2018-06-05 06:28:03 -0700 |
---|---|---|
committer | Scott Lamb <slamb@slamb.org> | 2018-06-07 21:49:10 -0700 |
commit | 322ba046d8375d3c607860b5aff2b45f4cdd5c37 (patch) | |
tree | 9177952d5bc1dc8df63157af0be5fbaeff8d72aa /src/unix/mod.rs | |
parent | 8a85d662b90c14d458bc4ae9521a05564e20d7ae (diff) | |
download | rust-libc-322ba046d8375d3c607860b5aff2b45f4cdd5c37.tar.gz |
add fdopendir on macOS
Fixes #1017
I moved it up to src/unix/mod.rs, as it's specified in POSIX.1-2008 and
appears to be implemented on every Unix-like system.
The symbol names on macOS appear similar to those for opendir; I found
them via the commands below. I tested the x86_64 version;
fdopendir$INODE64 worked as expected.
$ nm -arch x86_64 /usr/lib/system/libsystem_c.dylib | grep fdopendir
000000000007ea6d T _fdopendir
000000000002ba97 T _fdopendir$INODE64
$ nm -arch i386 /usr/lib/system/libsystem_c.dylib | grep fdopendir
00082d1e T _fdopendir
0002b528 T _fdopendir$INODE64$UNIX2003
00082d1e T _fdopendir$UNIX2003
Diffstat (limited to 'src/unix/mod.rs')
-rw-r--r-- | src/unix/mod.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/unix/mod.rs b/src/unix/mod.rs index d6cde7ae71..2810266f0c 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -416,6 +416,13 @@ 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(all(target_os = "macos", target_arch = "x86_64"), + link_name = "fdopendir$INODE64")] + #[cfg_attr(all(target_os = "macos", target_arch = "x86"), + link_name = "fdopendir$INODE64$UNIX2003")] + pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; + #[cfg_attr(target_os = "macos", link_name = "readdir$INODE64")] #[cfg_attr(target_os = "netbsd", link_name = "__readdir30")] #[cfg_attr(target_os = "freebsd", link_name = "readdir@FBSD_1.0")] |