Skip to content

Commit

Permalink
Merge pull request rust-lang#24 from alexcrichton/dirent
Browse files Browse the repository at this point in the history
Define dirent_t on all platforms
  • Loading branch information
alexcrichton committed Oct 30, 2015
2 parents 171b05b + d6e07e2 commit fa607f4
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ pub type ssize_t = isize;

pub enum FILE {}
pub enum fpos_t {}
pub enum DIR {}
pub enum dirent {}

extern {
pub fn isalnum(c: c_int) -> c_int;
Expand Down
9 changes: 9 additions & 0 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,20 @@ s! {
pub st_qspare: [::int64_t; 2],
}

pub struct dirent {
pub d_ino: u64,
pub d_seekoff: u64,
pub d_reclen: u16,
pub d_namlen: u16,
pub d_type: u8,
pub d_name: [::c_char; 1024],
}

pub struct pthread_mutex_t {
__sig: ::c_long,
__opaque: [u8; __PTHREAD_MUTEX_SIZE__],
}

pub struct pthread_mutexattr_t {
__sig: ::c_long,
__opaque: [u8; 8],
Expand Down
8 changes: 8 additions & 0 deletions src/unix/bsd/freebsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ pub type pthread_key_t = ::c_int;
pub enum timezone {}

s! {
pub struct dirent {
pub d_fileno: u32,
pub d_reclen: u16,
pub d_type: u8,
pub d_namelen: u8,
pub d_name: [::c_char; 256],
}

pub struct glob_t {
pub gl_pathc: ::size_t,
__unused1: ::size_t,
Expand Down
10 changes: 10 additions & 0 deletions src/unix/bsd/openbsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ pub type rlim_t = u64;
pub enum timezone {}

s! {
pub struct dirent {
pub d_fileno: ::ino_t,
pub d_off: ::off_t,
pub d_reclen: u16,
pub d_type: u8,
pub d_namelen: u8,
__d_padding: [u8; 4],
pub d_name: [::c_char; 256],
}

pub struct siginfo_t {
pub si_signo: ::c_int,
pub si_code: ::c_int,
Expand Down
2 changes: 2 additions & 0 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ pub type in_addr_t = u32;
pub type in_port_t = u16;
pub type sighandler_t = ::size_t;

pub enum DIR {}

s! {
pub struct utimbuf {
pub actime: time_t,
Expand Down
8 changes: 8 additions & 0 deletions src/unix/notbsd/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ s! {
pub st_ino: ::c_ulonglong,
}

pub struct dirent {
pub d_ino: u64,
pub d_off: i64,
pub d_reclen: ::c_ushort,
pub d_type: ::c_uchar,
pub d_name: [::c_char; 256],
}

pub struct pthread_attr_t {
pub flags: ::uint32_t,
pub stack_base: *mut ::c_void,
Expand Down
8 changes: 8 additions & 0 deletions src/unix/notbsd/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ pub type pthread_t = c_ulong;
pub type mode_t = u32;

s! {
pub struct dirent {
pub d_ino: ::ino_t,
pub d_off: ::off_t,
pub d_reclen: ::c_ushort,
pub d_type: ::c_uchar,
pub d_name: [::c_char; 256],
}

pub struct glob_t {
pub gl_pathc: ::size_t,
pub gl_pathv: *mut *mut c_char,
Expand Down

0 comments on commit fa607f4

Please sign in to comment.