diff options
author | bors <bors@rust-lang.org> | 2018-06-28 00:14:38 +0000 |
---|---|---|
committer | bors <bors@rust-lang.org> | 2018-06-28 00:14:38 +0000 |
commit | 93bc59e63757de77ab2266c567f400b2eddd5b6b (patch) | |
tree | fe1e6023cab6b469af1f967dea6a149c4c8111ed | |
parent | 23578141f29c8488ab5092b50d4c264e3debdb4c (diff) | |
parent | 322ba046d8375d3c607860b5aff2b45f4cdd5c37 (diff) | |
download | rust-libc-93bc59e63757de77ab2266c567f400b2eddd5b6b.tar.gz |
Auto merge of #1018 - scottlamb:pr-fdopendir, r=alexcrichton
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
-rw-r--r-- | src/unix/bsd/freebsdlike/mod.rs | 2 | ||||
-rw-r--r-- | src/unix/bsd/netbsdlike/mod.rs | 2 | ||||
-rw-r--r-- | src/unix/haiku/mod.rs | 1 | ||||
-rw-r--r-- | src/unix/mod.rs | 7 | ||||
-rw-r--r-- | src/unix/notbsd/mod.rs | 2 | ||||
-rw-r--r-- | src/unix/solaris/mod.rs | 2 | ||||
-rw-r--r-- | src/unix/uclibc/mod.rs | 2 |
7 files changed, 7 insertions, 11 deletions
diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 3c079fbdbc..75a7a670e9 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1178,8 +1178,6 @@ extern { pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int; pub fn rtprio(function: ::c_int, pid: ::pid_t, rtp: *mut rtprio) -> ::c_int; - pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; - #[cfg_attr(target_os = "freebsd", link_name = "mknodat@FBSD_1.1")] pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, dev: dev_t) -> ::c_int; diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index efbcdedea4..1b7576e768 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -640,8 +640,6 @@ extern { pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; - pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; - pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, dev: dev_t) -> ::c_int; pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index 8e312856ed..dd3dc7b163 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -1097,7 +1097,6 @@ extern { pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int) -> ::c_int; - pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; pub fn glob(pattern: *const ::c_char, flags: ::c_int, errfunc: Option<extern fn(epath: *const ::c_char, diff --git a/src/unix/mod.rs b/src/unix/mod.rs index deea948324..15c7821fa1 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -424,6 +424,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")] diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index 8fbe98da22..eead3fd847 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -1129,8 +1129,6 @@ extern { pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int; pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int; - pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; - pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, dev: dev_t) -> ::c_int; pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t, diff --git a/src/unix/solaris/mod.rs b/src/unix/solaris/mod.rs index aecc611777..d76bb80270 100644 --- a/src/unix/solaris/mod.rs +++ b/src/unix/solaris/mod.rs @@ -1297,8 +1297,6 @@ extern { pub fn getpriority(which: ::c_int, who: ::c_int) -> ::c_int; pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int; - pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; - pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, dev: dev_t) -> ::c_int; pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, diff --git a/src/unix/uclibc/mod.rs b/src/unix/uclibc/mod.rs index 49f7792d0a..e9c1f21e9e 100644 --- a/src/unix/uclibc/mod.rs +++ b/src/unix/uclibc/mod.rs @@ -1612,8 +1612,6 @@ extern { pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int; pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; - pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; - pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, dev: dev_t) -> ::c_int; pub fn ppoll(fds: *mut ::pollfd, |