Skip to content

Commit 0bfcd7a

Browse files
committed
Auto merge of rust-lang#617 - Mic92:dirfd, r=alexcrichton
Add dirfd on netbsd follow up of rust-lang/libc#571
2 parents c25d657 + 2c8ad9b commit 0bfcd7a

File tree

1 file changed

+9
-0
lines changed
  • src/unix/bsd/netbsdlike/netbsd

1 file changed

+9
-0
lines changed

src/unix/bsd/netbsdlike/netbsd/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,15 @@ pub const P_PGID: idtype_t = 4;
644644
pub const B460800: ::speed_t = 460800;
645645
pub const B921600: ::speed_t = 921600;
646646

647+
// dirfd() is a macro on netbsd to access
648+
// the first field of the struct where dirp points to:
649+
// http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36
650+
f! {
651+
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int {
652+
unsafe { *(dirp as *const ::c_int) }
653+
}
654+
}
655+
647656
extern {
648657
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
649658
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;

0 commit comments

Comments
 (0)