summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-06-14 14:06:36 +0000
committerbors <bors@rust-lang.org>2017-06-14 14:06:36 +0000
commit0bfcd7a1b84fef84028204c3c0d70506723056ae (patch)
treec8923321ac185c9ae3eece7eea37b3c7b9186478
parentc25d65702933faa92010c81b1630683853addf82 (diff)
parent2c8ad9b0c33adb7bcd83508842523b5dde1adf78 (diff)
downloadrust-libc-0bfcd7a1b84fef84028204c3c0d70506723056ae.tar.gz
Auto merge of #617 - Mic92:dirfd, r=alexcrichton
Add dirfd on netbsd follow up of https://github.com/rust-lang/libc/pull/571
-rw-r--r--src/unix/bsd/netbsdlike/netbsd/mod.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs
index 053a2b424c..a02616792b 100644
--- a/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -644,6 +644,15 @@ pub const P_PGID: idtype_t = 4;
pub const B460800: ::speed_t = 460800;
pub const B921600: ::speed_t = 921600;
+// dirfd() is a macro on netbsd to access
+// the first field of the struct where dirp points to:
+// http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36
+f! {
+ pub fn dirfd(dirp: *mut ::DIR) -> ::c_int {
+ unsafe { *(dirp as *const ::c_int) }
+ }
+}
+
extern {
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;