Skip to content

Commit fa607f4

Browse files
committed
Merge pull request rust-lang#24 from alexcrichton/dirent
Define dirent_t on all platforms
2 parents 171b05b + d6e07e2 commit fa607f4

File tree

7 files changed

+45
-2
lines changed

7 files changed

+45
-2
lines changed

src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ pub type ssize_t = isize;
101101

102102
pub enum FILE {}
103103
pub enum fpos_t {}
104-
pub enum DIR {}
105-
pub enum dirent {}
106104

107105
extern {
108106
pub fn isalnum(c: c_int) -> c_int;

src/unix/bsd/apple/mod.rs

+9
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,20 @@ s! {
8383
pub st_qspare: [::int64_t; 2],
8484
}
8585

86+
pub struct dirent {
87+
pub d_ino: u64,
88+
pub d_seekoff: u64,
89+
pub d_reclen: u16,
90+
pub d_namlen: u16,
91+
pub d_type: u8,
92+
pub d_name: [::c_char; 1024],
93+
}
8694

8795
pub struct pthread_mutex_t {
8896
__sig: ::c_long,
8997
__opaque: [u8; __PTHREAD_MUTEX_SIZE__],
9098
}
99+
91100
pub struct pthread_mutexattr_t {
92101
__sig: ::c_long,
93102
__opaque: [u8; 8],

src/unix/bsd/freebsdlike/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ pub type pthread_key_t = ::c_int;
1616
pub enum timezone {}
1717

1818
s! {
19+
pub struct dirent {
20+
pub d_fileno: u32,
21+
pub d_reclen: u16,
22+
pub d_type: u8,
23+
pub d_namelen: u8,
24+
pub d_name: [::c_char; 256],
25+
}
26+
1927
pub struct glob_t {
2028
pub gl_pathc: ::size_t,
2129
__unused1: ::size_t,

src/unix/bsd/openbsdlike/mod.rs

+10
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ pub type rlim_t = u64;
2222
pub enum timezone {}
2323

2424
s! {
25+
pub struct dirent {
26+
pub d_fileno: ::ino_t,
27+
pub d_off: ::off_t,
28+
pub d_reclen: u16,
29+
pub d_type: u8,
30+
pub d_namelen: u8,
31+
__d_padding: [u8; 4],
32+
pub d_name: [::c_char; 256],
33+
}
34+
2535
pub struct siginfo_t {
2636
pub si_signo: ::c_int,
2737
pub si_code: ::c_int,

src/unix/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ pub type in_addr_t = u32;
1010
pub type in_port_t = u16;
1111
pub type sighandler_t = ::size_t;
1212

13+
pub enum DIR {}
14+
1315
s! {
1416
pub struct utimbuf {
1517
pub actime: time_t,

src/unix/notbsd/android/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ s! {
4343
pub st_ino: ::c_ulonglong,
4444
}
4545

46+
pub struct dirent {
47+
pub d_ino: u64,
48+
pub d_off: i64,
49+
pub d_reclen: ::c_ushort,
50+
pub d_type: ::c_uchar,
51+
pub d_name: [::c_char; 256],
52+
}
53+
4654
pub struct pthread_attr_t {
4755
pub flags: ::uint32_t,
4856
pub stack_base: *mut ::c_void,

src/unix/notbsd/linux/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ pub type pthread_t = c_ulong;
77
pub type mode_t = u32;
88

99
s! {
10+
pub struct dirent {
11+
pub d_ino: ::ino_t,
12+
pub d_off: ::off_t,
13+
pub d_reclen: ::c_ushort,
14+
pub d_type: ::c_uchar,
15+
pub d_name: [::c_char; 256],
16+
}
17+
1018
pub struct glob_t {
1119
pub gl_pathc: ::size_t,
1220
pub gl_pathv: *mut *mut c_char,

0 commit comments

Comments
 (0)